【发布时间】:2017-07-11 11:32:24
【问题描述】:
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
对于上面的PHPFunctionList,函数体中的两行让我很困惑。
set dictionary-=/etc/vim/php_funclist.txt dictionary+=/etc/vim/php_funclist.txt
set complete-=k complete+=k
对于这两行,首先 -= 删除它,然后 += 重新添加它。
为什么不能只写+=这两行呢?
set dictionary+=/etc/vim/php_funclist.txt
set complete+=k
它们之间存在差异吗?:h set-=指出,当该选项是标志列表时,{value}必须完全在选项中显示。逐一删除标志以避免出现问题。
避免出现什么问题?
【问题讨论】:
-
我猜开发者不明白
+=的工作原理,并使用-=来确保不会添加两次。
标签: vim completion