vim - 在vi中打开所有文件(包括隐藏的)

标签 vim load

我有一个像这样的文件结构

/foo/bar/
├── .foo.cfg
├── foo.cfg
├── foo.data
├── foo.py
├── .svn
│   ├── ...
│   ├── ...
│   └── ...
├── .
└── ..

我想将所有隐藏和非隐藏文件打开到 vim 中。我可以像这样手动完成
vi .foo.cfg foo.cfg foo.data foo.py

但是当有 100 多个文件时这不起作用。我也尝试了以下但没有成功
#hidden files not loaded
vi *

#Includes folders and '.' and '..'
vi * .*

#loads files one at a time
for i in `ls -a` ; do vi $i; done;

#loads files one at a time
find . -name "*" -type f -maxdepth 1 -exec vi {} ";"

最佳答案

以下应该工作:

find . -maxdepth 1 -type f -exec vi {} +

来自 find手册页:

   -exec command {} +  

This variant of the -exec option runs the specified command on the selected files, but the command line is built by appending each selected file name at the end; the total number of invocations of the command will be much less than the number of matched files. The command line is built in much the same way that xargs builds its command lines. Only one instance of ’{}’ is allowed within the command. The command is executed in the starting directory.

关于vim - 在vi中打开所有文件(包括隐藏的),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8405431/

相关文章:

vim - 使用当前文件类型的 ftplugin 文件打开缓冲区?

vim - 在 ViM 中,缓冲区 0 是什么?

c - 如何解决 printf 中的 %d 输出显示 num1、num2 和 sum 的 ascii 值,而不是它们分配的值

vim - 你如何在 VIM 中处理大型项目

powershell - 凭据连接不起作用

android - 在 UI 中使用线程以加载网页的 Android 最佳实践?

vim - Syntastic NASM 检查器

java - 如何保存和加载 HashMap<String,Object>?

javascript - jQuery - 在 load() 之后向元素添加功能

linux - 节点上的多少负载太多了?