I am learning to use VIM to write Python code. Frequently, I need to perform replacements that include metacharacters, e.g. replacing all instances of '2**NN' with 'MM'. How can I achieve this?
In order to match a literal *, you can escape the *
metacharacter with backslashes:
:%s/2\*\*NN/MM
See the user manual for an introduction to Vim's search/replace functionality:
:h usr_27.txt
The reference manual contains more detailed information on Vim's regular expressions:
:h regexp