I would like to find multiple files and open them all in tabs within the same vim instance.

vim -p `find . -name '*.txt'` 

Putting the find command between backticks executes find before running the full command and the results replace what's between the backticks. So before running the full command it will have this form vim -p result1 result2 ... resultN .

find "$PWD" -name '*.txt' -exec vim -p {} +
  • 2
    vim -p `find . -name '*.txt'` – Neaţu Ovidiu Gabriel Oct 8 '15 at 14:41
  • I like that more. If you post it as an answer I'll accept it. – andorov Oct 8 '15 at 14:59
  • Ok, will do that. – Neaţu Ovidiu Gabriel Oct 8 '15 at 15:10
  • This is the better way. The other way is easily broken if filenames have spaces, or special characters in them. – muru Apr 24 '16 at 18:00

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.