以下是从vim插件中获取的vim脚本:
vim的语法有些奇怪:
1. !exists("*s:SetVals"),为什么s:前面有个星号?
2. function!,为什么有一个感叹号字符?
3. &iskeyword,这是一个变量吗?如果是,它在哪里定义?
4. s:和g:是什么,它们之间有什么区别?
5. 为什么应该使用let?例如let &dictionary = g:pydiction_location,我能否将其更改为&dictionary = g:pydiction_location?
if !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
endif
python
tag) - jedwards