dagda1
dagda1

Reputation: 28790

Buffer Explorer for vim

What do people recommend for easier manipulation of buffers in vim?

Using ls and b1, bn and bp commands is good but maybe there is a better way.

Is lusty explorer the best option?

I am using vim 7.3.

Upvotes: 20

Views: 18981

Answers (7)

arcseldon
arcseldon

Reputation: 37105

Update June 2019

BufExplorer is my unequivocal first-choice for buffer management.

" Buffer explorer
" ,be to open, q to close, d to delete buffer
Plug 'jlanzarotta/bufexplorer'

Highly rate the above plugin. It's simple and effective. Further details in the readme.

If you're looking for some "extras" in addition to the above (optional), I do also use:

" Close buffers but keep splits
Plug 'moll/vim-bbye'

and:

Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
" this setting for quick search across buffers
nmap <silent> <leader>b :Buffers<cr>

Upvotes: 1

romainl
romainl

Reputation: 196546

You should test all of them and see which one is the best according to your tastes and requirements.

I've used LustyExplorer for a while and loved it until I tried CtrlP which I find faster and more intuitive. I have :CtrlPBuffer mapped to ,b and see no reason to complain: it's both elegant, fast and intuitive.

You don't have to rely on plugins, though: :b <tab> allows you to tab through a list of all available buffers. You can do :b pattern<Tab> to get a smaller list.

Upvotes: 27

Xuan
Xuan

Reputation: 5629

Unite.vim is a new plugin and is what I switched to from CtrlP.

This is a good starting point if you want to explore what it can do.

Upvotes: 8

ZyX
ZyX

Reputation: 53614

If you are fine with having vim compiled with ruby support and have dev toolchain installed on the system (make, gcc, maybe something else — Gentoo users like me already have all of this) then Command-T is a good choice. To use it for switching buffers you should map something to :CommandTBuffer, I have

nnoremap         ,b   :CommandTBuffer<CR>

Upvotes: 3

Herbert Sitz
Herbert Sitz

Reputation: 22226

FuzzyFinder is another excellent add-on for buffer/file navigation:

http://www.vim.org/scripts/script.php?script_id=1984

Whichever plugin you choose for this, it's worth investing some time to find out all the ways it can help you.

Upvotes: 4

Dmitry Frank
Dmitry Frank

Reputation: 10757

I used many plugins before, including minibufexpl and Bufexplorer, but there was something in all of them that used to annoy me.

Now I use young plugin Buffet, and I would recommend it because it seems to be really the best one for me: it is really fast and easy to use.

Personally i would like to switch my buffers by Ctrl+Tab and Shift+Ctrl+Tab, and buffers should be ordered in most-recently-used order.

Here is my buffet's config to achieve <C-Tab> and <S-C-Tab> switching:

noremap <silent> <C-Tab> :Bufferlistsw<CR>
noremap <silent> <C-S-Tab> :Bufferlistsw<CR>kk
if !has('gui')
   map <S-q> :Bufferlistsw<CR>
endif

augroup BuffetAdd
   if !exists("g:BuffetAdded")
      let g:BuffetAdded = 1
      au BufWinEnter buflisttempbuffer* map <buffer> <Tab> <CR>
      au BufWinEnter buflisttempbuffer* map <buffer> <C-Tab>   j
      au BufWinEnter buflisttempbuffer* map <buffer> <C-S-Tab> k

      " in console Vim we can't use <C-Tab> mappings (almost always),
      " so this is temporary solution: <S-q>
      if !has('gui')
         au BufWinEnter buflisttempbuffer* map <buffer> <S-q> j
         au BufWinEnter buflisttempbuffer* map <buffer> q <CR>
      endif

      " workaround Surround plugin issue in Buffet's window:
      " disable "ds" mapping in the Buffet window (to make "d" work fast)
      au BufEnter buflisttempbuffer* nunmap ds
      au BufLeave buflisttempbuffer* nmap   ds <Plug>Dsurround

   endif
augroup END

Just one issue: Vim does not allow you to map release of some key, so, you need to press Tab again to really switch to buffer.

Anyway, if you don't need <C-Tab> switching, Buffet plugin works nice without it.

Upvotes: 2

Lars Kotthoff
Lars Kotthoff

Reputation: 109232

I use minibufexpl.vim. I guess its main advantage is that it takes up very little space.

Upvotes: 5

Related Questions