kukka
kukka

Reputation: 121

Show tab number in Macvim

I use Macvim as my development tool. Usually I switch between tabs. But Macvim do not show tab number. I config in my .vimrc for I can switch easily switch with cmd+1, cmd+2 or cmd+N. But sometimes I need to count the tab number. Is there a method can make Macvim show tab number like iTerm?

Upvotes: 2

Views: 1025

Answers (3)

ospider
ospider

Reputation: 10391

There is a wonderful plugin that works for all vims(gui and terminal). Just add

Plug 'mkitt/tabline.vim'  # if you're using vim-plug

to your .vimrc

Upvotes: 1

romainl
romainl

Reputation: 196781

You can find a partial answer in the documentation under :help setting-guitablabel:

:set guitablabel=%N\ %f

Where %N\ is the tab number followed by a space.

If you want to keep the default setting and just prepend the tab number, you can use this:

:set guitablabel^=%N\ <--- note the space

To append the tab number:

:set guitablabel+=\ %N

As a side note, Vim's "tabline" looks and works like you would expect from your experience in other editors but "tab pages" are very different from your usual "tabs". It is generally recommended to get used to a buffer-centric workflow instead of relying on tab pages as file proxies (something they can't be by design).

Upvotes: 1

Ingo Karkat
Ingo Karkat

Reputation: 172688

Like GVIM, MacVim supports configuring the tab label via the 'guitablabel' option. :help setting-guitablabel has an example to show tab page number and buffer name:

:set guitablabel=%N\ %f

There's also an example function to emulate the default behavior, you only need to work in the tab page number (which you can get via tabpagenr()), or customize to whatever you'd like.

Also see Controlling Tab Names in Vim.

Upvotes: 1

Related Questions