Just like any edit, we open can open multiples files as tab in vim as well. Let's see how it is done.
As usual open a file in vim as vim index.html
after the file is opened, from command mode enter :tabedit nameOfTheFile
, you want open in an other tab. This way we can open as many files we want.
Example:
:tabedit style.css
:tabedit script.js
Or their as another alternative way to open multiple files in tab
vim -p firstFileName secondFileName thirdFileName...
Example:
vim -p index.html style.css script.js
After opening multiple files in tabs, to navigate among them we use gt
command.
gt will take us to the next tab
gT will take us to the previous tab
Or we can also got a specific tab, by providing the tab number
Example:
2gt will take us to the second tab.
:quitall
in command mode, closes all the tabs & vim as well.
That's it for today, It's just introduction to the tabs in vim. If have missed anything or you wanted to add anything, please feel free comment them below. Thanks for reading.
Top comments (1)
thanks🙂🙂