From c5af4abb7edb75ec9a9159e18e146712f8b898f2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:13:56 +1200 Subject: Flesh out opening comment a bit Include some instructions to strip the comments out. --- vim/vimrc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index bbcc6707..1929e74c 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,11 +1,19 @@ " -" Tom Ryder (tejr)'s vimrc -" ======================== +" Tom Ryder (tejr)'s Literate Vimrc +" ================================= " " " -" This is a 'literate vimrc', in the Donald Knuth tradition. It's long, and -" comments abound. +" This is an attempt at something like a 'literate vimrc', in the tradition of +" Donald Knuth's "literate programming". +" +" +" +" It's a long file, and comments abound. If this bothers you, you can do +" something like this to strip out all the blank lines and lines with only +" comments: +" +" :v/^\s*[^"]/d " " This file should be saved as "vimrc" in the user runtime directory. On " Unix-like operating systems, this is ~/.vim; on Windows, it's ~/vimfiles. -- cgit v1.2.3 From 7706eefde4f88fdbecd1162c6866dd0da574b635 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:14:14 +1200 Subject: Explain behaviour of malformed MYVIM --- vim/vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index 1929e74c..7f901d64 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -103,6 +103,9 @@ endif " older versions of Vim, forbid that character. I haven't found the exact " patch level that this was fixed yet, nor the true reason for the bug. " +" If either of these conditions are meant, throw an error and blank the MYVIM +" variable so that nothing uses it. +" if $MYVIM =~# ',' echoerr 'Illegal comma in user runtime path' let $MYVIM = '' -- cgit v1.2.3 From abb0a667bd3686d616ef9915115e1525bea1216e Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:14:27 +1200 Subject: Swap two conditions --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 7f901d64..67cfa6a4 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -109,7 +109,7 @@ endif if $MYVIM =~# ',' echoerr 'Illegal comma in user runtime path' let $MYVIM = '' -elseif v:version < 702 && $MYVIM =~# '\\' +elseif $MYVIM =~# '\\' && v:version < 702 echoerr 'Illegal backslash in user runtime path on Vim < v7.2' let $MYVIM = '' endif -- cgit v1.2.3 From 81c00d3fafc3217638875c8e160d692889895d45 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:14:34 +1200 Subject: Break three conditions into separate lines --- vim/vimrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 67cfa6a4..634d568c 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -118,7 +118,9 @@ endif " to the first element of the default &runtimepath. If this is the case, " we'll slot it in, having already checked it for troublesome characters. " -if $MYVIM !=# '' && len(runtimepath) > 0 && $MYVIM !=# runtimepath[0] +if $MYVIM !=# '' + \ && len(runtimepath) > 0 + \ && $MYVIM !=# runtimepath[0] set runtimepath^=$MYVIM endif -- cgit v1.2.3 From 91257f18feffa1f26852d5f684dd95527d07d388 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:15:02 +1200 Subject: Explain 'dictionary' approach --- vim/vimrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 634d568c..71e1179e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -431,7 +431,9 @@ set cpoptions+=J " " At some point, I may end up having to set this option along with 'spellfile' " a bit more intelligently to ensure that spell checking and dictionary -" function consistently with reference to the same resources. +" function consistently with reference to the same resources. For the moment, +" I've added another entry referring to a directory in the user runtime +" directory, but I don't have anything distinct to put there just yet. " " It's not an error if this file doesn't exist; indeed, on some systems I use, " it doesn't. -- cgit v1.2.3 From 64bd14e1d7bd2f272371c2b90bdc73704e730f2b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:15:59 +1200 Subject: Add P_NDNAME exclusion checks to 'dict' and 'tsr' --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 71e1179e..1267e283 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -439,7 +439,7 @@ set cpoptions+=J " it doesn't. " set dictionary^=/usr/share/dict/words -if $MYVIM !=# '' +if $MYVIM !=# '' && $MYVIM !=~ '[*?[|;&<>\r\n]' set dictionary^=$MYVIM/ref/dictionary.txt endif @@ -697,7 +697,7 @@ set synmaxcol=500 " first two metadata lines from thesaurus.txt, as Vim appeared to interpet " them as part of the body data. " -if $MYVIM !=# '' +if $MYVIM !=# '' && $MYVIM !=~ '[*?[|;&<>\r\n]' set thesaurus^=$MYVIM/ref/thesaurus.txt endif -- cgit v1.2.3 From 0c3d221274a6ade2e1e5320bc426f20df0c360ff Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:35:20 +1200 Subject: Combine 'dict' and 'tsr' :set and move down --- vim/vimrc | 74 ++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 1267e283..3a735cbf 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -424,25 +424,6 @@ set confirm " set cpoptions+=J -" For word completion in insert mode with CTRL-X CTRL-K, or if 'complete' -" includes the 'k' flag, this specifies the path to the system dictionary to -" find words. This makes the dictionary completion work consistently, even if -" 'spell' isn't set at that moment. -" -" At some point, I may end up having to set this option along with 'spellfile' -" a bit more intelligently to ensure that spell checking and dictionary -" function consistently with reference to the same resources. For the moment, -" I've added another entry referring to a directory in the user runtime -" directory, but I don't have anything distinct to put there just yet. -" -" It's not an error if this file doesn't exist; indeed, on some systems I use, -" it doesn't. -" -set dictionary^=/usr/share/dict/words -if $MYVIM !=# '' && $MYVIM !=~ '[*?[|;&<>\r\n]' - set dictionary^=$MYVIM/ref/dictionary.txt -endif - " Keep swap files for file buffers in a dedicated directory, rather than the " default of writing them to the same directory as the buffer file. Add two " trailing slashes to the path to prompt Vim to use the full escaped path in @@ -686,21 +667,6 @@ set shortmess+=I " set synmaxcol=500 -" Add the expected path to the thesaurus, for completion with CTRL-X CTRL-T in -" insert mode, or with 't' added to 'completeopt. This isn't installed as -" part of the default `install-vim` target in tejr's dotfiles; it can be -" installed with `install-vim-thesaurus`. -" -" I got the thesaurus itself from the link in the :help for 'thesaurus' in -" v8.1. It's from WordNet and MyThes-1. I maintain a mirror on my own -" website that the Makefile recipe attempts to retrieve. I had to remove the -" first two metadata lines from thesaurus.txt, as Vim appeared to interpet -" them as part of the body data. -" -if $MYVIM !=# '' && $MYVIM !=~ '[*?[|;&<>\r\n]' - set thesaurus^=$MYVIM/ref/thesaurus.txt -endif - " Vim has an internal list of terminal types that support using smoother " terminal redrawing. It includes most of the terminals I use, but there are " a couple more for which the 'ttyfast' option should apply: the windows @@ -838,6 +804,46 @@ set wildmode=list:longest " properly. " +" For word completion in insert mode with CTRL-X CTRL-K, or if 'complete' +" includes the 'k' flag, this specifies the path to the system dictionary to +" find words. This makes the dictionary completion work consistently, even if +" 'spell' isn't set at that moment. +" +" At some point, I may end up having to set this option along with 'spellfile' +" a bit more intelligently to ensure that spell checking and dictionary +" function consistently with reference to the same resources. For the moment, +" I've added another entry referring to a directory in the user runtime +" directory, but I don't have anything distinct to put there just yet. +" +" It's not an error if this file doesn't exist; indeed, on some systems I use, +" it doesn't. +" +" In the same way, add an expected path to a thesaurus, for completion with +" CTRL-X CTRL-T in insert mode, or with 't' added to 'completeopt'. The +" thesaurus data isn't installed as part of the default `install-vim` target +" in tejr's dotfiles, but it can be retrieved and installed with +" `install-vim-thesaurus`. +" +" I got the thesaurus itself from the link in the :help for 'thesaurus' in +" v8.1. It's from WordNet and MyThes-1. I maintain a mirror on my own +" website that the Makefile recipe attempts to retrieve. I had to remove the +" first two metadata lines from thesaurus.txt, as Vim appeared to interpet +" them as part of the body data. +" +" The checks for appending the 'dictionary' and 'thesaurus' paths in MYVIM +" need to be stricter than the ones for 'backupdir', because the P_NDNAME +" property is assigned to them, which enforces a character blacklist. We +" check for it here and just tolerate not having the user runtime completion +" references, rather than throwing cryptic errors at the user. None of them +" are particularly wise characters to have in paths, anyway, legal though they +" may be on Unix filesystems. +" +set dictionary^=/usr/share/dict/words +if $MYVIM !=# '' && $MYVIM !~# '[*?[|;&<>\r\n]' + set dictionary^=$MYVIM/ref/dictionary.txt + set thesaurus^=$MYVIM/ref/thesaurus.txt +endif + " Use all of the filetype detection, plugin, and indent support available. " I define my own filetype.vim and scripts.vim files for filetype detection, " in a similar but not identical form to the stock runtime files. I also -- cgit v1.2.3 From 29a45a09b7c2072222b0571eecfd88073bf785d2 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:37:45 +1200 Subject: Restore -nargs=1 for :EnsureDir It works fine in Vim 7.0 when passing MYVIM as a single target. --- vim/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 3a735cbf..e7622c54 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -148,7 +148,7 @@ function s:EnsureDir(path) abort return isdirectory(path) \ || exists('*mkdir') && mkdir(path, 'p', 0700) endfunction -command! -complete=dir -nargs=+ EnsureDir +command! -complete=dir -nargs=1 EnsureDir \ call s:EnsureDir() " Now that we have a clean means to create directories if they don't already -- cgit v1.2.3 From 5cf80518010e7376427ddfac00a4f35c63bbe84c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:38:12 +1200 Subject: Document :EnsureDir command as well as function --- vim/vimrc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index e7622c54..a705c1d4 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -148,6 +148,12 @@ function s:EnsureDir(path) abort return isdirectory(path) \ || exists('*mkdir') && mkdir(path, 'p', 0700) endfunction + +" Now we define the :EnsureDir command for user-level access to the +" s:EnsureDir() function. We set the tab completion to provide directory +" names as candidates, and specify that there must be only one argument, which +" we'll provide as a quoted parameter to the function. +" command! -complete=dir -nargs=1 EnsureDir \ call s:EnsureDir() -- cgit v1.2.3 From 2cbcd4e7dc8aa6bec49144810817879b83cd3a56 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:40:29 +1200 Subject: Adjust layout and commentary on 'wild...' :sets Including adding a 'wildmode' setting. --- vim/vimrc | 57 +++++++++++++++++++++++++-------------------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index a705c1d4..4aa15079 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -743,15 +743,34 @@ set virtualedit+=block " set visualbell t_vb= +" When Ex command line completion is started with Tab, list valid completions +" and complete the command line to the longest common substring, just as Bash +" does, with just the one keypress. +" +" The default value of 'full' for the 'wildmmode option puts the full +" completion onto the line immediately, which I tolerate for insert mode +" completion but don't really like on the Ex command line. Instead, I arrange +" for that with a second keypress if I ever want it. +" +set wildmenu +set wildmode=list:longest,full + " Define a list of wildignore patterns for into the 'wildignore' option. " Files and directories with names matching any of these patterns won't be " presented as options for tab completion on the command line. " +" It's tempting to put the list of patterns here into a separate file, or at +" least into a more readily editable intermediate list variable, rather than +" the minor maintenance hassle it presently constitutes in this compact form. +" I'm not sure whether I'll do that just yet. +" " To make this list, I went right through my home directory with " a `find`-toothed comb, counted the lowercased occurrences of every " extension, and then manually selected the ones that I was confident would -" seldom contain plain text. This does the trick, giving you patterns for the -" top 50 extensions: +" seldom contain plain text. +" +" This does the trick with POSIX-compatible shell tools, giving you patterns +" for the top 50 extensions: " " $ find ~ -type f -name '*.*' | " awk -F. '{exts[tolower($NF)]++} @@ -761,11 +780,6 @@ set visualbell t_vb= " " Turns out I have a lot of .html files. " -" It's tempting to put the list of patterns here into a separate file, or at -" least into a more readily editable intermediate list variable, rather than -" the minor maintenance hassle it presently constitutes in this compact form. -" I'm not sure whether I'll do that just yet. -" set wildignore=*~,#*#,*.7z,.DS_Store,.git,.hg,.svn,*.a,*.adf,*.asc,*.au,*.aup \,*.avi,*.bin,*.bmp,*.bz2,*.class,*.db,*.dbm,*.djvu,*.docx,*.exe \,*.filepart,*.flac,*.gd2,*.gif,*.gifv,*.gmo,*.gpg,*.gz,*.hdf,*.ico @@ -779,37 +793,16 @@ set wildignore=*~,#*#,*.7z,.DS_Store,.git,.hg,.svn,*.a,*.adf,*.asc,*.au,*.aup " appropriate case, like the Readline setting completion-ignore-case can be " used for GNU Bash. " -" As far as I can tell, this option doesn't have anything to do with the -" 'wildignore' settings, and so files that would match any of those patterns -" only with case insensitivity implied will still be candidates for -" completion. It also wasn't added until v7.3.72, so we need to check it +" As far as I can tell, despite its name, this option doesn't have anything to +" do with the 'wildignore' settings, and so files that would match any of +" those patterns only with case insensitivity implied will still be candidates +" for completion. It also wasn't added until v7.3.72, so we need to check it " exists before we try to set it. " if exists('+wildignorecase') set wildignorecase endif -" When Ex command line completion is started with Tab, list valid completions -" and complete the command line to the longest common substring, just as Bash -" does, with just the one keypress. The default value of 'full' puts the full -" completion onto the line immediately, which I tolerate for insert mode -" completion but don't really like on the Ex command line. -" -set wildmode=list:longest - -" You might be wondering why we got through the options with 'wild...' as -" a prefix to their names without setting 'wildmenu'. The answer is that -" I don't actually want the popup navigable completion menu. I just want -" tab-completion to work in a shell-like fashion. I've never used the former, -" nor have I messed with 'wildchar' or 'wildcharm'; I've just never needed to, -" and so 'wildmenu' stays as the default. -" -" I used to have 'wildmenu' set, and I didn't realise for years that this did -" nothing at all, because the 'full' flag on which its appearance hinges -" didn't appear in my 'wildmode' setting. I hadn't read the documentation -" properly. -" - " For word completion in insert mode with CTRL-X CTRL-K, or if 'complete' " includes the 'k' flag, this specifies the path to the system dictionary to " find words. This makes the dictionary completion work consistently, even if -- cgit v1.2.3 From cf96e0d70b94cf82dc6cd4849ff93ab6e3f8b722 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 9 Jun 2019 23:40:56 +1200 Subject: Flesh out comment on persistent undo --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 4aa15079..18f7c8fd 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -715,8 +715,8 @@ if has('persistent_undo') endif " Turn the persistent undo features on, regardless of whether we have - " a cache directory for them. It's better than losing the history - " completely. + " a cache directory for them as a result of the logic above. It's better + " than losing the history completely. " set undofile -- cgit v1.2.3 From 9a9b19dc0c734e4304f492656241e8c593d654a1 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:11:18 +1200 Subject: Add opening notes for the mapping section --- vim/vimrc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index 18f7c8fd..a7a4c616 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -899,6 +899,42 @@ catch set nocursorline endtry +" My mapping definitions begin here. I have some general personal rules for +" approaches to mappings: +" +" * Use the configured Leader key as a prefix for mappings as much as +" possible. +" +" * Use only the configured LocalLeader key as a prefix for mappings that are +" defined as local to a buffer, which for me are almost always based on +" &filetype and set up by ftplugin files. +" +" * If a normal mode map would make sense in visual mode, take the time to +" configure that too. Use :xmap and its analogues rather :vmap to avoid +" defining unusable select-mode mappings, even though I never actually use +" selection mode directly. +" +" * Avoid mapping in insert mode; let characters be literal to the greatest +" extent possible, and avoid "doing more" in insert mode besides merely +" inserting text as it's typed. +" +" * Avoid chording with Ctrl in favour of leader keys. +" +" * Never use Alt/Meta chording; the terminal support for them is just too +" confusing and flaky. +" +" * Don't suppress display of mapped commands for no reason; it's OK to show +" the user the command that's being run under the hood. Do avoid HIT-ENTER +" prompts, though. +" +" * Avoid shadowing any of Vim's existing functionality. If possible, extend +" or supplement what Vim does, rather than replacing it. +" + +" We'll start with the non-leader mappings. Ideally there shouldn't be too +" many of these. +" + " Space bar scrolls down a page, :next at buffer's end if plugin available if globpath(&runtimepath, 'plugin/scroll_next.vim') !=# '' \ && &loadplugins -- cgit v1.2.3 From 291cbab91f86b3343102d8231fbfe4dfd9105b64 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:11:31 +1200 Subject: Document mapping --- vim/vimrc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index a7a4c616..68d33fd8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -935,7 +935,23 @@ endtry " many of these. " -" Space bar scrolls down a page, :next at buffer's end if plugin available +" I like the space bar to scroll down a page, so I can lazily tap it to read +" documents, and I find its default behaviour of moving right one character to +" be useless. +" +" I also have a custom plugin named scroll_next.vim that issues :next to have +" it move to the next file in the arglist if the bottom line of the buffer is +" visible, for reading multiple buffers. +" +" However, I only want that plugin mapped if the plugin is actually going to +" load, so I check that it's available and that the 'loadplugin' option is set +" before using its provided map target, otherwise it kills the space key. If +" the plugin doesn't look like it's going to load, I just bind Space to do the +" same thing as PageDown. +" +" Either way, the downside of this arrangement is it's an easy key to hit +" accidentally. I'm keeping it for the moment, though. +" if globpath(&runtimepath, 'plugin/scroll_next.vim') !=# '' \ && &loadplugins nmap (ScrollNext) -- cgit v1.2.3 From 1cbc230302da4456e10c81d1e83cd2ba15752836 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:11:45 +1200 Subject: Document insert mode CTRL-C mapping --- vim/vimrc | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 68d33fd8..27d69a2a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -959,8 +959,33 @@ else nnoremap endif -" Remap insert Ctrl-C to undo the escaped insert operation, but don't break -" the key if the plugin isn't there +" I hate CTRL-C in insert mode, which ends the insert session without firing +" the InsertLeave event for automatic command hooks. It seems worse than +" useless; why would you want that? +" +" Instead, I apply a custom plugin named insert_cancel.vim to make it cancel +" the current insert operation; that is, if the buffer has changed at all +" since the start of the insert operation, pressing CTRL-C will reverse it, +" while ending insert mode and firing InsertLeave as normal. This makes way +" more sense to me, and I use it all the time now. +" +" You might think on a first look, as I did, that a mapping like this is all +" that's required: +" +" :inoremap u +" +" However, there's a subtle problem with that; if you didn't make any changes, +" it *still* reverses the previous change, which has nothing to do with the +" current insert mode operation. The plugin's way of working around this is +" pretty simple, but does still seem to be necessary to avoid that case. +" +" At any rate, as with the spacebar's leverage of the scroll_next.vim plugin +" above, we only want to establish the mapping if we can expect the plugin to +" load, so test that it exists with the expected name and that 'loadplugins' +" is set. +" +" If the plugin isn't available, I don't change what CTRL-C does at all. +" if globpath(&runtimepath, 'plugin/insert_cancel.vim') !=# '' \ && &loadplugins imap (InsertCancel) -- cgit v1.2.3 From 08718f1f378162c5afa9d749ae2d27817b49d2c9 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:11:57 +1200 Subject: Document insert mode CTRL-K double-tap mapping --- vim/vimrc | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 27d69a2a..369962a7 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -991,7 +991,32 @@ if globpath(&runtimepath, 'plugin/insert_cancel.vim') !=# '' imap (InsertCancel) endif -" Map double Ctrl-K in insert mode to search digraph names +" I often don't remember or can't guess digraph codes very well, and want to +" look up how to compose a specific character that I can at least in part +" name. The table in `:help digraph-table` is what to use for that situation, +" and it works great, but the overhead of repeated lookups therein was just +" a little bit high. Steve Losh had a solution I rather liked where +" a double-tap of CTRL-K in insert mode brought up a help window with the +" table, which could then be searched as normal. +" +" I took it one step further with a custom plugin digraph_search.vim that +" parses the digraph table and runs a plaintext search of its names using +" a string provided by the user, e.g. searching for ACUTE yields: +" +" > Digraphs matching ACUTE: +" > ´ '' ACUTE ACCENT +" > Á A' LATIN CAPITAL LETTER A WITH ACUTE +" > É E' LATIN CAPITAL LETTER E WITH ACUTE +" > Í I' LATIN CAPITAL LETTER I WITH ACUTE +" > ... etc ... +" +" This leaves you in insert mode, ready to hit CTRL-K one more time and then +" type the digraph that you've hopefully found. +" +" Since a double-tap of CTRL-K does nothing in default Vim, we don't bother +" checking that the plugin's available before we map to it; it'll just quietly +" do nothing. +" imap (DigraphSearch) " Stack Ctrl-L to clear search highlight, make it work in insert mode too -- cgit v1.2.3 From c58b393f617b55677b7d2fe23c8f2c1de3e48827 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:12:11 +1200 Subject: Make comments on leader mappings more legible More abstracted, too. Who knows if I'll keep using backslash? --- vim/vimrc | 110 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 369962a7..e431e38e 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1053,174 +1053,174 @@ nmap ] (PutBlankLinesBelow) let mapleader = '\' let maplocalleader = ',' -" \a toggles 'formatoptions' 'a' flag using a plugin +" Leader,a toggles 'formatoptions' 'a' flag using a plugin nnoremap a :ToggleFlagLocal formatoptions a -" \b toggles settings friendly to copying and pasting +" Leader,b toggles settings friendly to copying and pasting nmap b (CopyLinebreakToggle) -" \c toggles 'cursorline'; no visual mode map as it doesn't work +" Leader,c toggles 'cursorline'; no visual mode map as it doesn't work nnoremap c :setlocal cursorline! cursorline? -" \C toggles 'cursorcolumn'; works in visual mode +" Leader,C toggles 'cursorcolumn'; works in visual mode nnoremap C :setlocal cursorcolumn! cursorcolumn? xnoremap C :setlocal cursorcolumn! cursorcolumn?gv -" \d inserts the local date (POSIX date) +" Leader,d inserts the local date (POSIX date) nnoremap d :read !date -" \D inserts the UTC date (POSIX date) +" Leader,D inserts the UTC date (POSIX date) nnoremap D :read !date -u -" \e forces a buffer to be editable +" Leader,e forces a buffer to be editable nnoremap e :setlocal modifiable noreadonly -" \f shows the current 'formatoptions' at a glance +" Leader,f shows the current 'formatoptions' at a glance nnoremap f :setlocal formatoptions? -" \F reloads filetype plugins +" Leader,F reloads filetype plugins nnoremap F :FileTypeReload -" \g shows the current file's fully expanded path +" Leader,g shows the current file's fully expanded path nnoremap g :echo expand('%:p') -" \G changes directory to the current file's location +" Leader,G changes directory to the current file's location nnoremap G :cd %:hpwd -" \h toggles highlighting search results +" Leader,h toggles highlighting search results nnoremap h :set hlsearch! hlsearch? -" \H shows command history +" Leader,H shows command history nnoremap H :history : -" \i toggles showing matches as I enter my pattern +" Leader,i toggles showing matches as I enter my pattern nnoremap i :set incsearch! incsearch? -" \j jumps to buffers ("jetpack") +" Leader,j jumps to buffers ("jetpack") nnoremap j :buffers:buffer -" \k shows my marks +" Leader,k shows my marks nnoremap k :marks -" \l toggles showing tab, end-of-line, and trailing white space +" Leader,l toggles showing tab, end-of-line, and trailing white space nnoremap l :setlocal list! list? xnoremap l :setlocal list! list?gv -" \L toggles 'colorcolumn' showing 'textwidth' +" Leader,L toggles 'colorcolumn' showing 'textwidth' nnoremap L :ToggleFlagLocal colorcolumn +1 xnoremap L :ToggleFlagLocal colorcolumn +1gv -" \m shows normal maps +" Leader,m shows normal maps nnoremap m :map -" \M shows buffer-local normal maps +" Leader,M shows buffer-local normal maps nnoremap M :map -" \n toggles line number display +" Leader,n toggles line number display nnoremap n :setlocal number! number? xnoremap n :setlocal number! number?gv -" \N toggles position display in bottom right +" Leader,N toggles position display in bottom right nnoremap N :set ruler! ruler? xnoremap N :set ruler! ruler?gv -" \o opens a line below in paste mode +" Leader,o opens a line below in paste mode nmap o (PasteOpenBelow) -" \O opens a line above in paste mode +" Leader,O opens a line above in paste mode nmap O (PasteOpenAbove) -" \p toggles paste mode +" Leader,p toggles paste mode nnoremap p :set paste! paste? -" \P creates the path to the current file +" Leader,P creates the path to the current file nnoremap P :call mkdir(expand('%:h'), 'p') -" \q formats the current paragraph +" Leader,q formats the current paragraph nnoremap q gqap -" \r acts as a replacement operator +" Leader,r acts as a replacement operator nmap r (ReplaceOperator) xmap r (ReplaceOperator) -" \R reloads ~/.vimrc +" Leader,R reloads ~/.vimrc nnoremap R :source $MYVIMRC -" \s toggles spell checking +" Leader,s toggles spell checking nnoremap s :setlocal spell! spell? -" \S shows loaded scripts +" Leader,S shows loaded scripts nnoremap S :scriptnames -" \t shows current filetype +" Leader,t shows current filetype nnoremap t :setlocal filetype? -" \T clears filetype +" Leader,T clears filetype nnoremap T :setlocal filetype= -" \u sets US English spelling (compare \z) +" Leader,u sets US English spelling (compare Leader,z) nnoremap u :setlocal spelllang=en_us -" \v shows all global variables +" Leader,v shows all global variables nnoremap v :let g: v: -" \V shows all local variables +" Leader,V shows all local variables nnoremap V :let b: t: w: -" \w toggles wrapping +" Leader,w toggles wrapping nnoremap w :setlocal wrap! wrap? xnoremap w :setlocal wrap! wrap?gv -" \x strips trailing whitespace via a custom plugin +" Leader,x strips trailing whitespace via a custom plugin nnoremap x :StripTrailingWhitespace xnoremap x :StripTrailingWhitespace -" \X squeezes repeated blank lines via a custom plugin +" Leader,X squeezes repeated blank lines via a custom plugin nnoremap X :SqueezeRepeatBlanks xnoremap X :SqueezeRepeatBlanks -" \y shows all registers +" Leader,y shows all registers nnoremap y :registers -" \z sets NZ English spelling (compare \u) +" Leader,z sets NZ English spelling (compare Leader,u) nnoremap z :setlocal spelllang=en_nz -" \= runs the whole buffer through =, preserving position +" Leader,= runs the whole buffer through =, preserving position nnoremap = :KeepPosition normal! 1G=G -" \+ runs the whole buffer through gq, preserving position +" Leader,+ runs the whole buffer through gq, preserving position nnoremap + :KeepPosition normal! 1GgqG -" \. runs the configured make program into the location list +" Leader,. runs the configured make program into the location list nnoremap . :lmake! -" \< and \> adjust indent of last edit; good for pasting +" Leader,< and Leader,> adjust indent of last edit; good for pasting nnoremap :'[,'] nnoremap > :'[,']> -" \_ uses last changed or yanked text as an object +" Leader,_ uses last changed or yanked text as an object onoremap _ :normal! `[v`] -" \% uses entire buffer as an object +" Leader,% uses entire buffer as an object onoremap % :normal! 1GVG -" \{ and \} move to lines with non-space chars before current column +" Leader,{ and Leader,} move to lines with non-space chars before current column map { (VerticalRegionUp) sunmap { map } (VerticalRegionDown) sunmap } -" \/ types :vimgrep for me ready to enter a search pattern +" Leader,/ types :vimgrep for me ready to enter a search pattern nnoremap / :vimgrep /\c/j ** -" \? types :lhelpgrep for me ready to enter a search pattern +" Leader,? types :lhelpgrep for me ready to enter a search pattern nnoremap ? :lhelpgrep \c -" \* escapes regex metacharacters +" Leader,* escapes regex metacharacters nmap * (RegexEscape) xmap * (RegexEscape) -" \\ jumps to the last edit position mark, like g;, but works as a motion +" Leader,\ jumps to the last edit position mark, like g;, but works as a motion " "Now, where was I?" (tap-tap) nnoremap \ `" xnoremap \ `" -" \DEL deletes the current buffer +" Leader,DEL deletes the current buffer nnoremap :bdelete -" \INS edits a new buffer +" Leader,INS edits a new buffer nnoremap :enew -" \TAB toggles 'autoindent' +" Leader,TAB toggles 'autoindent' nnoremap :setlocal autoindent! autoindent? " Some useful abbreviations -- cgit v1.2.3 From f59c18612b4b4a65fe779a61d54b26c437a49fb4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 10 Jun 2019 00:12:58 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 2152664b..73c06919 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v5.26.0 -Sun Jun 9 07:47:49 UTC 2019 +tejr dotfiles v5.27.0 +Sun Jun 9 12:12:58 UTC 2019 -- cgit v1.2.3