I want to show all buffers' names on statusline(I use powerline). And I hope current buffer can be highlighted, while others are not. When I use :bn or :bp it highlights the changed buffer. How can I make it?
Asked
Active
Viewed 3,023 times
3
-
There are plugins out there that do this but I don't know how they would be integrated into powerline as I don't know anything about it. Take a look at buftabs and/or bufstat if you want to take a shot at integrating them. Disclosure: I wrote bufstat a lifetime ago and I'm not sure I could even tell you how it works now. – Randy Morris Dec 02 '15 at 15:11
-
Add `set tabline=2` in your vimrc. It's not the status line, but it will show all your buffers in the tabline. – John Drouhard Dec 02 '15 at 15:43
-
I currently have 557 buffers in `:ls!` and 33 in `:ls`. There's simply no way to list that many buffers in a useful fashion in a pseudo tab-line or in the statusline. – romainl Dec 02 '15 at 20:03
2 Answers
6
I don't know how to do such a thing with powerline, however I have come across vim-buftabline which does what you ask but with the tabline instead of the statusline.
Personally, I would forget doing this in the statusline or tabline, because it is very easy to run out of space on either line. I would also stop using :bn
/:bp
and just use :b
instead to jump directly to the buffer in question.
Behold the power of :b
:
- Uses
<tab>
completion - Use
<c-d>
to list out completion - Use partial file name. e.g.
:b foo
. Works great with<tab>
. - Globbing. e.g.
:b foo*bar
or:b foo/**/bar
- Might want to use
'hidden'
viaset hidden
- Split variant of
:b
is:sb
. - Also accepts a buffer number
A common mapping:
nnoremap <leader>b :ls<cr>:b<space>
For more help see:
:h :b
:h :ls
:h 'switchbuf'
:h 'hidden'
:h 'tabline'

Peter Rincker
- 43,539
- 9
- 74
- 101
2
In powerline, the list of open buffers can be displayed by adding the following line to your .vimrc
configuration file:
set showtabline=2
This will add an additional status line at the top of your vim session and also highlight the active buffer.
Source: Powerline documentation

Kevin Bowen
- 1,625
- 2
- 23
- 27