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(-) (limited to 'vim/vimrc') 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