O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

No magic

This mode is similar to magic mode, but every special character needs to be escaped with a backslash, \.

For example, in default magic mode, you'd search for a line containing any text with /^.*$ (here, ^ is for beginning of line, .* searches for every character repeatedly, and $ is for end of line). However, in no magic mode, you'd have to escape each one of those: /\^\.\*\$.

You can explicitly set no magic mode by prefixing your regex strings with \M (for example, /\Mfoo or :s/\Mfoo/bar). No magic can be also set in your .vimrc by adding set nomagic, but it's highly discouraged: by changing the way Vim treats regular expressions, you're more than likely to break several plugins you're using (as their creators will not have built ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required