From 24ceebd754b26e2762371de25163e15841568259 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 17 Sep 2020 21:21:20 +1200 Subject: Move plugin-dependent config to vim/after files --- vim/after/plugin/insert_cancel.vim | 4 +++ vim/after/plugin/matchparen.vim | 4 +++ vim/autoload/plugin.vim | 7 ----- vim/vimrc | 52 +------------------------------------- 4 files changed, 9 insertions(+), 58 deletions(-) create mode 100644 vim/after/plugin/insert_cancel.vim create mode 100644 vim/after/plugin/matchparen.vim delete mode 100644 vim/autoload/plugin.vim diff --git a/vim/after/plugin/insert_cancel.vim b/vim/after/plugin/insert_cancel.vim new file mode 100644 index 00000000..a8abe6ed --- /dev/null +++ b/vim/after/plugin/insert_cancel.vim @@ -0,0 +1,4 @@ +" Set mapping for insert_cancel.vim +if exists('loaded_insert_cancel') + imap (InsertCancel) +endif diff --git a/vim/after/plugin/matchparen.vim b/vim/after/plugin/matchparen.vim new file mode 100644 index 00000000..b2be8f61 --- /dev/null +++ b/vim/after/plugin/matchparen.vim @@ -0,0 +1,4 @@ +" If matchparen.vim didn't load, use 'showmatch' instead +if !exists('loaded_matchparen') + set showmatch matchtime=3 +endif diff --git a/vim/autoload/plugin.vim b/vim/autoload/plugin.vim deleted file mode 100644 index 629a4367..00000000 --- a/vim/autoload/plugin.vim +++ /dev/null @@ -1,7 +0,0 @@ -" Check whether plugins are enabled and a specific named plugin (excluding -" extension .vim) is available somewhere within 'runtimepath' -" -function! plugin#Ready(name) abort - return &loadplugins - \ && globpath(&runtimepath, 'plugin/'.a:name.'.vim') !=# '' -endfunction diff --git a/vim/vimrc b/vim/vimrc index e9e940c2..016d0958 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Mon, 14 Sep 2020 02:28:57 UTC +" Last updated: Thu, 17 Sep 2020 09:18:45 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -801,15 +801,6 @@ set noshowcmd " set shortmess+=I -" We’ll only use the old 'showmatch' method of a brief jump to the matching -" bracket under the cursor if the much-preferred matchparen.vim standard -" plugin doesn’t look like it’s going to load, whether because plugins have -" been disabled, or it’s not in any of the plugin directories. -" -if !plugin#Ready('matchparen') - set showmatch matchtime=3 -endif - " I find the defaults of new windows opening above or to the left of the " previous window too jarring, because I’m used to both the i3 window manager " and the tmux terminal multiplexer doing it the other way around, in reading @@ -1052,47 +1043,6 @@ nnoremap \ ? "\" \ : ":\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 -" anyone want that? It breaks plugins that hinge on mirrored functionality -" between the InsertEnter and InsertLeave events, and doesn’t otherwise differ -" from Escape or :stopinsert. Even worse, people think it’s a *synonym* for -" Escape, and use it because it’s easier to reach than the Escape key or -" CTRL-[. Terrible! -" -" 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 plugin is overkill, and -" that a mapping like this would be all that’s required: -" -" :inoremap u -" -" Indeed, it *mostly* works, but there are some subtle problems with it. The -" primary issue is that if you didn’t make any changes during the insert mode -" session that you’re terminating, it *still* reverses the previous change, -" which will be something else entirely that you probably *didn’t* mean to be -" undone. The plugin’s way of working around this and the other shortcomings -" of the simple mapping above is not too much more complicated, but it was not -" easy to figure out. -" -" At any rate, we only want to establish the mapping if we can expect the -" plugin to load, so test that 'loadplugins' is set and that the plugin file -" exists with the expected filename. -" -" If the plugin isn’t available, I just abandon CTRL-C to continue its -" uselessness. -" -if plugin#Ready('insert_cancel') - imap - \ (InsertCancel) -endif - " 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 -- cgit v1.2.3 From b04c7d845cbe95691c284912b6fea35a31addaee Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 17 Sep 2020 21:23:32 +1200 Subject: Separate 'dictionary' and 'thesaurus' settings --- vim/vimrc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 016d0958..e95ba55d 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Thu, 17 Sep 2020 09:18:45 UTC +" Last updated: Thu, 17 Sep 2020 09:23:14 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -447,15 +447,6 @@ endif " moment, I’ve just added additional entries referring to the user runtime " directory. " -" In much the same way, we 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 a decent one can be retrieved from my website at -" . 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 thesaurus.txt, as Vim appeared -" to interpret them as part of the body data. -" set dictionary^=/usr/share/dict/words if s:xdgdatahome !=# '' || !empty(s:xdgdatadirs) execute 'set dictionary^='.option#Escape(join(map( @@ -465,6 +456,18 @@ if s:xdgdatahome !=# '' || !empty(s:xdgdatadirs) \), \ 'option#item#Escape(v:val.''/dictionary.txt'')' \), ',')) +endif + +" 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’ +" 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 +" retrieved from my website at . +" 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 +" thesaurus.txt, as Vim appeared to interpret them as part of the body data. +" +if s:xdgdatahome !=# '' || !empty(s:xdgdatadirs) execute 'set thesaurus^='.option#Escape(join(map( \ extend( \ s:xdgdatahome !=# '' ? [s:xdgdatahome] : [], -- cgit v1.2.3 From ab177ee6910ef8e6a8cc456b069b6fca26d1874c Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 18 Sep 2020 21:32:58 +1200 Subject: Use consistent spacing --- vim/vimrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index e95ba55d..23ba5098 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Thu, 17 Sep 2020 09:23:14 UTC +" Last updated: Fri, 18 Sep 2020 09:04:53 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -1346,7 +1346,7 @@ nnoremap g \ :echo expand('%:p') "" Leader,G changes directory to the current file’s location nnoremap G - \ :cd %:hpwd + \ :cd %:h pwd "" Leader,P creates the path to the current file if it doesn’t exist nnoremap P \ :call mkdir(expand('%:h'), 'p') -- cgit v1.2.3 From e1c306f3be22621900ac85a8ba191d03deec909b Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Fri, 18 Sep 2020 21:33:21 +1200 Subject: Bump VERSION --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index ad615fe6..f3adc0f3 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -tejr dotfiles v10.8.0 -Mon, 14 Sep 2020 02:30:21 +0000 +tejr dotfiles v10.9.0 +Fri, 18 Sep 2020 09:33:21 +0000 -- cgit v1.2.3