Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open files with pattern recursively in vim

Tags:

linux

vim

Guys how do i open multiple files in vim with a single command?

These files i want to open has some kind of pattern, example:

myfile1dsa
myfile2dsdas
myfile3xzczxcz

and also do these opened files create their own tab in my vim window?

and out of topic question:

what does "--" means in a linux command? how does it differ from just "-"?

example:

grep --color 'data' fileName
like image 914
ruggedbuteducated Avatar asked May 16 '13 06:05

ruggedbuteducated


Video Answer


1 Answers

You can open them from within vim using

:args myfile*

or if you want to open all files matching the pattern in subfolders

:args **/myfile*

This all assumes your current directory is the folder from wich you want to open files from. Prepend a directory to myfile if it's not.

:args /yourfolder/myfile*
:args /yourfolder/**/myfile*

Edit (cudo's to romainl)

To open all the files found in tabs, you can use

:argdo tabe

wich essentially goes like this:

  • argdo: for each file in the argument list
  • tabe : open a new tabpage and edit the file
like image 55
Lieven Keersmaekers Avatar answered Sep 23 '22 11:09

Lieven Keersmaekers