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 ?
l: local to a function. g: global. :help internal-variables. Follow this answer to receive notifications.
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'
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With