diff options
Diffstat (limited to 'plugin/max-highlight-word-under-cursor.vim')
-rw-r--r-- | plugin/max-highlight-word-under-cursor.vim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugin/max-highlight-word-under-cursor.vim b/plugin/max-highlight-word-under-cursor.vim new file mode 100644 index 0000000..d557b40 --- /dev/null +++ b/plugin/max-highlight-word-under-cursor.vim | |||
@@ -0,0 +1,18 @@ | |||
1 | "======================================================================================================================= | ||
2 | " HIGHLIGHT_WORD_UNDER_CURSOR: | ||
3 | "======================================================================================================================= | ||
4 | |||
5 | let w:m1 = 0 | ||
6 | function! HighlightWordUnderCursor() | ||
7 | if(exists('w:m1') && w:m1 > 0) | ||
8 | silent! call matchdelete(w:m1) | ||
9 | let w:m1 = 0 | ||
10 | endif | ||
11 | let l:currentword = escape(expand('<cword>'), '.') | ||
12 | if(strlen(l:currentword) > 0) | ||
13 | let w:m1=100 | ||
14 | silent! call matchadd('BoldUnderline', '\<'.l:currentword.'\>', -1, w:m1) | ||
15 | endif | ||
16 | endfunction | ||
17 | |||
18 | autocmd CursorHold,CursorHoldI * call HighlightWordUnderCursor() | ||