%w(hashrockets spaceships bangbangs)

> non-optimized bits & pieces <

Yet Another Way to Access Vim Buffers

How do you quickly access a particular buffer (amongst a long list of buffers) in vim? For ages, i’ve been using :ls, followed by :b<id>, where <id> is the id of a particular buffer.

Recently, i’ve discovered yet another way to acheive it using BufExplorer, to install it, download the latest version & save it to ~/.vim/bundle, then:

1
2
$ cd ~/.vim/bundle
$ unzip bufexplorer.zip

Restart your vim, open several files, & try \be (backslash + b + e), you are then presented with BufExplorer, & within it, u can goto a specific buffer with:

  • search with /, followed by enter, or
  • goto that line with :<lineno>, followed by enter, or
  • simply :b<id>

If you want to be able to goto BufExplorer by doing CTRL-b, just add the following line to ur ~/.vimrc:

1
nnoremap <C-B> :BufExplorer<cr>

Alternatively, you may wanna remap how the command :ls works by doing the following instead:

1
cabbrev ls :BufExplorer

If you prefer loading BufExplorer in horizontal or vertical split, you may wanna try:

  • \bs (backslash + b + s) for horizontal split
  • \bv (backslash + b + s) for vertical split

Pick the one u like & have fun !!

tips, vim

Comments