I want to do some edits on each match during a global substitution operation.
I found this answer
:% s/re\(ge\)xp/\= myfunction(submatch(1))/gc.
But I don't have a function, just some keystrokes.
So how can I wrap a macro into myfunction to call during substitute?
Sample use: rot13(vselection) is g?, but rot13 is not a function in vim:
:%s,(re)(ge)(xp),\1\=rot13(submatch(2))\3,gc
I found a workaround by using the bash utils without using macros this answer.
%s/m\(atm\)ul/\=substitute(':' . system('echo '.submatch(1).'|tr A-Za-z N-ZA-Mn-za-m'),'\n','','g')/gc
interactively changes 'matmul' to ':ngz:'