The vim * star / asterisk search (:help star) is a great feature which lets you find the next occurrence of the word the cursor is over. Unfortunately it treats dollar-prefixes as part of the string, so if I press * while over the ‘SearchTerm’ in the class name it finds ‘SearchTerm’ in the comment, and ‘$this->SearchTerm’, but not ‘$SearchTerm’:
class SearchTerm { /* do something with SearchTerm */ var $SearchTerm; function DoStuff() { return $this->SearchTerm; } }
Is there a way of telling star search to ignore the $-prefix?
Just to expand on Haes answer:
I needed to remove $ from iskeyword
:set iskeyword # iskeyword=@,48-57,_,192-255,$ :set iskeyword-=$ # remove the $ as an acceptable word character
Actually using vim 7.2 on Mac, star search exactly works as you would like it to do.
EDIT: Check what your ‘iskeyword’ (:set iskeyword) is set to because star search is based on this option to find the word search term.
Alternatively, you could could use ‘g*’ (:help gstar) to get a partial search for the word the cursor is over.
Hope this helps somehow.