My question might be silly since I'm a new vimscript user.
I need to define a variable as follows:
let foo = 1
"Implementing foo
:echo foo
Without success, I tried to increment my variable with the following syntaxes:
foo = foo + 1
++foo
foo++
foo+=1
I might miss something quite obvious, but I can't figure what.
I know about the <C-a>
shortcut but I'm searching for a syntactical way of doing things.
:let
command, so either:let foo = foo + 1
or:let foo += 1
will work. You don't need the:
if you're in a vimscript, only when typing commands from inside Vim itself.<C-a>
key binding is a Normal mode command, so it's not really related to Vim variables. It acts on the buffer contents instead.