diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-11 18:18:35 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-11 18:18:35 +1200 |
commit | 9f847dab56d6e4eeb7f890451962c6b1ef4b1281 (patch) | |
tree | 1997a496669f25f6e7bf958f49776275716bfca7 /vim/vimrc | |
parent | Break abbreviation definitions for readability (diff) | |
download | dotfiles-9f847dab56d6e4eeb7f890451962c6b1ef4b1281.tar.gz dotfiles-9f847dab56d6e4eeb7f890451962c6b1ef4b1281.zip |
Break map definitions consistently
Diffstat (limited to 'vim/vimrc')
-rw-r--r-- | vim/vimrc | 84 |
1 files changed, 55 insertions, 29 deletions
@@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Mon, 11 May 2020 06:03:29 UTC +" Last updated: Mon, 11 May 2020 06:18:28 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -1004,7 +1004,8 @@ endif " alternate buffer. User nickspoons of #vim was incredulous that I had never " used CTRL-^ and indeed did not know about it. I have since repented. " -nnoremap <Backspace> <C-^> +nnoremap <Backspace> + \ <C-^> " I find the space bar’s default behavior in normal mode of moving right one " character to be useless. Instead, I remap it to be a lazy way of paging @@ -1015,8 +1016,8 @@ nnoremap <Backspace> <C-^> " nnoremap <expr> <Space> \ line('w$') < line('$') - \ ? "\<PageDown>" - \ : ":\<C-U>next\<CR>" + \ ? "\<PageDown>" + \ : ":\<C-U>next\<CR>" " I hate CTRL-C’s default insert mode behavior. It ends the insert session " without firing the InsertLeave event for automatic command hooks. Why would @@ -1055,7 +1056,8 @@ nnoremap <expr> <Space> " uselessness. " if plugin#Ready('insert_cancel') - imap <C-C> <Plug>(InsertCancel) + imap <C-C> + \ <Plug>(InsertCancel) endif " I often can’t remember (or guess) digraph codes, and want to look up how to @@ -1089,7 +1091,8 @@ endif " checking that the plugin’s available before we map to it; it’ll just quietly " do nothing. " -imap <C-K><C-K> <Plug>(DigraphSearch) +imap <C-K><C-K> + \ <Plug>(DigraphSearch) " I end up hitting CTRL-L to clear or redraw the screen in interactive shells " and tools like Mutt and Vim pretty often. It feels natural to me to stack @@ -1112,14 +1115,16 @@ nnoremap <C-L> " for this, but it didn’t work. Maybe i_CTRL-O doesn’t respect mappings. " I couldn’t find any documentation about it. " -inoremap <C-L> <C-O>:execute "normal \<C-L>"<CR> +inoremap <C-L> + \ <C-O>:execute "normal \<C-L>"<CR> " 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. " -vmap <C-L> <Esc><C-L>gv +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 @@ -1138,7 +1143,8 @@ sunmap & " " <https://sanctum.geek.nz/cgit/vim-colon-operator.git/about/> " -nmap g: <Plug>(ColonOperator) +nmap g: + \ <Plug>(ColonOperator) " I used Tim Pope’s unimpaired.vim plugin for ages, and I liked some of these " bracket pair mappings, so I’ve carried a few of the simpler ones over. All @@ -1174,8 +1180,10 @@ nnoremap ]l " " <https://sanctum.geek.nz/cgit/vim-put-blank-lines.git/about/> " -nmap [<Space> <Plug>(PutBlankLinesAbove) -nmap ]<Space> <Plug>(PutBlankLinesBelow) +nmap [<Space> + \ <Plug>(PutBlankLinesAbove) +nmap ]<Space> + \ <Plug>(PutBlankLinesBelow) " We’re on to the leader maps, now. It’s difficult to know in what order to " describe and specify these. I used to have them in alphabetical order, but @@ -1196,7 +1204,8 @@ let maplocalleader = ',' " relying on mapping 'timeout'. " if maplocalleader ==# ',' - noremap ,, , + noremap ,, + \ , sunmap ,, endif @@ -1291,7 +1300,8 @@ nnoremap <Leader>u " "" Leader,b toggles settings friendly to copying and pasting -nmap <Leader>b <Plug>(CopyLinebreakToggle) +nmap <Leader>b + \ <Plug>(CopyLinebreakToggle) " The above mappings show that mappings for toggling boolean options are " simple, but there isn’t a way to toggle single flags within option strings @@ -1315,7 +1325,8 @@ sunmap <Leader>L " kept confusing me. I’m hoping this will be better. "" Leader,p prepares the next insert for paste mode -nmap <Leader>p <Plug>PasteInsert +nmap <Leader>p + \ <Plug>PasteInsert " These mappings are for managing filetypes. The first one uses the " :ReloadFileType command that was defined much earlier in this file for @@ -1417,7 +1428,8 @@ nnoremap <Leader>j " <Leader>,\ to jump back to the last remembered position in that file, since " by definition viminfo remembers that mark, too. " -nmap <Leader>o <Plug>(SelectOldFiles) +nmap <Leader>o + \ <Plug>(SelectOldFiles) " This group defines mappings for filtering and batch operations to clean up " buffer text. All of these mappings use commands from my custom plugins: @@ -1458,7 +1470,8 @@ onoremap <Leader>_ "" Leader,% or Leader,5 uses entire buffer as an object onoremap <Leader>% \ :<C-U>execute 'normal! 1GVG'<CR> -omap <Leader>5 <Leader>% +omap <Leader>5 + \ <Leader>% " This group defines some useful motions, including navigating by indent " block using a custom plugin: @@ -1467,12 +1480,15 @@ omap <Leader>5 <Leader>% " "" Leader,{ and Leader,} move to top and bottom of indent region -map <Leader>{ <Plug>(VerticalRegionUp) +map <Leader>{ + \ <Plug>(VerticalRegionUp) sunmap <Leader>{ -map <Leader>} <Plug>(VerticalRegionDown) +map <Leader>} + \ <Plug>(VerticalRegionDown) sunmap <Leader>} "" Leader,\ jumps to the last edit position mark; think “Now, where was I?” -noremap <Leader>\ `" +noremap <Leader>\ + \ `" sunmap <Leader>\ " This group does both: useful motions on defined text objects. @@ -1506,26 +1522,35 @@ nnoremap <Leader>? nnoremap <Leader>. \ :<C-U>lmake!<CR> "" Leader,q formats the current paragraph -nnoremap <Leader>q gqap +nnoremap <Leader>q + \ gqap "" Leader,r acts as a replacement operator -map <Leader>r <Plug>(ReplaceOperator) +map <Leader>r + \ <Plug>(ReplaceOperator) ounmap <Leader>r sunmap <Leader>r "" Leader,!/1 repeats the last command, adding a bang nnoremap <Leader>! \ :<Up><Home><S-Right>!<CR> -nmap <Leader>1 <Leader>! +nmap <Leader>1 + \ <Leader>! "" Leader,#/3 switches the current buffer to the next alternate filetype -nmap <Leader># <Plug>(AlternateFileType) -nmap <Leader>3 <Leader># +nmap <Leader># + \ <Plug>(AlternateFileType) +nmap <Leader>3 + \ <Leader># "" Leader,$/4 gives me my fortune -nmap <Leader>$ <Plug>(Fortune) -nmap <Leader>4 <Leader>$ +nmap <Leader>$ + \ <Plug>(Fortune) +nmap <Leader>4 + \ <Leader>$ "" Leader,&/7 escapes regex metacharacters -map <Leader>& <Plug>(RegexEscape) +map <Leader>& + \ <Plug>(RegexEscape) ounmap <Leader>& sunmap <Leader>& -map <Leader>7 <Leader>& +map <Leader>7 + \ <Leader>& ounmap <Leader>7 sunmap <Leader>7 "" Leader,*/8 is "sticky star": @@ -1534,7 +1559,8 @@ sunmap <Leader>7 "" - Don't move the cursor nnoremap <silent> <Leader>* \ :<C-U>let @/ = expand('<cword>')<CR>:let &hlsearch = &hlsearch<CR> -nmap <Leader>8 <Leader>* +nmap <Leader>8 + \ <Leader>* "" Leader,` opens a scratch buffer, horizontally split nnoremap <silent> <Leader>` \ :<C-U>ScratchBuffer<CR> |