I have a following line:

   <a href="/episodes/show-invisibles/"> Show invisibles: http://vimcasts.org/episodes/show-invisibles/

..and I have a :s/\v^[^\>]+\>\s//g substitution command which changes this line to:

Show invisibles: http://vimcasts.org/episodes/show-invisibles/

As I understand the regular expression of this substitution, then ^[^\>]+\>\s part will match one or more whatever character(except >) from the beginning of the line until > and whitespace character appear. However, why is the \v needed? According to vim manual:

Use of "\v" means that in the pattern after it all ASCII characters except
'0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning.  "very magic"

However, why is this needed in this particular case?

  • [^\>] means except '\' and '>', even with \v.
    – Antony
    Aug 5, 2016 at 11:24

1 Answer 1


In this particular case, using \v doesn't make much difference


is perhaps cleaner than using the very magic modifier

Consider swapping two words:

s/\(\w\+\) \(\w\+\)/\2 \1/

With \v it is much cleaner and readable

s/\v(\w+) (\w+)/\2 \1/

So, it might be a habit to always use \v and it is closer to regular expression syntax used in perl, sed -r, awk etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.