= Options == Description Kakoune can store named and typed values that can be used both to customize the core editor behaviour, and to store data used by extension scripts. [[set-option]] Options can be modified using the `set-option` command: -------------------------------------------- set-option [-add] ... -------------------------------------------- can be *global*, *buffer*, *window* or *current* (See <>). *current* relates to the narrowest scope in which the option is already set. Multiple can be given as separate arguments when the option is a list or map. If `-add` is specified, the new value is *added* to the current one instead of replacing it (the exact outcome depends on the type, see below). [[unset-option]] Options values can be unset in a specific scope with the `unset-option` command: --------------------------- unset-option --------------------------- Unsetting an option will make it fallback to the value of its parent mode, hence options cannot be unset from the *global* scope. [[declare-option]] New options can be declared using the `declare-option` command: --------------------------------------------------- declare-option [-hidden] [...] --------------------------------------------------- If `-hidden` is specified, the option will not be displayed in completion suggestions. [[update-option]] Certain option type can be *updated*, usually to match potential changes in the buffer they relate to. This can be triggered by the `update-option` command: ---------------------------- update-option ---------------------------- == Types All options have a type, which defines how they are translated to/from text and their set of valid values. Some types are usable for user defined options while some other types are exclusively available to built-in options. *int*:: an integer number. `set -add` performs a math addition *bool*:: a boolean value, yes/true or no/false *str*:: a string, some freeform text *regex*:: as a string but the set commands will complain if the entered text is not a valid regex *coord*:: a line, column pair (separated by a comma) Cannot be used with `declare-option` *-list*:: a list, elements are specified as separate arguments to the command. `set -add` appends the new element to the list Only `int-list` and `str-list` options can be created with `declare-option`. *range-specs*:: a timestamp (like `%val{timestamp}`, see <>) followed by a list of range descriptors. Each range descriptor must use the syntax `a.b,c.d|string` or `a.b+length|string`, where _a_ is the line containing the first character, _b_ is the number of bytes from the start of the line to the first byte of the first character, _c_ is the line containing the last character, _d_ is the number of bytes from the start of the line to the first byte of the last character, _length_ is the length of the range in bytes and _string_ is an arbitrary string which is associated with the range. All numeric fields are 1-based. When the `update-option` is used on an option of this type, its ranges gets updated according to all the buffer modifications that happened since its timestamp. See <>) `set -add` appends the new pair to the list *line-specs*:: a list of a line number and a corresponding flag (`|`), except for the first element which is just the timestamp of the buffer. When the `update-option` is used on an option of this type, its lines gets updated according to all the buffer modifications that happened since its timestamp. See <>) `set -add` appends the new spec to the list *completions*:: a list of `|