Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open several files in new tabs with VIM

Tags:

vim

How can I open several files using wildcards in a new tab for each file with VIM?

Similar to How can I open several files at once in Vim? but in new tabs instead of buffers.

like image 206
André Roaldseth Avatar asked Jul 11 '12 10:07

André Roaldseth


People also ask

How do I open multiple files in Vim?

From Within Vim If you have already opened a file in vim editor, you can add more files to the vim session by entering :e followed by filename or path of the file to be opened. In this case also, vim will take you to the same interface that you get while opening multiple files from command line.

How do I open a new tab in Vim?

Opening a tab Probably the easiest to remember is to run the :tabnew command while in normal mode. This will open a new tab with an empty buffer. If you want to edit a file in the new tab, you can run :tabnew filename and Vim will load the file in the new tab.


Video Answer


1 Answers

Use the -p flag:

vim -p *.c 

The above will open all files matching *.c.

You can also create an alias for this (I have alias vip='vim -p' and I only type vip *.c for the above example)

like image 116
Mihai Maruseac Avatar answered Sep 24 '22 18:09

Mihai Maruseac