I like Vim’s digraph feature but I find the number of default digraphs overwhelming. Is there a way to clear all of these so that the only digraph definitions are the ones that I created myself (e.g. in my vimrc)?
1 Answers
Ideally, you should be able to unset a digraph with the digraph_set() function, passing the empty string as its second argument, like this:
:call digraph_set("gx", "")
But that only seems to work on user-defined digraphs, and not on Vim's default digraphs. And you asked about removing the default digraphs.
(Note that if I redefine a default digraph, and then redefine it again to an empty string, it seems to revert back to Vim's default definition.)
If all you want to do is see the digraphs that you define, you can see them with this command:
:echo digraph_getlist()
You'll see only your user-defined digraphs. (As opposed to the :digraphs command, which shows them all.)
But if your goal is to remove the default digraphs entirely so that you don't accidentally enter them as you're typing as normal, then you need a different approach.
If that's the case, I found a work-around that might work for you. Try this command and see if it works for you:
:for d in digraph_getlist(1) | call digraph_set(d[0], d[0][1]) | endfor
What this does is take every character-pair (both default and user-defined) and redefine it to be its second character, effectively nullifying the digraph.
For example, if you enter the character pair i:, instead of replacing it with ï, it will be replaced with :, essentially making the digraph a no-op.
Whichever digraphs you define after that will be the ones that have a real effect.
- 131
- 3
:Digraphscommand. – Christian Brabandt May 12 '18 at 19:28