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
There's also handy -o flag which opens files in splits. I use it like this:
vim -o $(git ls-files -m)
usually
How to switch between splits or tabs?
@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
@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
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.
@milani splits are windows, so you can move betwen them using CTRL+w
Also, if you prefer vertical splits, use vim -O filename