about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2010-02-20 18:41:22 +0000
committerMarco Peereboom <marco@conformal.com>2010-02-20 18:41:22 +0000
commit5633df2bb359e7a77851f51ad69349cff7aa3fe5 (patch)
treeea288afd86c4a8906d13b50307ae86158b339bd4
parent5066150d51d6efb20fcd5af5555e3ab798d73b6a (diff)
downloadxombrero-5633df2bb359e7a77851f51ad69349cff7aa3fe5.tar.gz
Make quite and cousins more vi like
-rw-r--r--xxxterm.c15
1 files changed, 14 insertions, 1 deletions
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} },
 };