diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 068d12c..d24f1ae 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -319,6 +319,44 @@ function! TrimWhiteSpace() %s/\s\+$//e endfunction +function! HiInterestingWord(n) + " Save our location. + normal! mz + + " Yank the current word into the z register. + normal! "zyiw + + " Calculate an arbitrary match ID. Hopefully nothing else is using it. + let mid = 86750 + a:n + + " Clear existing matches, but don't worry if they don't exist. + silent! call matchdelete(mid) + + " Construct a literal pattern that has to match at boundaries. + let pat = '\V\<' . escape(@z, '\') . '\>' + + " Actually match the words. + call matchadd("InterestingWord" . a:n, pat, 1, mid) + + " Move back to our original location. + normal! `z +endfunction + +nnoremap 1 :call HiInterestingWord(1) +nnoremap 2 :call HiInterestingWord(2) +nnoremap 3 :call HiInterestingWord(3) +nnoremap 4 :call HiInterestingWord(4) +nnoremap 5 :call HiInterestingWord(5) +nnoremap 6 :call HiInterestingWord(6) + +hi def InterestingWord1 guifg=#000000 ctermfg=16 guibg=#ffa724 ctermbg=214 +hi def InterestingWord2 guifg=#000000 ctermfg=16 guibg=#aeee00 ctermbg=154 +hi def InterestingWord3 guifg=#000000 ctermfg=16 guibg=#8cffba ctermbg=121 +hi def InterestingWord4 guifg=#000000 ctermfg=16 guibg=#b88853 ctermbg=137 +hi def InterestingWord5 guifg=#000000 ctermfg=16 guibg=#ff9eb8 ctermbg=211 +hi def InterestingWord6 guifg=#000000 ctermfg=16 guibg=#ff2c4b ctermbg=195 + + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Plugins """""""""""""""""""""""""""""""""""""""""""""""""""""""""""