Introduction to tabs in Vim
Tabs are a very common feature on many IDEs, however when I have seen people use Vim it seems rare for them to use tabs.
Of course Vim has a great tab feature built in (no need to install any Vim plugin), and once you start getting used to its commands you will find that you quickly get the hang of it.
How to create new tabs/open files in new tabs in Vim
|Open a file in a new tab|
|Close current tab.|
|Close all OTHER tabs (leave ONLY currently selected tab)|
|If current file is part of a split view, then open currently selected split as a new tab|
How to switch between tabs/move to a different tab
Moving between tabs is easy!
To move to the next tab:
To move to the previous tab:
If you wanted to move to a certain tab (based on its position - the one on the far left is #1), you do the following command:
#gt - replace # with the number. For example to go to the 3rd tab type
How to rearrange tabs in Vim
(where # is a number)
|Move current tab to position #|
|Move current tab to the end|
.vimrc for better tab experience in Vim
Here are some useful lines to add to your .vimrc. Some of this is based on the excelent amix/vimrc config, I recommend you check it out on Github.
#Better tab experience - from https://webdevetc.com/ map <leader>tn :tabnew<cr> map <leader>t<leader> :tabnext map <leader>tm :tabmove map <leader>tc :tabclose<cr> map <leader>to :tabonly<cr>