diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-11 12:59:13 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-06-11 12:59:13 +1200 |
commit | 0e96429a9bf6268b9b956fe506287b11e0da71d2 (patch) | |
tree | 50736bc0da7ebc4f262574b7ef19e9b03a60ee5a | |
parent | Add 'listchars' pairs simultaneously (diff) | |
download | dotfiles-0e96429a9bf6268b9b956fe506287b11e0da71d2.tar.gz dotfiles-0e96429a9bf6268b9b956fe506287b11e0da71d2.zip |
Refactor <C-L> remaps, :v/:i in terms of :n
-rw-r--r-- | vim/vimrc | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -1088,7 +1088,7 @@ imap <C-K><C-K> <Plug>(DigraphSearch) " issuing a :nohlsearch command to stop highlighting searches on top of this. " " This gets by far the most use in normal mode, but I'd like it to work in -" visual and insert mode, too, where it's occasionally useful, especially on +" insert and visual modes, too, where it's occasionally useful, especially on " things like mobile phone terminal emulators that can be choppy and require " a lot of redrawing. " @@ -1098,20 +1098,20 @@ imap <C-K><C-K> <Plug>(DigraphSearch) nnoremap <C-L> \ :<C-U>nohlsearch<CR><C-L> -" We use :vnoremap rather than :xnoremap and thereby make the mapping apply to -" select mode as well, because CTRL-L doesn't reflect a printable character, -" and so we may as well make it work, even though I don't actually use select -" mode directly. +" The insert mode wrapper for normal CTRL-L uses CTRL-O to issue a single +" normal mode command. We intentionally use `:normal` rather than `:normal!` +" so that the normal mode mapping applies. I tried using just <C-O><C-L> +" directly for this, but it didn't work; maybe i_CTRL-O doesn't respect +" mappings, but I couldn't find any documentation about this. " -vnoremap <C-L> - \ :<C-U>nohlsearch<CR>gv<C-L> +inoremap <C-L> <C-O>:normal "\<C-L>"<CR> -" The insert mode mapping uses CTRL-O to issue a single normal normal-mode -" command, but twice: once to issue the :nohlsearch command, and then once to -" issue an unmapped normal-mode CTRL-L. +" We use :vnoremap here rather than :xnoremap and thereby make the mapping +" apply to select mode as well, because CTRL-L doesn't reflect a printable +" character, and so we may as well make it work, even though I don't actually +" use select mode directly. " -inoremap <C-L> - \ <C-O>:<C-U>nohlsearch<CR><C-O><C-L> +vmap <C-L> <Esc><C-L>gv " By default, the very-useful normal mode command '&' that repeats the " previous :substitute command doesn't preserve the flags from that |