在VIM中高亮选中的单词,需要用到mark.vim
插件,下载链接如下:
https://www.vim.org/scripts/script.php?script_id=1238
下载得到mark.vim
文件,拷贝到~/.vim/plugin
该插件用法如下:
Usage:
Highlighting:
Normal mode:
\m mark/unmark the word under (or before) the cursor
Place the cursor under the word to be highlighted, press \m, then the word will be colored.
\r manually input a regular expression
To highlight an arbitrary regular expression, press \r and input the regexp.
\n clear this mark (i.e. the mark under the cursor), or mute/unmute all highlighted marks
To clear all marks (instead of mute them), please use \m in muted state.
Visual mode:
\m mark/unmark a visual selection
Select some text in Visual mode, press \m, then the selection will be colored.
\r manually input a regular expression (base on the selection text)
Command line:
:Mark regexp to mark a regular expression
:Mark regexp with exactly the same regexp to unmark it
:Mark to mute all marks
\m:标记/取消标记光标所在单词;
\r:手动输入正则表达式;
\n:清除所以标记;
示例如下:
使用不同的颜色标识不同的相同单词