René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Variables in vim | ||||||||||||||||||||
... yet to be finished ...
Arraysfunction! ArrayTest() let i_{1} = "one" let i_{2} = "two" let i_{3} = "three" let j = 1 while j<=3 echo "i_{".j."} = " i_{j} let j=j+1 endwhile endfunction
See also vim's help (
:help curly-braces-names ) for more details.
Interpolated variableslet a='foo' let b='bar' let cfoo='hello' let cbar='bye' echo c{a} echo c{b}
This prints
hello followed by bye .
Prefixes
Variables can be prefixed with a letter and a colon. Vim doco calls these name spaces for variables
If a function is declared with range, the the special variables a:firstline and a:lastline give
the numbers where the selection starts and ends.
Additionally, the value of an option can be set/gotten by preceding the option name with a & (For example
&shell
or &term ).
The value of environment variables can be gotten by preceding the variable's name with a $ (For example
$VIM ).
@/ is the value of the last search pattern. This value can be
assigned to.
Variables with a meaning to vimEnvironment variables
global variables
Saving variables accross sessions
If the viminfo option has the !, the global variables with upper case letters will be stored in the viminfo file.
If the sessionoptions option has the global flag, then global variables starting with an upper case letter will be stored in the
sessionfile.
|