4 ms·
In addition to useful special characters in search pattern matching, vim can also do some excellent stuff in the second phrase of its substitution statements, a
by mcantor 17y ago
In addition to useful special characters in search pattern matching, vim can also do some excellent stuff in the second phrase of its substitution statements, as documented in sub-replace-special: http://vimdoc.sourceforge.net/htmldoc/change.html#sub-replace-special http://vimdoc.sourceforge.net/htmldoc/change.html#sub-replac...
I find \U, \L and \E to be most useful, for example:
:%s/ALL_CAPS_\(.*\)_HUZZAH/SOME_LOWERCASE_\L\1\E_HUZZAH/g
Will translate "ALL_CAPS_IS_GREAT_HUZZAH" to "SOME_LOWERCASE_is_great_HUZZAH". Super handy in certain situations.
It's also worth noting that these "magic" settings affect :s, :g, / and ?.