Diffstat (limited to 'vim/vimrc')
1 files changed, 67 insertions, 67 deletions
@@ -2,7 +2,7 @@
" Tom Ryder (tejr)’s Literate Vimrc
-" Last updated: Thu, 19 Nov 2020 07:55:42 UTC
+" Last updated: Mon 15 Nov 2021 21:57:49 UTC
" │ And I was lifted up in heart, and thought
" │ Of all my late-shown prowess in the lists,
@@ -33,11 +33,11 @@
-" This file should be saved as ‘vimrc’—note no leading period—in the user
+" This file should be saved as `vimrc`—note no leading period—in the user
" runtime directory. On GNU/Linux, Mac OS X, and BSD, that directory is
-" ‘~/.vim’. On Windows, it’s ‘~/vimfiles’. It requires Vim v7.0.0 or newer,
+" `~/.vim`. On Windows, it’s `~/vimfiles`. It requires Vim v7.0.0 or newer,
" including the +eval feature, and with the 'compatible' option turned off.
-" That's to allow line continuations. The vimrc stub at ~/.vimrc (Unix) or
+" That’s to allow line continuations. The vimrc stub at ~/.vimrc (Unix) or
" ~/_vimrc (Windows) checks that these conditions are met before loading this
@@ -59,15 +59,15 @@
" Which encoding to use? The answer is the UTF-8 encoding for Unicode,
" wherever possible. On POSIX-fearing operating systems, I define the primary
-" locale environment variable $LANG to ‘en_NZ.UTF-8’. This informs Vim’s
+" locale environment variable $LANG to `en_NZ.UTF-8`. This informs Vim’s
" choice of internal character encoding. In the absence of such a setting,
-" 'encoding' defaults to ‘latin1’ (ISO-8859-1) in most circumstances. Since
-" this is almost never what I want, even if I haven't said so explicitly by
+" 'encoding' defaults to `latin1` (ISO-8859-1) in most circumstances. Since
+" this is almost never what I want, even if I haven’t said so explicitly by
" exporting $LANG, we’ll fall back to UTF-8 instead.
" However, we need to test that the +multi_byte feature is available before
-" doing any of this, because it was a compile-time feature that wasn't even
-" enabled by default in Vim v7.0. Its status as an optional feature wasn't
+" doing any of this, because it was a compile-time feature that wasn’t even
+" enabled by default in Vim v7.0. Its status as an optional feature wasn’t
" removed until v8.1.0733.
@@ -87,7 +87,7 @@ endif
" One of the first things we’ll need to be able to do is split the value of
" 'runtimepath' into its constituent paths. Correctly splitting the values of
-" comma-separated Vim options is surprisingly complicated. It's not as simple
+" comma-separated Vim options is surprisingly complicated. It’s not as simple
" as just splitting on commas, or even unescaped commas; a more accurate
" definition of the delimiter is:
@@ -109,13 +109,13 @@ endif
" to read the source code for the ad-hoc tokenizer in copy_option_part() in
" src/misc2.c in Vim’s source code.
-" Vim, I do love you, but sometimes you're really weird.
+" Vim, I do love you, but sometimes you’re really weird.
" We fold all that mess away into an autoloaded function option#Split(); see
" vim/autoload/option.vim. Provided a 'runtimepath' is actually set, using
" the list returned from that function, we define an environment variable
" MYVIM—to complement MYVIMRC—for ~/.vim or ~/vimfiles, by retrieving the
-" first value from the 'runtimepath'. We'll use this later on in the file to
+" first value from the 'runtimepath'. We’ll use this later on in the file to
" comprehensively match expected paths for vimrc files.
if &runtimepath ==# ''
@@ -123,17 +123,17 @@ if &runtimepath ==# ''
let $MYVIM = option#Split(&runtimepath)
-" The next components of the runtime directory that we'll set up here will
+" The next components of the runtime directory that we’ll set up here will
" make use of the user’s configured XDG base directories:
-" Note that this isn't an attempt to shoehorn all of Vim into the XDG mold;
-" all of this distribution's files are still expected to be installed into
-" $MYVIM, per the above. We're just leaning on XDG’s conventions to provide
+" Note that this isn’t an attempt to shoehorn all of Vim into the XDG mold;
+" all of this distribution’s files are still expected to be installed into
+" $MYVIM, per the above. We’re just leaning on XDG’s conventions to provide
" separate locations for cache files and other configuration.
-" We'll start by retrieving the list of valid paths for configuration from
+" We’ll start by retrieving the list of valid paths for configuration from
" both the XDG_CONFIG_HOME and XDG_CONFIG_DIRS variables, or from their
" defaults, using autoloaded xdg# functions.
@@ -151,8 +151,8 @@ if has('unix')
" We put XDG_CONFIG_HOME at the front of the 'runtimepath' list with insert(),
-" provided it isn't empty, which is what the function returns when the
-" configured path isn't absolute. This is per the standard's dictum:
+" provided it isn’t empty, which is what the function returns when the
+" configured path isn’t absolute. This is per the standard’s dictum:
" │ All paths set in these environment variables must be absolute. If an
" │ implementation encounters a relative path in any of these variables it
@@ -187,9 +187,9 @@ endif
" write its own history to the default viminfo path instead.
" This is the portable way to specify the path to the viminfo file, as an
-" addendum of the path to the 'viminfo' option with an ‘n’ prefix. Vim
+" addendum of the path to the 'viminfo' option with an `n` prefix. Vim
" v8.1.716 introduced a way to set this with an option named 'viminfofile',
-" but I don't see a reason to use that.
+" but I don’t see a reason to use that.
if exists('s:xdgcachehome') && s:xdgcachehome !=# ''
@@ -204,7 +204,7 @@ endif
" 50 entries for command and search history is pretty stingy. The documented
" maximum value for this option is 10000. I used that for a while, but
" eventually found that on lower-powered machines, keeping this much command
-" history slowed Vim startup down a bit much for my liking, so I've scaled
+" history slowed Vim startup down a bit much for my liking, so I’ve scaled
" this back to a more conservative 300. If I end up missing useful commands,
" I might try switching this on available memory instead.
@@ -227,7 +227,7 @@ set history=300
" this trailing slashes hint for a long time before 'backupdir' caught up to
" them. The 'directory' option for swap files has supported it at least as
" far back as v5.8.0 (2001), and 'undodir' appears to have supported it since
-" its creation in v7.2.438. Even though ‘:help 'backupdir'’ didn’t say so,
+" its creation in v7.2.438. Even though `:help 'backupdir'` didn’t say so,
" people assumed it would work the same way, when in fact Vim simply ignored
" it until v8.1.0251.
@@ -335,7 +335,7 @@ endif
" Set up a directory for files generated by :mkview. To date, I think I have
" used this twice in my life, but may as well be consistent with the other
-" directories of this type. This isn't a comma-separated list like the others
+" directories of this type. This isn’t a comma-separated list like the others
" ('backupdir', 'directory', 'spell', 'undodir')
if exists('s:xdgcachehome') && s:xdgcachehome !=# '' && has('mksession')
@@ -352,28 +352,28 @@ endif
filetype plugin indent on
-" There are a couple of contexts in which it's useful to reload filetypes for
-" the current buffer, quietly doing nothing if filetypes aren't enabled.
-" We'll set up a user command named :ReloadFileType to do this, with
+" There are a couple of contexts in which it’s useful to reload filetypes for
+" the current buffer, quietly doing nothing if filetypes aren’t enabled.
+" We’ll set up a user command named :ReloadFileType to do this, with
" an autoloaded function backing it.
command! -bar ReloadFileType
\ call reload#FileType()
-" We'll also define a :ReloadVimrc command. This may seem like overkill, at
+" We’ll also define a :ReloadVimrc command. This may seem like overkill, at
" first. Surely just `:source $MYVIMRC` would be good enough?
" The problem is there are potential side effects to the current buffer when
" the vimrc is reloaded. The global :set commands for some options may
" trample over different buffer-local settings that were specified by filetype
-" and indent plugins. To ensure these local values are reinstated, we'll
+" and indent plugins. To ensure these local values are reinstated, we’ll
" define the new command wrapper around an autoloaded function that itself
" issues a :ReloadFileType command after the vimrc file is sourced.
command! -bar ReloadVimrc
\ call reload#Vimrc()
-" We'll now create or reset a group of automatic command hooks specific to
+" We’ll now create or reset a group of automatic command hooks specific to
" matters related to reloading the vimrc itself, or maintaining and managing
" options set within it.
@@ -390,7 +390,7 @@ autocmd vimrc BufWritePost $MYVIMRC,$MYVIM/vimrc
" If Vim is new enough (v7.0.187) to support the ##SourceCmd event for
-" automatic command hooks, we'll also apply a hook for that event to catch
+" automatic command hooks, we’ll also apply a hook for that event to catch
" invocations of :source of either vimrc file, and translate that into
" reloading the stub vimrc.
@@ -410,7 +410,7 @@ set spelllang=en_nz
" Spell checking includes optional support for catching lower case letters at
" the start of sentences, and defines a pattern in 'spellcapcheck' for the end
" of a sentence. The default is pretty good, but with two-spacing with
-" 'cpoptions' including ‘J’ and 'formatoptions' including ‘p’ as set later in
+" 'cpoptions' including `J` and 'formatoptions' including `p` as set later in
" this file, we can be less ambiguous in this pattern. We require two
" consecutive spaces, a newline, a carriage return, or a tab to mark the end
" of a sentence. This means that we could make abbreviations like “i.e.
@@ -430,7 +430,7 @@ if exists('+spelloptions')
" For word completion in insert mode with CTRL-X CTRL-K, or if 'complete'
-" includes the ‘k’ flag, the 'dictionary' option specifies the path to the
+" includes the `k` flag, the 'dictionary' option specifies the path to the
" system word list. This makes the dictionary completion work consistently,
" even if 'spell' isn’t set at the time to coax it into using 'spellfile'.
@@ -457,9 +457,9 @@ if exists('s:xdgdatahome') && s:xdgdatahome !=# ''
" In much the same way as 'dictionary', we add an expected path to
-" a thesaurus, for completion with CTRL-X CTRL-T in insert mode, or with ‘t’
+" 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 a decent one can be
+" default `install-vim` target in tejr’s dotfiles, but a decent one can be
" retrieved from my website at <https://sanctum.geek.nz/ref/thesaurus.txt>.
" I got this from the link in the :help for 'thesaurus' in v8.1. It’s from
" WordNet and MyThes-1. I had to remove the first two metadata lines from
@@ -501,7 +501,7 @@ endif
" The default value for the 'path' option is similar, in that it has an aged
" default; this option specifies directories in which project files and
-" includes can be unearthed by navigation commands like 'gf'. Specifically,
+" includes can be unearthed by navigation commands like `gf`. Specifically,
" its default value comprises /usr/include, which is another C default. Let’s
" get rid of that, too.
@@ -531,8 +531,8 @@ set linebreak
" … U+2026 HORIZONTAL ELLIPSIS
" Note that we test for the presence of a multi-byte encoding with a special
-" feature from ‘:help feature-list’, as recommended by ‘:help encoding’.
-" Checking that ‘&encoding ==# 'utf-8'’ is not quite the same thing, though
+" feature from `:help feature-list`, as recommended by `:help encoding`.
+" Checking that `&encoding ==# 'utf-8'` is not quite the same thing, though
" it’s unlikely I’ll ever use a different Unicode encoding by choice.
@@ -571,7 +571,7 @@ set confirm
" if it’s going to be followed by another key code, despite this being how the
" function keys and Meta/Alt modifier are implemented for many terminal types.
" Otherwise, if I press Escape, there’s an annoying delay before 'showmode'
-" stops showing '--INSERT--'.
+" stops showing `--INSERT--`.
" This breaks the function keys and the Meta/Alt modifier in insert mode in
" most or maybe all of the terminals I use, but I don’t want those keys in
@@ -585,15 +585,15 @@ set noesckeys
" Automatic text wrapping options using flags in the 'formatoptions' option
-" begin here. I rely on the filetype plugins to set the ‘t’ and ‘c’ flags for
+" begin here. I rely on the filetype plugins to set the `t` and `c` flags for
" this option to configure whether text or comments should be wrapped, as
" appropriate for the document type or language, and so I don’t mess with
" either of those flags here.
" If a line is already longer than 'textwidth' would otherwise limit when
" editing of that line begins in insert mode, don’t suddenly automatically
-" wrap it; I’ll break it apart myself with a command like ‘gq’. This doesn’t
-" seem to stop paragraph reformatting with ‘a’, if that’s set.
+" wrap it; I’ll break it apart myself with a command like `gq`. This doesn’t
+" seem to stop paragraph reformatting with `a`, if that’s set.
@@ -608,8 +608,8 @@ set formatoptions+=1
" If the filetype plugins have correctly described what the comment syntax for
" the buffer’s language looks like, it makes sense to use that to figure out
" how to join lines within comments without redundant comment syntax cropping
-" up. For example, with this set, joining lines in this very comment with ‘J’
-" would remove the leading ‘"’ characters.
+" up. For example, with this set, joining lines in this very comment with `J`
+" would remove the leading `"` characters.
" This 'formatoptions' flag wasn’t added until v7.3.541. Because we can’t
" test for the availability of option flags directly, we resort to a version
@@ -629,13 +629,13 @@ endif
-" Consequently, we specify that sentence objects for the purposes of the ‘s’
-" text object, the ‘(’ and ‘)’ sentence motions, and formatting with the 'gq'
+" Consequently, we specify that sentence objects for the purposes of the `s`
+" text object, the `(` and `)` sentence motions, and formatting with the 'gq'
" command must be separated by *two* spaces. One space does not suffice.
" My defection to the two-spacers is also the reason I now leave 'joinspaces'
" set, per its default, so that two spaces are inserted when consecutive
-" sentences separated by a line break are joined onto one line by the ‘J’
+" sentences separated by a line break are joined onto one line by the `J`
@@ -653,7 +653,7 @@ set cpoptions+=J
" preserves the semantics of that same period for subsequent reformatting; its
" single-space won’t get lost.
-" So, getting back to our 'formatoptions' settings, that is what the ‘p’ flag
+" So, getting back to our 'formatoptions' settings, that is what the `p` flag
" does. I wrote the patch that added it, after becoming envious of an
" analogous feature during an ill-fated foray into GNU Emacs usage.
@@ -667,7 +667,7 @@ endif
" 'guioptions' option to prevent the menu.vim runtime file from being loaded.
" It doesn’t do any harm, but I never use it, and it’s easy to turn it off.
-" The documentation for this flag in ‘:help 'go-M'’ includes a note saying the
+" The documentation for this flag in `:help 'go-M'` includes a note saying the
" flag should be set here, rather that in the GUI-specific gvimrc file, as one
" might otherwise think.
@@ -740,7 +740,7 @@ set listchars+=nbsp:+ " Non-breaking spaces
" precedes: Signals presence of unwrapped text to screen left
" « U+00BB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
-" Failing that, ‘<’ and ‘>’ will do the trick.
+" Failing that, `<` and `>` will do the trick.
@@ -790,7 +790,7 @@ set sessionoptions-=options " No global options or mappings
-" The ‘I’ flag for the 'shortmess' option prevents the display of the Vim
+" The `I` flag for the 'shortmess' option prevents the display of the Vim
" startup screen with version information, :help hints, and donation
" suggestion. After I registered Vim and donated to Uganda per the screen’s
" plea, I didn’t feel bad about turning this off anymore. Even with this
@@ -813,7 +813,7 @@ set splitbelow splitright
" Vim has an internal list of terminal types that support using smoother
" terminal redrawing, and for which 'ttyfast' is normally set, described in
-" ‘:help 'ttyfast'’. That list includes most of the terminals I use, but
+" `:help 'ttyfast'`. That list includes most of the terminals I use, but
" there are a couple more for which the 'ttyfast' option should apply: the
" windows terminal emulator PuTTY, and the terminal multiplexer tmux, both of
" which I use heavily.
@@ -843,7 +843,7 @@ set virtualedit+=block
" I can’t recall a time that Vim’s error beeping or flashing was actually
" useful to me, and so we turn it off in the manner that the manual instructs
-" in ‘:help 'visualbell'’. This enables visual rather than audio error bells,
+" in `:help 'visualbell'`. This enables visual rather than audio error bells,
" but in the same breath, blanks the terminal attribute that would be used to
" trigger such screen blinking, indirectly disabling the bell altogether.
@@ -912,18 +912,18 @@ set wildignore=*~,#*#,*.7z,.DS_Store,.git,.hg,.svn,*.a,*.adf,*.asc,*.au,*.aup
" Allow me to type a path to complete on the Ex command line in all-lowercase,
" and transform the consequent completion to match the appropriate case, like
-" the Readline setting ‘completion-ignore-case’ can be used for GNU Bash.
+" the Readline setting `completion-ignore-case` can be used for GNU Bash.
" When completing filenames on the command line, choose completions without
" regard to case, allowing me the ease of typing a partial path in
" all-lowercase. This is very similar to the Readline setting
-" ‘completion-ignore-case’ used for Bash.
+" `completion-ignore-case` used for Bash.
" The 'wildignorecase' option is not related to the similarly-named
" 'wildignore' option, nor to the +wildmenu feature.
" We need to check that the 'wildignorecase' option exists before we set it,
-" because it wasn't added to Vim until v7.3.72:
+" because it wasn’t added to Vim until v7.3.72:
@@ -973,7 +973,7 @@ endif
autocmd vimrc ColorScheme *
\ call colorscheme#UpdateCursorline(g:colors_name, ['sahara'])
-" Use 'dark' as my default value for 'background', in the absence of an
+" Use `dark` as my default value for 'background', in the absence of an
" environment variable COLORFGBG or a response in v:termrbgresp that would set
" it specifically.
@@ -1047,7 +1047,7 @@ nnoremap <expr> <Space>
" I often can’t remember (or guess) digraph codes, and want to look up how to
" compose a specific character that I can name, at least in part. The table
-" in ‘:help digraph-table’ is what to use for that situation, and it solves
+" in `:help digraph-table` is what to use for that situation, and it solves
" the problem, but I didn’t like the overhead of repeated lookups therein.
" Steve Losh has a solution I liked where a double-tap of CTRL-K in insert
@@ -1095,7 +1095,7 @@ nnoremap <C-L>
" The insert mode wrapper for normal CTRL-L uses i_CTRL-O to issue a single
-" normal mode command. We intentionally use ‘:normal’ rather than ‘:normal!’
+" normal mode command. We intentionally use `:normal` rather than `:normal!`
" so that the mapping works recursively. I tried using <C-O><C-L> with :imap
" for this, but it didn’t work. Maybe i_CTRL-O doesn’t respect mappings.
" I couldn’t find any documentation about it.
@@ -1105,13 +1105,13 @@ inoremap <C-L>
" We use :vmap here rather than :xmap to have the mapping applied for select
" mode as well as visual mode. This is because CTRL-L doesn’t reflect
-" a printable character, and so we don't shadow anything by making it work,
+" a printable character, and so we don’t shadow anything by making it work,
" even though I don’t actually use select mode directly very much.
-" By default, the very-useful normal mode command ‘&’ that repeats the
+" By default, the very-useful normal mode command `&` that repeats the
" previous :substitute command doesn’t preserve the flags from that
" substitution. I’d prefer it to do so, like the :&& command does, and it’s
" easily remapped for both normal and visual mode, so let’s just do it.
@@ -1121,7 +1121,7 @@ noremap &
-" I really like using the ‘!’ command in normal mode as an operator to filter
+" I really like using the `!` command in normal mode as an operator to filter
" text through a shell command. It always bugged me a little that there
" didn’t seem to be an analogue for a motion to filter text through an
" internal command like :sort, so I wrote one.
@@ -1260,7 +1260,7 @@ nnoremap <Leader>f
" I often have to switch between US English and NZ English. The latter is
" almost exactly the same as UK English in most locales, although we use
" dollars rather than pounds. This is mostly so I remember things like
-" excluding or including the ‘u’ in words like ‘favourite’, depending on the
+" excluding or including the `u` in words like `favourite`, depending on the
" target audience. I generally use US English for international audiences.
@@ -1295,7 +1295,7 @@ nmap <Leader>b
" the name of an option, and the second is the flag within it that should be
" toggled on or off.
-"" Leader,a toggles 'formatoptions' ‘a’ auto-flowing flag
+"" Leader,a toggles 'formatoptions' `a` auto-flowing flag
\ :<C-U>ToggleFlagLocal formatoptions a<CR>
"" Leader,L toggles 'colorcolumn' showing the first column beyond 'textwidth'
@@ -1407,7 +1407,7 @@ nnoremap <Leader>j
" Leader,o hacks up the list of old files from viminfo just long enough to
-" ensure that :browse :oldfiles fits in a screen, avoiding an Enter or ‘q’
+" ensure that :browse :oldfiles fits in a screen, avoiding an Enter or `q`
" keystroke before entering the number. This one is handy followed by
" <Leader>,\ to jump back to the last remembered position in that file, since
" by definition viminfo remembers that mark, too.
@@ -1534,7 +1534,7 @@ ounmap <Leader>7
"" Leader,*/8 is "sticky star":
"" - Set search string to word under cursor
-"" - Show search highlighting if it's enabled
+"" - Show search highlighting if it’s enabled
"" - Don't move the cursor
\ :<C-U>let @/ = expand('<cword>') <Bar> let &hlsearch = &hlsearch<CR>
@@ -1547,7 +1547,7 @@ nnoremap <Leader>`
\ :<C-U>vertical ScratchBuffer<CR>
-" There's no digraph for ZERO WIDTH SPACE (U+200B), which I often need to work
+" There’s no digraph for ZERO WIDTH SPACE (U+200B), which I often need to work
" around word boundary problems in tagging people on the Fediverse.
digraphs zs 8203