在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:清除所以標記;
示例如下:
使用不同的顏色標識不同的相同單詞