Switching between tabs in NERDTree

I use iTerm on the mac, and I like being able to switch to the next/previous tabs using Shift-[left arrow key] and Shift-[right arrow key]

From my .vimrc, here's how to do the same thing in MacVim;

  map <S-Right> :tabn<CR>
  map <S-Left>  :tabp<CR>

FYI, by default, the key combos Cmd-Shift-[ and Cmd-Shift-] will switch between tabs in MacVim (and in Google Chrome, Safari and probably a bunch of other stuff)


A quick check in :h tabs reveals it's CTRL-Page Down to cycle between tabs. You can also use the :tabnext command (:tabn for short).


I like to bind my vim navigation keys to switching between tabs. Here are the lines from my .vimrc file:

map  <C-l> :tabn<CR>
map  <C-h> :tabp<CR>
map  <C-n> :tabnew<CR>

That way, I can switch between tabs using the left and right buttons just like I normally would move the cursor, except I just hold the Control key as well.

  • Control+l moves to the next tab
  • Control+h moves to the previous tab
  • Control+n creates a new tab

An additional option (and my personal choice)beyond the ones listed by Michael Madsen:

gt = next tab

gT = previous tab

Tags:

Vim

Nerdtree