Hi all!

I've included a patch that adds a setting that defines which tab to select 
after a tab is closed. The setting is 'tabcloseleft' or 'tcl' (maybe not the 
best name, but it's the best I could come up with), and when enabled causes the 
previous tab to be selected, as opposed to the next tab (the current 
functionality). The setting is off by default so nothing changes for users that 
don't know about it.

Here is an example of what it does. Let's say I have the following tabs:

  one     [two]      three

Tab 'two' is selected (denoted by []). Currently, if I close that tab, tab 
'three' will be selected:

  one     [three]

With ':set tabcloseleft', tab 'one' will be selected:

  [one]     three

I've tested closing on the first tab, the last tab and every tab in between. 
Also, this works regardless of how the tab is closed (:tabclose, closing the 
last window in the tab, etc).


This is my first patch, so apologies if I've missed some critical information 
in this submission, forgot to modify or add something in code that's necessary 
for new settings, overlooked previous attempts at adding this same feature or 
missed the ball completely on where you all are trying to take vim. I believe 
this to be in line with vim (customizable but fast and unobtrusive), but let me 
know if it's not, and if there is anything I can do to fix it.

Thanks!

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r 6581d543a54c src/option.c
--- a/src/option.c	Thu Aug 02 21:48:24 2012 +0200
+++ b/src/option.c	Sat Aug 04 01:01:30 2012 -0700
@@ -2472,6 +2472,9 @@
 			    {(char_u *)0L, (char_u *)0L}
 #endif
 			    SCRIPTID_INIT},
+    {"tabcloseleft", "tcl", P_BOOL,
+			    (char_u *)&p_tcl, PV_NONE,
+			    {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT},
     {"tabline",	    "tal",  P_STRING|P_VI_DEF|P_RALL,
 #ifdef FEAT_STL_OPT
 			    (char_u *)&p_tal, PV_NONE,
diff -r 6581d543a54c src/option.h
--- a/src/option.h	Thu Aug 02 21:48:24 2012 +0200
+++ b/src/option.h	Sat Aug 04 01:01:30 2012 -0700
@@ -741,6 +741,7 @@
 EXTERN long	p_siso;		/* 'sidescrolloff' */
 EXTERN int	p_scs;		/* 'smartcase' */
 EXTERN int	p_sta;		/* 'smarttab' */
+EXTERN int	p_tcl;		/* 'tabcloseleft' */
 #ifdef FEAT_WINDOWS
 EXTERN int	p_sb;		/* 'splitbelow' */
 EXTERN long	p_tpm;		/* 'tabpagemax' */
diff -r 6581d543a54c src/window.c
--- a/src/window.c	Thu Aug 02 21:48:24 2012 +0200
+++ b/src/window.c	Sat Aug 04 01:01:30 2012 -0700
@@ -2679,9 +2679,10 @@
 {
     tabpage_T	*tp;
 
-    /* Use the next tab page if possible. */
-    if (curtab->tp_next != NULL)
-	return curtab->tp_next;
+    if (!p_tcl || curtab == first_tabpage)
+        /* Use the next tab page if possible. */
+        if (curtab->tp_next != NULL)
+	    return curtab->tp_next;
 
     /* Find the last but one tab page. */
     for (tp = first_tabpage; tp->tp_next != curtab; tp = tp->tp_next)

Raspunde prin e-mail lui