Vim Tips Wiki

Changes: Switching between files


Back to page

(Restore template and reword.)
(Link to "Easier buffer switching" page)
Line 32: Line 32:
*[[Easier_buffer_switching]] - I highly recommend the <code><F5></code> mapping followed by completion with <code><Ctrl-N></code> or <code><Tab></code>.

Latest revision as of 21:04, August 29, 2013

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>



Around Wikia's network

Random Wiki