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?

1 Answer 1


In order to match a literal *, you can escape the * metacharacter with backslashes:


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.