Vim Tips Wiki

Switching between files

1,612pages on
this wiki
Revision as of 15:05, August 16, 2013 by Kra3 (Talk | contribs)

When you edit multiple files, you often need to change between files. It quickly become tedious that you have to strain your fingers to Escape then go to command mode and enter one of related commands to switch to another file.

You can set up Vim in windows and gvim to switch between files with the commonly used Ctrl-Tab and Ctrl-Shift-Tab

This depends on how do you normally work.

  1. If you prefer to work with just buffers (ie., whole screen dedicated to one buffer): you can map :bn and :bp commands.
    nnoremap <C-Tab> :bn
    nnoremap <C-S-Tab> :bp
  1. If you rather use split windows all the time, you rather use CTRL-W family of commands to switch between windows.
    nnoremap <C-Tab> <C-w>w
    nnoremap <C-S-Tab> <C-w>W
  1. And if you are one of those who prefer one tab for one buffer guy, you can map :tabn and :tabp commands.
    nnoremap <C-Tab> :tabn
    nnoremap <C-S-Tab> :tabp


Around Wikia's network

Random Wiki