A mapping for easy switching between buffers
From Vim Tips Wiki
[edit] Obsolete tip
This tip has been merged into another tip.
See VimTip873 for the current tip.
Please do not edit this tip, and do not edit the discussion page.
If anything needs to be improved, please fix VimTip873.
Tip 401 Previous Tip • Next Tip
Created: January 14, 2003 Complexity: basic Author: chris Minimum version: 6.0 Karma: 24/10 Imported from: Tip#401
Instead of using a buffer-explorer I looked for a simpler method for fast switching between buffers. So on a rainy day I invented a simple mapping:
map <C-Up> :bn<CR> map <C-Down> :bp<CR>
This works very well for an intermediate amount of buffers. Of course you can use other keys (instead of the up and down arrows) for the mapping.
Note: You can't switch from a dirty (edited) buffer unless you also do this:
set hidden
That way you can switch between buffers without each one having to be saved.
Here's a variation that lets you see your files while switching:
nmap <C-Up> :bnext<CR>:redraw<CR>:ls<CR> nmap <C-Down> :bprevious<CR>:redraw<CR>:ls<CR>
