gpt4 book ai didi

vim - :arg mean in vimscript? 是什么

转载 作者:行者123 更新时间:2023-12-02 08:35:25 24 4
gpt4 key购买 nike

这是一个例子:

function! Mynumber(arg)
echo line(".") . " " . a:arg
endfunction

当您1,3调用 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.

关于vim - :arg mean in vimscript? 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22104287/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com