From defc57b54c38e2411e1e89f3211230ac912fb7ba Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 30 Oct 2017 23:34:54 +1300 Subject: 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. --- vim/config/search.vim | 8 ++++---- 1 file 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 i :set incsearch! + nnoremap i :setlocal incsearch! " Highlight search results, \h toggles this set hlsearch - nnoremap h :set hlsearch! + nnoremap h :setlocal hlsearch! " 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 -- cgit v1.2.3