Vimscript : What is the difference between let g: , let b: , etc.?

Vim

Vim Problem Overview


I often see in vim plugin something like these :

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

I made a long research on the vim documentation and on the Internet about these letters 'g', 'b', 'l', but I found noting.

So what is these letters corresponding to ? And what is the complete list of letters ?

Vim Solutions


Solution 1 - Vim

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.

Solution 2 - Vim

b: local to the current buffer

l: local to a function

g: global

:help internal-variables

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionarthropodeView Question on Stackoverflow
Solution 1 - VimXymostechView Answer on Stackoverflow
Solution 2 - VimEHuhtalaView Answer on Stackoverflow