在vim中,有没有办法重新绑定“*”突出显示当前单词,而不前进到下一个单词?
我经常使用 * 来突出显示当前单词的所有实例,而它前进到下一个单词的事实非常烦人。我想禁用此行为,因为我知道如果我确实需要前进,我总是可以使用“n”。
有什么见解吗?
编辑:我应该补充一点,我想不惜一切代价避免屏幕重绘,因为它会在视觉上分散注意力。
I often use * to highlight all instances of the current word, and the fact that it advances to the next word is pretty annoying. I'd like to disable this behavior, knowing that I can always use "n" if I actually need to advance.
Any insight?
EDIT: I should add that I'd like to avoid a screen redraw at all costs as it is visually distracting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
试试这个:(
假设您打开了
'hlsearch'
)。这只是将当前搜索模式更改为光标下的单词(由\<
和\>
包围以匹配单词边界)。如果您启用了hlsearch
,它将突出显示该单词。n
和N
将正常工作。看:
Try this:
(Assumes you have
'hlsearch'
on). This just changes the current search pattern to the word under the cursor (surrounded by\<
and\>
to match word boundaries). If you havehlsearch
enabled, it will highlight the word.n
andN
will then work as normal.See:
试试这个 Vim 提示。我觉得它非常有用。最有趣的是,你可以有更多的匹配,并且每一个都有不同的颜色。
Try this Vim Tip. I find it very useful. The most interesting is that you can have more matches and every one in different color.
我无法给出确切的答案,但是 这个 Vim 提示 告诉你必须添加到 < code>.vimrc 当 Vim 处于空闲状态时,简单地突出显示光标下的单词。
无需任何键重新映射即可工作...
I cannot give an exact answer, but this Vim Tip tells you what you have to add to your
.vimrc
to simply highlight the word under the cursor when Vim is in idle state.Works without any key-remapping...
您可以重新映射它以返回:(
但这会重绘屏幕)
You can remap it to return:
(but this redraws the screen)