Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim how to highlight current buffer in :ls

Tags:

vim

I recently discovered the use of buffers in vim and I was wondering if it is possible to highlight the line of the current buffer in the window which show :ls result?

I know that the current buffer is marked with % but highlighting the line would be easier to see.

Any vim-master can give me hand with this?

like image 944
statox Avatar asked Apr 14 '15 14:04

statox


1 Answers

There's no built-in option, so you'd either have to directly modify Vim's sources, or write a custom command in Vimscript. I would not recommend any of those.

For the latter, you can use :redir to capture the output of built-in :ls, split() into lines, then :echo each in a loop, matching with the leading % to detect the current one, and in that case use :echohl to change the highlighting group. The cmdalias.vim - Create aliases for Vim commands could allow you to install that new :LS command over the built-in :ls, but again, I think this is too cumbersome for too little effect.

like image 163
Ingo Karkat Avatar answered Oct 16 '22 02:10

Ingo Karkat