From 5633df2bb359e7a77851f51ad69349cff7aa3fe5 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Sat, 20 Feb 2010 18:41:22 +0000 Subject: Make quite and cousins more vi like --- xxxterm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xxxterm.c b/xxxterm.c index 715e830..a9369f5 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -119,6 +119,7 @@ struct karg { #define XT_TAB_INVALID (0) #define XT_TAB_NEW (1) #define XT_TAB_DELETE (2) +#define XT_TAB_DELQUIT (3) /* globals */ extern char *__progname; @@ -294,6 +295,12 @@ tabaction(struct tab *t, struct karg *args) case XT_TAB_DELETE: delete_tab(t); break; + case XT_TAB_DELQUIT: + if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook)) > 1) + delete_tab(t); + else + quit(t, args); + break; default: rv = XT_CB_PASSTHROUGH; goto done; @@ -420,9 +427,15 @@ struct cmd { int (*func)(struct tab *, struct karg *); struct karg arg; } cmds[] = { - { "quit", 0, quit, {0} }, + { "q!", 0, quit, {0} }, + { "qa", 0, quit, {0} }, + { "qa!", 0, quit, {0} }, + + /* tabs */ { "tabnew", 1, tabaction, {.i = XT_TAB_NEW} }, { "tabclose", 0, tabaction, {.i = XT_TAB_DELETE} }, + { "quit", 0, tabaction, {.i = XT_TAB_DELQUIT} }, + { "q", 0, tabaction, {.i = XT_TAB_DELQUIT} }, { "tabprevious", 0, movetab, {.i = XT_TAB_PREV} }, { "tabnext", 0, movetab, {.i = XT_TAB_NEXT} }, }; -- cgit 1.4.1-2-gfad0