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

Very magic

Very magic mode treats every character apart from letters, numbers, and underscores as a special character.

You can set very magic mode for a command by prefixing your regex strings with \v (for example, /\vfoo or :s/\vfoo/bar).

Very magic mode is often used when many special characters are to be used. For instance, we used the following example to replace cat hunting mice with mice hunting cat:

:s/\(cat\) hunting \(mice\)/\2 hunting \1

In very magic mode, this can be rewritten as follows:

:s/\v(cat) hunting (mice)/\2 hunting \1
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