Avoid the need to escape parenthesis, brackets… in vim regexes

Sat, 2009-01-17

Vim has a so called “very magic” mode for regexes which allows you to use parenthesis, brackets, the alternative separator (i.e. ‘|’), pluses, etc. with their special meaning but without the need to escape those characters.

(see :help /\v)


Let’s say you have the following in your buffer:


If you execute


you will get


but it required a lot of backslash escaping in the regex. You can avoid the need to escape parenthesis, curly braces, pluses, etc. using vim’s “very magic” mode for regexes. The following would do exactly the same as the previous substitution command but with fewer escaping required:


Turn off regular expression search in less

Tue, 2008-10-14

You can disable regular expression search in less by hitting ctrl+r after you have hit /

Very handy when searching for character like $, *, [, ], …