Fandom

Vim Tips Wiki

Switching between files

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 195 Printable Monobook Previous Next

created 2002 · complexity basic · author Kontra, Gergely · version 6.0


When editing multiple files, it is often necessary to switch from one file to another. That can be done more easily using a mapping, rather than entering a command. This tip maps Ctrl-Tab and Ctrl-Shift-Tab to move forwards or backwards through the available buffers or windows.

If you prefer to work with buffers, you can map the :bn and :bp commands (buffer next, and buffer previous).

nnoremap <C-Tab> :bn<CR>
nnoremap <C-S-Tab> :bp<CR>

If you frequently use split windows, you might want to use the Ctrl-W family of commands to switch between windows.

nnoremap <C-Tab> <C-w>w
nnoremap <C-S-Tab> <C-w>W

And if you prefer one tab for one buffer, you can map the :tabn and :tabp commands (tab next, and tab previous).

nnoremap <C-Tab> :tabn<CR>
nnoremap <C-S-Tab> :tabp<CR>

ReferencesEdit

CommentsEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.