vim:aucmd: Put often used <cword> into variable
This commit is contained in:
@@ -61,16 +61,17 @@ augroup END
|
|||||||
|
|
||||||
" Highlight word under cursor in other places
|
" Highlight word under cursor in other places
|
||||||
function! HighlightCurrentWord()
|
function! HighlightCurrentWord()
|
||||||
if exists('w:old_cword') && w:old_cword == expand('<cword>')
|
let l:cword = expand('<cword>')
|
||||||
|
if exists('w:old_cword') && w:old_cword == l:cword
|
||||||
" Do not delete and readd the match if on the same word
|
" Do not delete and readd the match if on the same word
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call ClearHighlights()
|
call ClearHighlights()
|
||||||
if (expand('<cword>') != '')
|
if (l:cword != '')
|
||||||
let w:old_cword = expand('<cword>')
|
let w:old_cword = l:cword
|
||||||
let w:cword_match_id = matchadd(
|
let w:cword_match_id = matchadd(
|
||||||
\ 'CursorColumn',
|
\ 'CursorColumn',
|
||||||
\ '\V\<' . escape(expand('<cword>'), '/\') . '\>',
|
\ '\V\<' . escape(l:cword, '/\') . '\>',
|
||||||
\ -1)
|
\ -1)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user