I'm confused about these in VIM. Some things need set and others let. And, how can I check for a certain option. I know it's an option because I use set to change it.
For example, how do I check if current filetype option is java?
Options
All these options change Vim's behaviour in one way or another.
Many of them are to be used to customize your Vim: you can set how to handle backup files, how to manage text, whether to display the menu and the toolbar, and a bunch of other things.
Several options are local to the buffer or window; they specify for example which syntax highlight and indentation should be used on a buffer.
The :set
command can be used to set and print the value of an option, see :help :set
.
You get the list of all options with a one-line description if you type :h option-list
.
You get the list of all options with their long description if you type :h option-summary
.
Internal variables
Internal variables are different things: they are like variables in a program.
You can create or destroy a variable at any time.
They won't affect Vim's behaviour by themselves, only via Vim scripts (e.g. Vim plugins and your .vimrc file) that can read (and modify) their value and do different things based on it.
There are several kinds of internal variables: global variables, local variables, and a few others.
They are described in :h internal-variables
.
They are evaluated in expressions (:h expression
), and
they can be set and removed using the let
(:h :let
) and unlet
(:h :unlet
) commands.
Variables in an extended sense
There are other objects that behave like variables but are not internal variables.
They are also evaluated in expressions, and their value can be set using the let
command; but they cannot be removed.
There are three types of variables beside internal: environment variables (:h :let-environment
), register variables (:h let-register
) and option variables (:h let-option
).
All of them have a prefix so that they can be distinguished from internal variables and from each other.
Environmental variables are prefixed with $
, register variables with @
, and option variables with &
.
These variables point to somewhere (to a real environment variable, a register or an option), and when their value is read or set in a script or by the user, actually the value of the "real thing" is read or set.
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