vim 没有找到并替换清楚存在的简单短语 [英] vim does not find and replace simple phrase that is clearly present

查看:49
本文介绍了vim 没有找到并替换清楚存在的简单短语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的 vim 问题,Google 无法帮助我解决.任何想法表示赞赏.

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

我明白了

E486: Pattern not found

指示我开始输入位置的绿色方块的位置明显位于图案上方.我尝试搜索其他不涉及正则表达式的短语,这些短语也存在,但也失败了.一个简单的/numnodes 按预期高亮匹配.有谁知道 vim 可能有什么问题?

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?

推荐答案

试试:%s/searchphrase/replacephase/g

没有 % 符号 Vim 只匹配和替换当前行.

Without the % symbol Vim only matches and replaces on the current line.

这篇关于vim 没有找到并替换清楚存在的简单短语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆