Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I open several files using vim+tabf, switching across the files will involve using tabp & tabn.

Can I have a quicker way to do so?

share|improve this question
up vote 5 down vote accepted

In vim you can replace any command with a shortcut key sequence. For tabp and tabp you might want to use ctrl-k and ctrl-j. To create that mapping you would add the following to your .vimrc:

nmap <C-k> :tabn<cr>
nmap <C-j> :tabp<cr>
share|improve this answer
Thank you very much! – xiaohan2012 Oct 7 '12 at 6:18

By default, vim maps gt to :tabn and gT to :tabp - this can be useful if you're logged into a server without your vimrc on it, or if you are logged in as root on a machine other people have to use.

But when I do have my vimrc, I use <C-h> and <C-l> for switching tabs.

share|improve this answer
Thanks you for sharing – xiaohan2012 Oct 7 '12 at 12:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.