Loading ...
Sorry, an error occurred while loading the content.

Patch for :tabrecently which go to previous recently tab page

Expand Messages
  • Hirokazu YOSHIDA
    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
    Message 1 of 6 , Jan 30, 2012
    • 0 Attachment
      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
    • mattn
      How this work when type :tabrecent next time? If you have spec cleanly, please add behavor in doc. -- You received this message from the vim_dev maillist. Do
      Message 2 of 6 , Jan 30, 2012
      • 0 Attachment
        How this work when type :tabrecent next time?
        If you have spec cleanly, please add behavor in doc.

        --
        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
      • thinca
        I wrote a plugin of the similar purpose before. https://githib.com/thinca/vim-tabrecent This provides :TabRecent command. This can return also to a two or more
        Message 3 of 6 , Jan 30, 2012
        • 0 Attachment

          I wrote a plugin of the similar purpose before.

          https://githib.com/thinca/vim-tabrecent

          This provides :TabRecent command.
          This can return also to a two or more previous tab.

          --
          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
        • thinca
          Sorry, wrong the URL. https://github.com/thinca/vim-tabrecent ... -- You received this message from the vim_dev maillist. Do not top-post! Type your reply
          Message 4 of 6 , Jan 30, 2012
          • 0 Attachment

            Sorry, wrong the URL.

            https://github.com/thinca/vim-tabrecent

            2012/01/31 12:27 "thinca" <thinca@...>:

            I wrote a plugin of the similar purpose before.

            https://githib.com/thinca/vim-tabrecent

            This provides :TabRecent command.
            This can return also to a two or more previous tab.

            --
            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
          • Hirokazu Yoshida
            Thanks for comments. ... For example, move from tab1 to tab2 execute :tabrecently, go to tab1, continue execute then go to tab2. And fixed document, attached
            Message 5 of 6 , Feb 2, 2012
            • 0 Attachment
              Thanks for comments.
              :tabrecently inspired by *<C-w>p*. This is go to previous last accessed window.
              :tabrecently is tab page version. Therefore go to previous last accessed tab.

              For example, move from tab1 to tab2 execute :tabrecently, go to tab1,
              continue execute then go to tab2.
              And fixed document, attached patch.

              I think, it's pretty unreasonable to way as Vim plugin.
              This is because, We don't access last accessed tab page in default,
              regardless of enable that on window by <C-w>p.
              So :tabrecently should be impremented as core function same way as <C-w>p.

              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
            • Bram Moolenaar
              ... Thanks. I ll put it somewhere in the todo list. If others have comments please let us know. -- If they don t keep on exercising their lips, he thought,
              Message 6 of 6 , Feb 2, 2012
              • 0 Attachment
                Hirokazu Yoshida wrote:

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

                Thanks. I'll put it somewhere in the todo list. If others have
                comments please let us know.

                --
                If they don't keep on exercising their lips, he thought, their brains
                start working.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                \\\ an exciting new programming language -- http://www.Zimbu.org ///
                \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                --
                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
              Your message has been successfully submitted and would be delivered to recipients shortly.