Skip to Content
Mastering Vim
book

Mastering Vim

by Ruslan Osipov
November 2018
Beginner
330 pages
7h 21m
English
Packt Publishing
Content preview from Mastering Vim

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).

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 them to work in no magic mode).

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Vim

Mastering Vim

Damian Conway
Vim Masterclass

Vim Masterclass

Jason Cannon
Modern Vim

Modern Vim

Drew Neil

Publisher Resources

ISBN: 9781789341096Supplemental Content