Vimscript: let g: ,let b: ,等等之间的区别是什么?

我经常在 vim 中看到这样的插件:

let g:variable
let b:variable
let l:variable

我花了很长时间研究 vim 的文档,还有网上关于这些字母‘ g’,‘ b’,‘ l’的资料,但是我什么都没找到。

那么这些字母对应的是什么? 完整的字母列表是什么?

23670 次浏览

b: local to the current buffer

l: local to a function

g: global

:help internal-variables

See :help internal-variables

It lists the following types:

(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.