diff options
Diffstat (limited to 'vim/config/search.vim')
-rw-r--r-- | vim/config/search.vim | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/vim/config/search.vim b/vim/config/search.vim index 0f10eea5..a3aba989 100644 --- a/vim/config/search.vim +++ b/vim/config/search.vim @@ -3,24 +3,34 @@ if has('extra_search') " Searching as I enter my pattern, \i toggles this set incsearch - nnoremap <Leader>i :setlocal incsearch! incsearch?<CR> + nnoremap <silent> + \ <Leader>i + \ :<C-U>setlocal incsearch! incsearch?<CR> " Highlight search results, \h toggles this set hlsearch - nnoremap <Leader>h :setlocal hlsearch! hlsearch?<CR> + nnoremap <silent> + \ <Leader>h + \ :<C-U>setlocal hlsearch! hlsearch?<CR> " Pressing ^L will clear highlighting until the next search-related " operation; quite good because the highlighting gets distracting after " you've found what you wanted - nnoremap <silent> <C-l> :nohlsearch<CR><C-l> + nnoremap <silent> + \ <C-L> + \ :<C-U>nohlsearch<CR><C-L> " Clear search highlighting as soon as I enter insert mode, and restore it " once I leave it if has('autocmd') augroup dotfiles_highlight autocmd! - silent! autocmd InsertEnter * setlocal nohlsearch - silent! autocmd InsertLeave * setlocal hlsearch + autocmd InsertEnter + \ * + \ setlocal nohlsearch + autocmd InsertLeave + \ * + \ setlocal hlsearch augroup END endif endif |