Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim keyboard shortcut to move around tabs

Tags:

vim

tabs

keyboard

I used to know this keyboard shortcut which makes you move around Vim tabs in the terminal, similar to Ctrl+tab in a browser.

I've been looking all over the Internet and I can't find it anymore. Any ideas?

P.S.: You had to press two letters simultaneously.

like image 398
Melkar Muallem Avatar asked Sep 22 '12 18:09

Melkar Muallem


People also ask

How do I move between tabs in Vim?

To switch to the next tab, use :tabn, and to switch to the previous tab, use :tabp (short for tabnext and tabprevious respectively). You can also jump over tabs by using :tabn 2, which will move to the second next tab. To jump to the first tab, use :tabr (tabrewind) and to jump to the last tab use :tabl (tablast).

What is the keyboard shortcut for moving across tabs?

Press Ctrl + Shift + Tab (or Ctrl + Page Up) on your Windows or Linux computer.

How do I switch between tabs quickly?

Switch to previous or next tab On Windows, use Ctrl-Tab to move to the next tab to the right and Ctrl-Shift-Tab to move to the next tab to the left.

What is Ctrl W in Vim?

To replace ctrl-w on Windows/Linux for Vim users! # Better Ctrl-W Vim users are used to using the `Ctrl-w` key combination for deleting the last word when in insert mode. That's no problem for Mac OS users when using chrome, as the keyboard shortcut for closing a tab is Cmd+w.


2 Answers

gt is the keyboard shortcut for :tabnext and gT for :tabprevious.

If you prefer the typical Ctrl + Tab, define the following mappings in your ~/.vimrc:

" CTRL-Tab is next tab noremap <C-Tab> :<C-U>tabnext<CR> inoremap <C-Tab> <C-\><C-N>:tabnext<CR> cnoremap <C-Tab> <C-C>:tabnext<CR> " CTRL-SHIFT-Tab is previous tab noremap <C-S-Tab> :<C-U>tabprevious<CR> inoremap <C-S-Tab> <C-\><C-N>:tabprevious<CR> cnoremap <C-S-Tab> <C-C>:tabprevious<CR> 
like image 136
Ingo Karkat Avatar answered Oct 08 '22 23:10

Ingo Karkat


This is taken from Vim Wikia:

gt            go to next tab gT            go to previous tab {i}gt         go to tab in position i 

http://vim.wikia.com/wiki/Using_tab_pages

Hope it helps.

like image 44
Mickey Avatar answered Oct 08 '22 21:10

Mickey