vim 无法查找和替换明显存在的简单短语
我有一个简单的 vim 问题,Google 没有设法帮助我解决。任何想法表示赞赏。
我进行以下搜索和替换:
:s/numnodes/numnodes1/g
在包含以下文本的文件上:
numprocs=0
numnodes=0
我得到
E486: Pattern not found
指示我开始输入的位置的绿色方块的位置显然位于模式上方。我尝试搜索其他不涉及正则表达式的短语,这些短语也存在,但也失败了。一个简单的 /numnodes 按预期突出显示匹配项。有谁知道 vim 可能出什么问题吗?
I have a simple vim problem that Google hasn't managed to help me with. Any thoughts are appreciated.
I do the following search and replace:
:s/numnodes/numnodes1/g
On a file containing the following text:
numprocs=0
numnodes=0
I get
E486: Pattern not found
The position of the green square which indicates where I'd start typing is clearly above the pattern. I tried searching for other short phrases not involving regex, which are also present, which also fail. A simple /numnodes highlights matches as expected. Does anyone have any idea what might be the matter with vim?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用这个:
try using this:
尝试
:%s/searchphrase/replacephase/g
如果没有
%
符号,Vim 只在当前行进行匹配和替换。Try
:%s/searchphrase/replacephase/g
Without the
%
symbol Vim only matches and replaces on the current line.