Let's assume I have a folder with source code files. I want to open certain files with vim.

Can I do it, so vim already put's them into different tabs? (Just as like opening a folder in VS Code or any other text editor).


vim -p /path/to/src/project/*.cpp

If you expect to have a large number of files open at once in this manner, add a line akin to this to your .vimrc:

set tabpagemax=20

I believe the default is closer to ten.


From man vim

-p[N] Open N tab pages. When N is omitted, open one tab page for each file

So I would recommend vim -p /directory/*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.