gvim: switching tabs with keyboard

Vim

Vim Problem Overview


I can't seem to find a predefined keyboard shortcut for switching between open tabs in Gvim. What is it, and if there is none, how can I define one?

Vim Solutions


Solution 1 - Vim

Use gt and gT commands.

:tabn and :tabp also work.

Read :help gt and read that section completely. There are many useful commands explained there.

Solution 2 - Vim

Press gt to switch tabs. Also - 1gt 2gt to open 1st, 2nd... tab.

Solution 3 - Vim

I have these mappings in my vimrc:

map <C-Left> <Esc>:tabprev<CR>
map <C-Right> <Esc>:tabnext<CR>
map <C-n> <Esc>:tabnew

I'm by no means a pro vim'er, but it works for me so I thought I'd share :) Control+Right for next tab, Control+Left for previous, Control+n to open a new tab (left out the so you can specify the path to open in the new tab).

Solution 4 - Vim

C-<PageUp>
C-<PageDown>

These are predefined, altaught not very practical, as on most keyboards Page keys are placed in the corners, far from 'natural' hands position.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBenGCView Question on Stackoverflow
Solution 1 - VimSusam PalView Answer on Stackoverflow
Solution 2 - VimArnis LapsaView Answer on Stackoverflow
Solution 3 - Vimdanns87View Answer on Stackoverflow
Solution 4 - Vimmc.watrasView Answer on Stackoverflow