History Report a problem
Article Edit this page Discussion

A mapping for easy switching between buffers

From Vim Tips Wiki

Jump to: navigation, search

[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 TipNext 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>


[edit] Comments


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Pushing Daisies
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Godzilla
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"A mapping for easy switching between buffers"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation


.