aboutsummaryrefslogtreecommitdiff
path: root/vimrc-full
diff options
context:
space:
mode:
authorMax Christian Pohle2017-06-09 20:46:49 +0200
committerMax Christian Pohle2017-06-09 20:46:49 +0200
commit44dcf9e53ee0e2f3700ecb326716c2b795593629 (patch)
tree3bc367ae7790da815be0571233e64c2dd860543b /vimrc-full
parentdede3ace49e934280e01f30050ce980b57a6a4d9 (diff)
downloadvim-44dcf9e53ee0e2f3700ecb326716c2b795593629.tar.bz2
vim-44dcf9e53ee0e2f3700ecb326716c2b795593629.zip
Improved performance of word-highlighting
- completely rewrote it
Diffstat (limited to 'vimrc-full')
-rw-r--r--vimrc-full18
1 files changed, 8 insertions, 10 deletions
diff --git a/vimrc-full b/vimrc-full
index 1344f7e..e605d38 100644
--- a/vimrc-full
+++ b/vimrc-full
@@ -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
3set encoding=utf-8 | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=) 3set encoding=utf-8 | " set up vim's cosole encoding (not file encoding, for which there is fileencoding=)
4set t_Co=256 | " required on some ssh sessions 4set t_Co=256 | " required on some ssh sessions
@@ -68,7 +68,7 @@ set winminwidth=30 | " (and all other windows, so TODO: watch out)
68set tags+=../tags 68set 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
71set updatetime=10 | " updates the screen more often 71set updatetime=80 | " updates the screen more often
72set viminfo+=% | " restore buffer list 72set viminfo+=% | " restore buffer list
73set writedelay=0 73set writedelay=0
74set wildmenu | " use a menu in the command line 74set wildmenu | " use a menu in the command line
@@ -658,17 +658,15 @@ let g:netrw_preview = 0 | "
658let g:netrw_winsize = 20 | " window size in percent 658let g:netrw_winsize = 20 | " window size in percent
659 659
660 660
661highlight WordBold cterm=bold gui=bold
661function! HighlightWordUnderCursor() 662function! 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
673endfunction 671endfunction
674autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor() 672autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor()
..