1

I am trying to use fzf.vim to quickly switch between buffers. I have fzf and fzf.vim setup in Neovim and it is working. But, I would like to change the way the buffers are listed in fzf list. Here is what I am using:

command! -bang -nargs=? -complete=dir Buffers
   \ call fzf#vim#buffers(<q-args>, {'options': ['--layout=reverse']}, <bang>0)

Here is how the buffers are listed and how they are shown on tabbar:

enter image description here

The numbers are not sorted and the buffers are not listed as they are shown on the tabbar. Is it possible to change fzf.vim config to list buffers as they are shown on the tabbar, sort the numbers from top to bottom, and highlight the active buffer.

Thank you

NESHOM
  • 899
  • 16
  • 46

1 Answers1

0

I was having a similar issue, when I had the folder structure like:

/config/config.json
/config/test.json
/config/test1.json

and did "Buffers" and typed config it would list all the files when i just wanted the file called config.json

What worked for me was to use the fzf option "tiebreak=end" which means that when my search throws similar results, prefer line with matched substring closer to the end.

command! -bang -nargs=? Buffers
            \ call fzf#vim#buffers(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline','--tiebreak=end']}), <bang>0)

With this option fzf would still show all the results but it will prioritize "config.json" above the other files in the "config" folder which is a much more expected behavior for me and allows me to select a buffer more quickly when there are collisions like this.