From 9f847dab56d6e4eeb7f890451962c6b1ef4b1281 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 11 May 2020 18:18:35 +1200 Subject: Break map definitions consistently --- vim/vimrc | 84 +++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 29 deletions(-) (limited to 'vim') diff --git a/vim/vimrc b/vim/vimrc index 48548f8b..ccd660cc 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -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 +nnoremap + \ " 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 " nnoremap \ line('w$') < line('$') - \ ? "\" - \ : ":\next\" + \ ? "\" + \ : ":\next\" " 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 " uselessness. " if plugin#Ready('insert_cancel') - imap (InsertCancel) + imap + \ (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 (DigraphSearch) +imap + \ (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 " for this, but it didn’t work. Maybe i_CTRL-O doesn’t respect mappings. " I couldn’t find any documentation about it. " -inoremap :execute "normal \" +inoremap + \ :execute "normal \" " 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 gv +vmap + \ 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 & " " " -nmap g: (ColonOperator) +nmap g: + \ (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 " " " -nmap [ (PutBlankLinesAbove) -nmap ] (PutBlankLinesBelow) +nmap [ + \ (PutBlankLinesAbove) +nmap ] + \ (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 u " "" Leader,b toggles settings friendly to copying and pasting -nmap b (CopyLinebreakToggle) +nmap b + \ (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 L " kept confusing me. I’m hoping this will be better. "" Leader,p prepares the next insert for paste mode -nmap p PasteInsert +nmap p + \ 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 j " ,\ to jump back to the last remembered position in that file, since " by definition viminfo remembers that mark, too. " -nmap o (SelectOldFiles) +nmap o + \ (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,% or Leader,5 uses entire buffer as an object onoremap % \ :execute 'normal! 1GVG' -omap 5 % +omap 5 + \ % " This group defines some useful motions, including navigating by indent " block using a custom plugin: @@ -1467,12 +1480,15 @@ omap 5 % " "" Leader,{ and Leader,} move to top and bottom of indent region -map { (VerticalRegionUp) +map { + \ (VerticalRegionUp) sunmap { -map } (VerticalRegionDown) +map } + \ (VerticalRegionDown) sunmap } "" Leader,\ jumps to the last edit position mark; think “Now, where was I?” -noremap \ `" +noremap \ + \ `" sunmap \ " This group does both: useful motions on defined text objects. @@ -1506,26 +1522,35 @@ nnoremap ? nnoremap . \ :lmake! "" Leader,q formats the current paragraph -nnoremap q gqap +nnoremap q + \ gqap "" Leader,r acts as a replacement operator -map r (ReplaceOperator) +map r + \ (ReplaceOperator) ounmap r sunmap r "" Leader,!/1 repeats the last command, adding a bang nnoremap ! \ :! -nmap 1 ! +nmap 1 + \ ! "" Leader,#/3 switches the current buffer to the next alternate filetype -nmap # (AlternateFileType) -nmap 3 # +nmap # + \ (AlternateFileType) +nmap 3 + \ # "" Leader,$/4 gives me my fortune -nmap $ (Fortune) -nmap 4 $ +nmap $ + \ (Fortune) +nmap 4 + \ $ "" Leader,&/7 escapes regex metacharacters -map & (RegexEscape) +map & + \ (RegexEscape) ounmap & sunmap & -map 7 & +map 7 + \ & ounmap 7 sunmap 7 "" Leader,*/8 is "sticky star": @@ -1534,7 +1559,8 @@ sunmap 7 "" - Don't move the cursor nnoremap * \ :let @/ = expand(''):let &hlsearch = &hlsearch -nmap 8 * +nmap 8 + \ * "" Leader,` opens a scratch buffer, horizontally split nnoremap ` \ :ScratchBuffer -- cgit v1.2.3