When searching or writing macros in Vim, it's sometimes helpful to have a search position your cursor at the end of the matching term rather than the beginning. You can use the start of match atom to accomplish this.
/some term\zs
This would match "some term" and position your cursor at the end of the match. See (help :regexp) for other atoms and general regexp goodness.
Thanks to Chris Sutter for contributing this tip.
Subscribe to:
Post Comments (Atom)
1 comment:
An alternative way to do this is:
/some term/e
This will leave the cursor on the final character of the term (as opposed to after it, with your version).
It has the advantage that, if you're using hlsearch, the search term will be highlighted, rather than the character following.
Post a Comment