Hi, list.

I wrote the path for adding :tabrecently as Ex command.
This Ex command provide moving from current tab page to previous
*recently* tab page.

Vim has Ex command :tabprevious which go to previous tab page,
however, It will be moving from current tabpage to previous tab *on
screen*.
It's not always going to be move recent tab page.
For example, move from tab1 to tab3, execute :tabprevious then move to
tab2, on the other hand, :tabrecently can be go to tab1.
Also, move from tab1 to tab2, change tab2 and tab3,
execute :tabprevious then move to tab3(tab index 2), while
that :tabrecently correctly moving to tab1.

I think, this Ex command is useful(way as to plugin).
Following patches,

diff -r 54d621a3b561 -r dbe98bd6bca2 runtime/doc/index.txt
--- a/runtime/doc/index.txt     Thu Jan 26 20:58:26 2012 +0100
+++ b/runtime/doc/index.txt     Sun Jan 29 23:28:28 2012 +0900
@@ -1517,6 +1517,7 @@
 |:tabnext|     :tabn[ext]      go to next tab page
 |:tabonly|     :tabo[nly]      close all tab pages except the current one
 |:tabprevious| :tabp[revious]  go to previous tab page
+|:tabrecently| :tabrecently    go to previous recently tab page
 |:tabrewind|   :tabr[ewind]    got to first tab page
 |:tabs|                :tabs           list the tab pages and what they contain
 |:tab|         :tab            create new tab when opening new window
diff -r 54d621a3b561 -r dbe98bd6bca2 runtime/doc/tabpage.txt
--- a/runtime/doc/tabpage.txt   Thu Jan 26 20:58:26 2012 +0100
+++ b/runtime/doc/tabpage.txt   Sun Jan 29 23:28:28 2012 +0900
@@ -156,6 +156,9 @@
 {count}gT      Go {count} tab pages back.  Wraps around from the first one
                to the last one.

+:tabrecently                           *:tabrecently*
+               Go to the previous recently tab page.
+
 :tabr[ewind]                   *:tabfir* *:tabfirst* *:tabr* *:tabrewind*
 :tabfir[st]    Go to the first tab page.

diff -r 54d621a3b561 -r dbe98bd6bca2 runtime/doc/tags
--- a/runtime/doc/tags  Thu Jan 26 20:58:26 2012 +0100
+++ b/runtime/doc/tags  Sun Jan 29 23:28:28 2012 +0900
@@ -2886,6 +2886,7 @@
 :tabp  tabpage.txt     /*:tabp*
 :tabprevious   tabpage.txt     /*:tabprevious*
 :tabr  tabpage.txt     /*:tabr*
+:tabrecently   tabpage.txt     /*:tabrecently*
 :tabrewind     tabpage.txt     /*:tabrewind*
 :tabs  tabpage.txt     /*:tabs*
 :tag   tagsrch.txt     /*:tag*
diff -r 54d621a3b561 -r dbe98bd6bca2 src/ex_cmds.h
--- a/src/ex_cmds.h     Thu Jan 26 20:58:26 2012 +0100
+++ b/src/ex_cmds.h     Sun Jan 29 23:28:28 2012 +0900
@@ -955,6 +955,8 @@
                        BANG|TRLBAR|CMDWIN),
 EX(CMD_tabprevious,    "tabprevious",  ex_tabnext,
                        RANGE|NOTADR|COUNT|TRLBAR),
+EX(CMD_tabrecently,    "tabrecently", ex_tabnext,
+                       RANGE|NOTADR|TRLBAR),
 EX(CMD_tabNext,                "tabNext",      ex_tabnext,
                        RANGE|NOTADR|COUNT|TRLBAR),
 EX(CMD_tabrewind,      "tabrewind",    ex_tabnext,
diff -r 54d621a3b561 -r dbe98bd6bca2 src/ex_docmd.c
--- a/src/ex_docmd.c    Thu Jan 26 20:58:26 2012 +0100
+++ b/src/ex_docmd.c    Sun Jan 29 23:28:28 2012 +0900
@@ -7446,6 +7446,10 @@
        case CMD_tabNext:
            goto_tabpage(eap->addr_count == 0 ? -1 : -(int)eap->line2);
            break;
+       case CMD_tabrecently:
+           /* search tabpage index from following first tabpage */
+           goto_tabpage(tabpage_index(recentlytab));
+           break;
        default: /* CMD_tabnext */
            goto_tabpage(eap->addr_count == 0 ? 0 : (int)eap->line2);
            break;
diff -r 54d621a3b561 -r dbe98bd6bca2 src/globals.h
--- a/src/globals.h     Thu Jan 26 20:58:26 2012 +0100
+++ b/src/globals.h     Sun Jan 29 23:28:28 2012 +0900
@@ -567,6 +567,7 @@
  */
 EXTERN tabpage_T    *first_tabpage;
 EXTERN tabpage_T    *curtab;
+EXTERN tabpage_T    *recentlytab;
 EXTERN int         redraw_tabline INIT(= FALSE);  /* need to redraw
tabline */
 #endif

diff -r 54d621a3b561 -r dbe98bd6bca2 src/window.c
--- a/src/window.c      Thu Jan 26 20:58:26 2012 +0100
+++ b/src/window.c      Sun Jan 29 23:28:28 2012 +0900
@@ -3444,6 +3444,7 @@
     int                after;
 {
     tabpage_T  *tp = curtab;
+    tabpage_T  *recently = recentlytab;
     tabpage_T  *newtp;
     int                n;

@@ -3457,6 +3458,7 @@
        vim_free(newtp);
        return FAIL;
     }
+    recentlytab = tp;
     curtab = newtp;

     /* Create a new empty window. */
@@ -3785,7 +3787,7 @@
            return;
        }
     }
-
+    recentlytab = curtab;
     goto_tabpage_tp(tp);

 #ifdef FEAT_GUI_TABLINE

Best regards.

-- 
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

Raspunde prin e-mail lui