VIM find and replace whole word starting with dollar
1 answer
This is easily explained. $
is usually not a keyword character, so a statement that \<
provides ("match at the beginning of [keyword]" cannot be met.
You can add $
(for the current buffer) via
:setlocal iskeyword+=$
but it also affects movement and may even break syntax highlighting. Better to just drop the regex assertion; \$word\>
should be enough. If you need to assert that there are only spaces before it:\S\@<!\$word\>
+5
source to share