下面是一个例子:a:arg在vimscript中的含义是什么?
function! Mynumber(arg)
echo line(".") . " " . a:arg
endfunction
当1,3call Mynumber(getline("."))
,它打印的行号,并且每个所述第一三线电流缓冲器中的。
下面是一个例子:a:arg在vimscript中的含义是什么?
function! Mynumber(arg)
echo line(".") . " " . a:arg
endfunction
当1,3call Mynumber(getline("."))
,它打印的行号,并且每个所述第一三线电流缓冲器中的。
变量的前缀a:
表示该变量属于它所在函数的参数列表(参数)。
也:help internal-variables
There are several name spaces for variables. Which one is to be used is
specified by what is prepended:
(nothing) In a function: local to a function; otherwise: global
buffer-variable b: Local to the current buffer.
window-variable w: Local to the current window.
tabpage-variable t: Local to the current tab page.
global-variable g: Global.
local-variable l: Local to a function.
script-variable s: Local to a :source'ed Vim script.
function-argument a: Function argument (only inside a function).
vim-variable v: Global, predefined by Vim.
请参阅“当你写一个Vimscript中的函数,它始终需要加拨这些参数的参数:当您使用它们让Vim知道他们在争论范围。 “ (强烈推荐阅读):http://learnvimscriptthehardway.stevelosh.com/chapters/24.html
':h function-argument' – FDinoff