DEV Community

loading...

Vim Tabs

ayaanraj
・1 min read

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

: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.

Discussion (0)