In gvim: switching tabs with keyboard, Susam Pal gives an example usage of vim's helpgrep as:
:helpgrep \<next\ tab\>
My question is what exactly do the escaped angle brackets accomplish? How does this differ from :helpgrep next\ tab or :helpgrep next tab?
The special regular expression atoms \< and \> assert a (key)word boundary, what is frequently done with \b in other regular expression dialects.
Without it, next tab (no need to escape the space character BTW.) would also match inside nonext tabbing. As you often want to search for the whole word, not occurrences inside other words, this restricts the matches. (The * command does this for you, too.)
Okay, so a quick :help regexp and /\\< brought me to the answer:
ordinary atom ~
magic nomagic matches ~
...
|/\<| \< \< beginning of a word |/zero-width|
|/\>| \> \> end of a word |/zero-width|
Hopefully this is useful for someone...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With