Last Updated: September 09, 2019
·
3.153K
· spf13

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

6 Responses
Add your response

There's also handy -o flag which opens files in splits. I use it like this:

vim -o $(git ls-files -m) 

usually

over 1 year ago ·

How to switch between splits or tabs?

over 1 year ago ·

@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

over 1 year ago ·

@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

over 1 year ago ·

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.

over 1 year ago ·

@milani splits are windows, so you can move betwen them using CTRL+w

Also, if you prefer vertical splits, use vim -O filename

over 1 year ago ·