au FileType php call PHPFuncList()
function PHPFuncList()
set dictionary-=/etc/vim/php_funclist.txt dictionary+=/etc/vim/php_funclist.txt
set complete-=k complete+=k
endfunction
Run Code Online (Sandbox Code Playgroud)
对于上面的 PHPFunctionList,函数体中的两行让我很困惑。
set dictionary-=/etc/vim/php_funclist.txt dictionary+=/etc/vim/php_funclist.txt
set complete-=k complete+=k
Run Code Online (Sandbox Code Playgroud)
对于这两行,首先-=将其删除,然后+=再次添加。
为什么不能只+=在其中写两行?
set dictionary+=/etc/vim/php_funclist.txt
set complete+=k
Run Code Online (Sandbox Code Playgroud)
它们之间有什么区别吗?
:h set-=指出,当该选项是标志列表时,{value}必须完全在选项中显示。一一移除标志以避免出现问题。
避免哪个问题?
在 vim 文档中:
:h :set+=
Run Code Online (Sandbox Code Playgroud)
和
:h :set-=
Run Code Online (Sandbox Code Playgroud)
已经清楚地解释了用法。基本上,+=将向选项附加一个元素,并-=从选项中减去该值。