diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-30 23:34:54 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-30 23:34:54 +1300 |
commit | defc57b54c38e2411e1e89f3211230ac912fb7ba (patch) | |
tree | 89e9f970df011c9f9c79be64ad518c0f1d73556f /vim | |
parent | Note that StripTrailingWhitespace() does whole doc (diff) | |
download | dotfiles-defc57b54c38e2411e1e89f3211230ac912fb7ba.tar.gz dotfiles-defc57b54c38e2411e1e89f3211230ac912fb7ba.zip |
Toggle Vim 'hlsearch' and 'incsearch' locally
That is, \h and \i shouldn't change the value of the search highlighting
or incremental search features globally, just per-buffer.
I'm not actually completely sure I want this, but it does seem tidier at
the moment.
Diffstat (limited to 'vim')
-rw-r--r-- | vim/config/search.vim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vim/config/search.vim b/vim/config/search.vim index 56a461b3..78b17327 100644 --- a/vim/config/search.vim +++ b/vim/config/search.vim @@ -3,11 +3,11 @@ if has('extra_search') " Searching as I enter my pattern, \i toggles this set incsearch - nnoremap <leader>i :set incsearch!<CR> + nnoremap <leader>i :setlocal incsearch!<CR> " Highlight search results, \h toggles this set hlsearch - nnoremap <leader>h :set hlsearch!<CR> + nnoremap <leader>h :setlocal hlsearch!<CR> " Pressing ^L will clear highlighting until the next search-related " operation; quite good because the highlighting gets distracting after @@ -19,8 +19,8 @@ if has('extra_search') if has('autocmd') augroup dotfiles_highlight autocmd! - silent! autocmd InsertEnter * set nohlsearch - silent! autocmd InsertLeave * set hlsearch + silent! autocmd InsertEnter * setlocal nohlsearch + silent! autocmd InsertLeave * setlocal hlsearch augroup END endif endif |