Open many files in vim tabs
A pretty simple but useful hint.
vim -p file1 file2 file3
Also works well with wildcards
vim -p *.txt
Written by Steve Francia
Related protips
6 Responses
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/688/f6681e53f53098ce1c09ae30811ac535.jpeg)
There's also handy -o flag which opens files in splits. I use it like this:
vim -o $(git ls-files -m)
usually
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/7853/morteza-milani.jpg)
How to switch between splits or tabs?
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/4045/da4bf88b125b991a3aeda63630899907.jpeg)
@milani: I use gt ja gT to move between tabs, you can also specify in which tab you want to move with 4gt
gt => :tabnext and gT => :tabprevious
Split works by default with ctrl-w and then direction key from hjkl. For example move to splitted window right of current window is ctrl-w l
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/6797/7bda40f7cf9bf734bb62fc7b5c752ce3.jpeg)
@samitheberber @milani In my distribuion spf13-vim I've mapped these movements to Shift+hl respectively.
I've also mapped split (window) movements to Ctrl+hjkl for faster access.
This makes a lot of sense to me and keep well within the core vim. Now switching between tabs & windows follows the same pattern as moving the cursor and requires only a single modifier.
To learn more checkout http://vim.spf13.com
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/56373/9bd849bb89153a263582972e489149d8.png)
I came upon this the other day. If you already have vim open, :args src/**/*.html | argdo tabe % | syntax on
It's mildly annoying that it turns syntax off, but it's certainly easier than the alternative.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/90885/ae5cc04e56668866da06810a508ee8dd.png)
@milani splits are windows, so you can move betwen them using CTRL+w
Also, if you prefer vertical splits, use vim -O filename