简体   繁体   English

如何在vim中递归打开带有模式的文件

[英]How to open files with pattern recursively in vim

Guys how do i open multiple files in vim with a single command? 伙计们如何使用单个命令在vim中打开多个文件?

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? 还有这些打开的文件在我的vim窗口中创建自己的选项卡吗?

and out of topic question: 并且超出主题问题:

what does "--" means in a linux command? 什么“ - ”在linux命令中意味着什么? how does it differ from just "-"? 它与“ - ”的区别如何?

example: 例:

grep --color 'data' fileName

You can open them from within vim using 你可以在vim打开它们

: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. 如果不是,则将目录添加到myfile。

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

Edit (cudo's to romainl) 编辑(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 argdo :对于参数列表中的每个文件
  • tabe : open a new tabpage and edit the file tabe :打开一个新的标签页并编辑该文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM