diff options
author | Max Christian Pohle | 2017-06-09 20:46:49 +0200 |
---|---|---|
committer | Max Christian Pohle | 2017-06-09 20:46:49 +0200 |
commit | 44dcf9e53ee0e2f3700ecb326716c2b795593629 (patch) | |
tree | 3bc367ae7790da815be0571233e64c2dd860543b /vimrc-full | |
parent | dede3ace49e934280e01f30050ce980b57a6a4d9 (diff) | |
download | vim-44dcf9e53ee0e2f3700ecb326716c2b795593629.tar.bz2 vim-44dcf9e53ee0e2f3700ecb326716c2b795593629.zip |
Improved performance of word-highlighting
- completely rewrote it
Diffstat (limited to 'vimrc-full')
-rw-r--r-- | vimrc-full | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -1,4 +1,4 @@ | |||
1 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 textwidth=160 | 1 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 textwidth=160 iskeyword+=\: |
2 | 2 | ||
3 | set encoding=utf-8 | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=) | 3 | set encoding=utf-8 | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=) |
4 | set t_Co=256 | " required on some ssh sessions | 4 | set t_Co=256 | " required on some ssh sessions |
@@ -68,7 +68,7 @@ set winminwidth=30 | " (and all other windows, so TODO: watch out) | |||
68 | set tags+=../tags | 68 | set tags+=../tags |
69 | " set textwidth=100 | " line length (80 used to be default, but...) | 69 | " set textwidth=100 | " line length (80 used to be default, but...) |
70 | " set colorcolumn= | " not used, because we have a :match directive for textwidth | 70 | " set colorcolumn= | " not used, because we have a :match directive for textwidth |
71 | set updatetime=10 | " updates the screen more often | 71 | set updatetime=80 | " updates the screen more often |
72 | set viminfo+=% | " restore buffer list | 72 | set viminfo+=% | " restore buffer list |
73 | set writedelay=0 | 73 | set writedelay=0 |
74 | set wildmenu | " use a menu in the command line | 74 | set wildmenu | " use a menu in the command line |
@@ -658,17 +658,15 @@ let g:netrw_preview = 0 | " | |||
658 | let g:netrw_winsize = 20 | " window size in percent | 658 | let g:netrw_winsize = 20 | " window size in percent |
659 | 659 | ||
660 | 660 | ||
661 | highlight WordBold cterm=bold gui=bold | ||
661 | function! HighlightWordUnderCursor() | 662 | function! HighlightWordUnderCursor() |
662 | highlight WordBold cterm=bold gui=bold | 663 | if(exists('w:m1') && w:m1 > 0) |
663 | 664 | call matchdelete(w:m1) | |
665 | let w:m1 = 0 | ||
666 | endif | ||
664 | let l:currentword = escape(expand('<cword>'), '.') | 667 | let l:currentword = escape(expand('<cword>'), '.') |
665 | exec 'syn clear' 'WordBold' | ||
666 | if(strlen(l:currentword) > 0) | 668 | if(strlen(l:currentword) > 0) |
667 | " exec '2match' 'WordBold' '/'.l:currentword.'/' | 669 | let w:m1=matchadd('WordBold', l:currentword, -1, 100) |
668 | " exec 'syn match' 'WordBold' '/'.l:currentword.'/' | ||
669 | if getline(".")[col(".")-1] !~# '[[:punct:][:blank:]]' | ||
670 | exec '2match' 'Bold' '/\V\<'.l:currentword.'\>/' | ||
671 | endif | ||
672 | endif | 670 | endif |
673 | endfunction | 671 | endfunction |
674 | autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() | 672 | autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() |