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

[patch] Add tabpage index in tabline

Expand Messages
  • Nicholas
    I am used to work with tab pages in vim in console mode. One of the most commonly used actions is to jump from one tab page to another. There are several ways:
    Message 1 of 4 , Sep 5, 2010
      I am used to work with tab pages in vim in console mode. One of the
      most commonly used actions is to jump from one tab page to another.
      There are several ways:
      1) using ":tabnext" or ":tabprevious" command repeatedly until target
      tab page is arrived.
      2) count the target tab page's index, then use ":tabnext n" to get to
      it.
      The second is faster. However the counting process is bothersome. So I
      changed the tabline, adding tab page index in front of each tab page's
      buffer name(highlighted as warning). It works for console mode.

      Here is the diff file for src/screen.c for latest vim 7.3 release.

      9663a9664,9665
      > int tabidx;
      > char tabidxs[10];
      9711a9714
      > tabidx = 0;
      9724a9728,9739
      > ++tabidx;
      > sprintf(tabidxs, "%d", tabidx);
      > len = (int)STRLEN(tabidxs);
      > screen_puts_len(tabidxs, len, 0, col,
      > #if defined(FEAT_SYN_HL)
      > hl_combine_attr(attr, hl_attr(HLF_W))
      > #else
      > attr
      > #endif
      > );
      > col += len;
      >

      --
      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
    • John Beckett
      ... Type 12gt to go to tab number 12. ... I rarely use tabs in console Vim, but I think you can customise tab labels even when non-GUI, to show the tab number.
      Message 2 of 4 , Sep 6, 2010
        Nicholas wrote:
        > I am used to work with tab pages in vim in console mode. One
        > of the most commonly used actions is to jump from one tab
        > page to another.
        > There are several ways:
        > 1) using ":tabnext" or ":tabprevious" command repeatedly
        > until target tab page is arrived.
        > 2) count the target tab page's index, then use ":tabnext n"
        > to get to it.

        Type 12gt to go to tab number 12.

        > Here is the diff file for src/screen.c for latest vim 7.3
        > release.
        > ...

        I rarely use tabs in console Vim, but I think you can customise
        tab labels even when non-GUI, to show the tab number.

        Have a look at the following (mainly the comments):
        http://vim.wikia.com/wiki/Show_tab_number_in_your_tab_line

        John

        --
        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
      • Nicholas
        Thank you for your advice. I tried the scripts in comments and found it not work as expected. Using the scripts in comments, when tab pages go too many, the
        Message 3 of 4 , Sep 6, 2010
          Thank you for your advice. I tried the scripts in comments and found
          it not work as expected.
          Using the scripts in comments, when tab pages go too many, the first
          tab pages would not be in sight. When navigating from one tab page to
          another, the tabline is fixed. Besides, the coloring of tabline is
          very confusing(this can be changed, of course). It seems more work has
          to be done to make that scripts work properly.

          On Sep 6, 3:53 pm, "John Beckett" <johnb.beck...@...> wrote:
          > Nicholas wrote:
          > > I am used to work with tab pages in vim in console mode. One
          > > of the most commonly used actions is to jump from one tab
          > > page to another.
          > > There are several ways:
          > > 1) using ":tabnext" or ":tabprevious" command repeatedly
          > > until target tab page is arrived.
          > > 2) count the target tab page's index, then use ":tabnext n"
          > > to get to it.
          >
          > Type 12gt to go to tab number 12.
          >
          > > Here is the diff file for src/screen.c for latest vim 7.3
          > > release.
          > > ...
          >
          > I rarely use tabs in console Vim, but I think you can customise
          > tab labels even when non-GUI, to show the tab number.
          >
          > Have a look at the following (mainly the comments):http://vim.wikia.com/wiki/Show_tab_number_in_your_tab_line
          >
          > John

          --
          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
        • Ben Fritz
          ... Please feel free! The guitabline version does work, I use it myself, but am considering switching to a textual tabline for some additional
          Message 4 of 4 , Sep 7, 2010
            On Sep 6, 8:39 am, Nicholas <cwh...@...> wrote:
            > Thank you for your advice. I tried the scripts in comments and found
            > it not work as expected.
            > Using the scripts in comments, when tab pages go too many, the first
            > tab pages would not be in sight. When navigating from one tab page to
            > another, the tabline is fixed. Besides, the coloring of tabline is
            > very confusing(this can be changed, of course). It seems more work has
            > to be done to make that scripts work properly.
            >

            Please feel free! The guitabline version does work, I use it myself,
            but am considering switching to a textual tabline for some additional
            features...sometime.

            Regardless, I think the main point of John's message is: there is no
            need to patch the source code, there's already an option that lets you
            do exactly what you want without recompiling Vim.

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