以下是来自 vim 插件的 vim 脚本:
vim 的语法有点奇怪:
!exists("*s:SetVals")
,为什么他们之前是一个starmarks:
?- 函数!,为什么有一个
!
字符? &iskeyword
,这是一个变量,如果是,它是在哪里定义的?s:
和是什么g:
,它们之间有什么区别?- 为什么应该使用 let ?比如
let &dictionary = g:pydiction_location
,我可以把它改成这样&dictionary = g:pydiction_location
吗?
如果 !exists("*s:SetVals")
function! s:SetVals() " Save and change any config values we need. " Temporarily change isk to treat periods and opening " parenthesis as part of a keyword -- so we can complete " python modules and functions: let s:pydiction_save_isk = &iskeyword setlocal iskeyword +=.,( " Save any current dictionaries the user has set: let s:pydiction_save_dictions = &dictionary " Temporarily use only pydiction's dictionary: let &dictionary = g:pydiction_location " Save the ins-completion options the user has set: let s:pydiction_save_cot = &completeopt " Have the completion menu show up for one or more matches: let &completeopt = "menu,menuone" " Set the popup menu height: let s:pydiction_save_pumheight = &pumheight if !exists('g:pydiction_menu_height') let g:pydiction_menu_height = 15 endif let &pumheight = g:pydiction_menu_height return '' endfunction
万一