VIM search and replace whole word starting with dollar -
how can search , replace whole words starting dollar sign ($) in vim?
i know \<word\>
matches whole word , \$
escapes dollar sign regular search , replace, using \<\$word\>
or \$word\>
results in "e486: pattern not found"
that's explained. $
not keyword character, assertion \<
provides ("match @ start of [key]word") cannot fulfilled.
you can add together $
(for current buffer) via
:setlocal iskeyword+=$
but affects motions , may break syntax highlighting. improve drop regexp assertion; \$word\>
should suffice. if need assert there's whitespace before it: \s\@<!\$word\>
search vim replace escaping
No comments:
Post a Comment