下面是一個Vim插件一塊VIM腳本:如何理解這個vim腳本?
我應該說,vim的語法是有點奇怪:
!exists("*s:SetVals")
,爲什麼他們是s:
前STARMARK?- 功能!,爲什麼有一個!字符?
- & iskeyword,這是一個變量,如果是,它在哪裏定義?
- 什麼是
s:
和g:
,它們之間有什麼區別? - 爲什麼要使用?如
let &dictionary = g:pydiction_location
,我可以將其更改爲&dictionary = g:pydiction_location
?
如果存在!( 「* 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'標籤? –
@AshwiniChaudhary因爲python被這個腳本調用:) – hugemeow
它可能是Ruby或Perl或Lua,它與你的問題無關。 – romainl