2
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

For the PHPFunctionList above, two lines in function body confused me.

set dictionary-=/etc/vim/php_funclist.txt dictionary+=/etc/vim/php_funclist.txt    
set complete-=k complete+=k 

For the two lines ,first -= to remove it and then += to add it again.

Why can't write the two lines just += in them?

set dictionary+=/etc/vim/php_funclist.txt    
set complete+=k 

Are there any differences between them?
:h set-= point out that When the option is a list of flags, {value} must be exactly as they appear in the option. Remove flags one by one to avoid problems.
To avoid which problem?

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
showkey
  • 482
  • 42
  • 140
  • 295

1 Answers1

6

In vim doc :

:h :set+=

and

:h :set-=

has explained the usage clearly. basically the += will append an element to the option, and -= will substract the value from the option.

Kent
  • 189,393
  • 32
  • 233
  • 301