Last active
August 29, 2015 14:25
-
-
Save adnils/9bff17c8d5fbd3486a8e to your computer and use it in GitHub Desktop.
highlight occurrences of word under cursor on spacebar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:highlighting = 0 | |
function! Highlighting() | |
if g:highlighting == 1 && @/ =~ '^\\<'.expand('<cword>').'\\>$' | |
let g:highlighting = 0 | |
return ":silent nohlsearch\<CR>" | |
endif | |
let @/ = '\<'.expand('<cword>').'\>' | |
let g:highlighting = 1 | |
return ":silent set hlsearch\<CR>" | |
endfunction | |
nnoremap <silent> <expr> <Space> Highlighting() | |
noremap O O<Esc> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment