Vim的星号搜索(:help star)是一个很棒的功能,它可以让你找到光标所在单词的下一个出现位置。不幸的是,它把$前缀当作字符串的一部分,因此如果我在类名中的“SearchTerm”上按*键,则会在注释中找到“SearchTerm”和“$this->SearchTerm”,但不会找到“$SearchTerm”:
class SearchTerm
{
/* do something with SearchTerm */
var $SearchTerm;
function DoStuff()
{
return $this->SearchTerm;
}
}
有没有办法让Star Search忽略$前缀?
为了扩展Haes的答案:
我需要从iskeyword中删除$。
:set iskeyword # iskeyword=@,48-57,_,192-255,$
:set iskeyword-=$ # remove the $ as an acceptable word character