![使用 bufdo 命令搜索](https://linux22.com/image/1004858/%E4%BD%BF%E7%94%A8%20bufdo%20%E5%91%BD%E4%BB%A4%E6%90%9C%E7%B4%A2.png)
not initiated
我使用命令在 vim 的所有缓冲区中搜索短语:
:bufdo /not initiated
有以下输出:
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
E486: Pattern not found: not initiated
"aaa.cpp" [dos format] 1399 lines, 39255 characters
E486: Pattern not found: not initiated
"bbb.cpp" [converted][dos format] 5829 lines, 235847 characters
E486: Pattern not found: not initiated
"ccc.cpp" [dos format] 741 lines, 28473 characters
E486: Pattern not found: not initiated
如何理解此输出?为什么有这么多行E486: Pattern not found: not initiated
。我的搜索找到了什么吗?
答案1
一行中的所有内容E486: Pattern not found: not initiated
都来自未命名的缓冲区。我不知道为什么会有这么多,但你确实有。每次 Vim 切换到带有文件名的缓冲区时,都会打印文件名和详细信息,因此"aaa.cpp" [dos format] 1399 lines, 39255 characters
,等等。
对于搜索失败的每个缓冲区,Vim 都会打印一条错误消息。但是对于确实有内容的缓冲区,不会打印任何内容,因此除非您有如下输出:
"aaa.cpp" [dos format] 1399 lines, 39255 characters
"bbb.cpp" [converted][dos format] 5829 lines, 235847 characters
E486: Pattern not found: not initiated
"ccc.cpp" [dos format] 741 lines, 28473 characters
E486: Pattern not found: not initiated
连续两个文件名没有错误,无法判断是否在任何地方匹配。