I know that VIM support digraph, and it would be perfect if it's possible to use with :s
command, but I can't find a way to use it!
I think something like:
:%s/\([aeiouAEIOU]\)'/\=digraph(submatch(1)."!")/g
Would be perfect, but I didn't find a digraph
function.
Thanks in advance.
EDIT
Ok, after a bit of diggin in the built-in VIM's functions, I've found tr
and a first solution to the problem:
:%s/\([aeiouAEIOU]\)'/\=tr(submatch(1), 'aeiouAEIOU', 'àèìòùÀÈÌÒÙ')/g
However, I still want to know if there's a way to use digraph
in expressions :)
This function will allow you to generate any digraph you want.
It simulates typing
<c-k><char><char>
by running it with the normal command and assigning it to the local variable s. And then it returns s.After this function is defined and you can use it like this.
Note: This was based off of the source code for EasyDigraph