diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-30 23:47:33 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-30 23:49:45 +1300 |
commit | 92f2c78524d1e446aa2ab08b12b54a56dfbbbd26 (patch) | |
tree | 57d0aee3424ef87e5794168cab341c9be6fc34a3 /vim/config/search.vim | |
parent | Toggle Vim 'hlsearch' and 'incsearch' locally (diff) | |
download | dotfiles-92f2c78524d1e446aa2ab08b12b54a56dfbbbd26.tar.gz dotfiles-92f2c78524d1e446aa2ab08b12b54a56dfbbbd26.zip |
Show Vim option values after leader-key toggle
Using the very weird syntax:
:setlocal option! option?
We can toggle the option and print its new value in the same line. For
the line breaking options, we only show the value of the 'linebreak'
option, because otherwise we print three lines of messages, which
requires an <Enter> press, even if we put all three `option?` calls on
one :setlocal line.
Diffstat (limited to 'vim/config/search.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 78b17327..1d1039e2 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 :setlocal incsearch!<CR> + nnoremap <leader>i :setlocal incsearch! incsearch?<CR> " Highlight search results, \h toggles this set hlsearch - nnoremap <leader>h :setlocal hlsearch!<CR> + nnoremap <leader>h :setlocal hlsearch! 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 * setlocal nohlsearch - silent! autocmd InsertLeave * setlocal hlsearch + silent! autocmd InsertEnter * setlocal nohlsearch nohlsearch? + silent! autocmd InsertLeave * setlocal hlsearch hlsearch? augroup END endif endif |