-1

I've been searching for the shortcut to switch tab when i'm in insertion mode. I know by pressing gT or gt for switching tab on visual mode. Is nerdTree already have this features or do I need to map the key for this?

andhikaribrahim
  • 341
  • 6
  • 24

1 Answers1

0

First, this has nothing to do with NERDTree. Tabs are a built-in feature of Vim. It may be more useful with NERDTree (as you open multiple locations in different tabs), though.

If you go to the :help page of gt, you'll see all alternative keys:

:tabn[ext]                *:tabn* *:tabnext* *gt*
<C-PageDown>              *CTRL-<PageDown>* *<C-PageDown>*
gt                    *i_CTRL-<PageDown>* *i_<C-PageDown>*

In Vim's help, the i_ prefix represents insert mode. So, the built-in mapping to switch tabs in insert mode is Ctrl + PageUp / PageDown.

If you want to use different keys, you can use mappings like the following:

inoremap <C-Tab>   <C-\><C-N>:tabnext<CR>
inoremap <C-S-Tab> <C-\><C-N>:tabprevious<CR>
Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324