Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM : What is the difference between let g: , let b: , etc

Tags:

vim

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 ?

like image 916
arthropode Avatar asked Mar 28 '13 15:03

arthropode


People also ask

What let G means?

l: local to a function. g: global. :help internal-variables. Follow this answer to receive notifications.

What is let in Vim?

It can assign a value to. a variable, e.g. let vi = 'vim' an option, e.g. let &tw = 40. a register, e.g. let @a = $HOME . '/vimfiles'

What is echo in Vim?

Plain old :echo will print output, but it will often disappear by the time your script is done. Using :echom will save the output and let you run :messages to view it later.

How do I run a script in vim?

You can always execute Vimscript by running each command in command mode (the one you prefix with : ), or by executing the file with commands using a :source command. Historically, Vim scripts have a . vim extension. Here, :so is a short version of :source , and % refers to the currently open file.


1 Answers

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. 
like image 199
Xymostech Avatar answered Oct 13 '22 04:10

Xymostech