When doing search/replace in vim, I almost never need to use regex, so it\'s a pain to constantly be escaping everything, Is there a way to make it default to not using regex or
The problem is primarily caused by confusion about the role of the &
in the replacement string. The replacement string is not a reg-ex, although it has some special characters, like &
. You can read about role of &
in replacement string here: :h sub-replace-special
.
I suspect the main problem for OP is not necessarily typing the extra backslashes, but rather remembering when a backslash is needed and when not. One workaround may be to start making use of "replacement expressions" when unsure. ( See :h sub-replace-expression
.) This requires putting a `\=' in replacement string but for some people it may give you more natural control over what's being substituted, since putting a string literal in single quotes will give you the replacement string you want. For example, this substitute does what OP wants:
:s/\='<'/g