Monday, March 9, 2009

Tab Buffer Browsing

Using the following mappings in normal mode provides a convenient way to easily switch between the next and previous buffers.

nmap <tab> :bn<cr>
nmap <s-tab> :bp<cr>

Thanks to Chris for the tip!


Rich said...
This comment has been removed by the author.
Rich said...

Here's a buffer gem I found today:

This will set [tab] for command completion and ,, to browse the buffers in a non-intrusive way.

graywh said...

Hope you didn't plan on using the jumplist, because remapping <Tab> (aka <C-i>) takes away the ability to move forward.

I remap <C-Right> and <C-Left> to :bn<CR> and :bp<CR>, respectively.

Travis Whitton said...

Good tips guys... thanks!

Mathias Stearn said...

I like to use shift-[hl] to move back/forward in the bufferlist. It works great with minibufexpl because that is like moving left/right in the list of "tabs". Also it complements ctrl-[hjkl] for moving between windows.

from my vimrc:

nnoremap <silent><C-j> <C-w>j
nnoremap <silent><C-k> <C-w>k
nnoremap <silent><C-l> <C-w>l
nnoremap <silent><C-h> <C-w>h

nnoremap <silent><S-h> :bp<CR>
nnoremap <silent><S-l> :bn<CR>

PS- Is there any way to avoid using &lt for < in blogger comments?

timhoa said...

Really simple and very useful.

Anonymous said...

Thanks, I love this tip.