突出显示所选单词的所有出现? [英] Highlight all occurrence of a selected word?

查看:59
本文介绍了突出显示所选单词的所有出现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在GVim中突出显示所选单词的所有出现,例如在Notepad ++中?

How can I highlight all occurrence of a selected word in GVim, like in Notepad++?

推荐答案

在普通模式下:

:set hlsearch

然后在普通模式下使用命令/或在插入模式下使用<Ctrl>o/来搜索模式.普通模式下的*将在光标下搜索单词的下一个出现位置. hlsearch选项将突出显示所有这些(如果已设置). #将搜索单词的上一个出现位置.

Then search for a pattern with the command / in Normal mode, or <Ctrl>o followed by / in Insert mode. * in Normal mode will search for the next occurrence of the word under the cursor. The hlsearch option will highlight all of them if set. # will search for the previous occurrence of the word.

要删除上一个搜索的突出显示,请执行以下操作:

To remove the highlight of the previous search:

:nohlsearch

您可能希望将:nohlsearch<CR>映射到一些方便的键.

You might wish to map :nohlsearch<CR> to some convenient key.

这篇关于突出显示所选单词的所有出现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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