Table of contents
get
private.get-opt
private.get-var
private.set-opt-auto
private.set-opts-auto
private.set-var
private.set-vars
set
Function signature:
(get ...)
Macro -- Gets the value of an option or a variable
- Variable ->
(get scope variable)
- Option ->
(get option)
@scope: |string| ### The scope of the variable
@variables: |key/val table| ### The variables, where the key is the variable and val is the value
For b, w, and t scope, they can be indexed like (. b 1)
for their
Lua table equivalent. The other scopes can't take an index and will
return an error.
Function signature:
(private.get-opt option)
Macro -- Get an option's value
@option: |object| or |string| ### The option, can be written literally
Function signature:
(private.get-var scope variable)
Macro -- Get the value of a Vim variable
@scope: |string| ### The scope of the variable
@variables: |key/val table| ### The variables, where the key is the variable and val is the value
For b, w, and t scope, they can be indexed like (. b 1)
for their
Lua table equivalent. The other scopes can't take an index and will
return an error.
Function signature:
(private.set-opt-auto option value ?flag)
Macro -- Sets an option with auto scope
@option: |object| or |string| ### The option, can be written literally
@value: |any| ### The value of the option
@?flag(optional): |string| ### A flag (append, prepend, remove) for the option
Generally, set
from Vim will try to use the global scope for anything.
If you want a local scope you have to use setlocal
. This is generally
not particularly clean, as you then have to remember what is what kind of
scope. This macro fixes this by always preferring the local scope if available
but not restricting the use of global-only scoped options
(M.private.set-opt-auto spell true)
-> will set spell locally
(M.private.set-opt-auto mouse :nvi)
-> will set mouse globally
This macro is generally preferred when no specification is needed. However, since it sets local options its generally avoided for system wide configs.
Function signature:
(private.set-opts-auto options ?flag)
Macro -- Plural of set-opt-auto
@options: |key/val table| ### The options, where the key is the option and val is the value
@?flag(optional): |string| ### A flag (append, prepend, remove) for the option
Takes key-value table of options
Generally, set
from Vim will try to use the global scope for anything.
If you want a local scope you have to use setlocal
. This is generally
not particularly clean, as you then have to remember what is what kind of
scope. This macro fixes this by always preferring the local scope if available
but not restricting the use of global-only scoped options
(M.private.set-opt-auto spell true)
-> will set spell locally
(M.set-opt-auto mouse :nvi)
-> will set mouse globally
This macro is generally preferred when no specification is needed. However, since it sets local options its generally avoided for system wide configs.
Function signature:
(private.set-var scope variable value)
Macro -- Sets a Vim variable
@scope: |string| ### The scope of the variable
@variable: |object| or |string| ### The variable itself. Can be string or literal object
@value: |any| ### The value of the option
For b, w, and t scope, they can be indexed like (. b 1)
for their
Lua table equivalent. The other scopes can't take an index and will
return an error.
Function signature:
(private.set-vars scope variables)
Macro -- Plural of private.set-var for one scope
@scope: |string| ### The scope of the variable
@variables: |key/val table| ### The variables, where the key is the variable and val is the value
For b, w, and t scope, they can be indexed like (. b 1)
for their
Lua table equivalent. The other scopes can't take an index and will
return an error.
Function signature:
(set ...)
Macro -- Sets one or multiple options or variables
Since this macro supports 4 different modes of operation, plus a flag for the option settings, we need to handle all of those.
-
Single option ->
(set option value ?flag)
-
Multiple options ->
(set {option1 value option2 value} ?flag)
-
Single var ->
(set scope variable value)
-
Multiple vars ->
(set scope {var1 value var2 value})
@option: |object| or |string| ### The option, can be written literally
@value: |any| ### The value of the option
@?flag(optional): |string| ### A flag (append, prepend, remove) for the option
Generally, set
from Vim will try to use the global scope for anything.
If you want a local scope you have to use setlocal
. This is generally
not particularly clean, as you then have to remember what is what kind of
scope. This macro fixes this by always preferring the local scope if available
but not restricting the use of global-only scoped options
(M.set-opt-auto spell true)
-> will set spell locally
(M.set-opt-auto mouse :nvi)
-> will set mouse globally
@options: |key/val table| ### The options, where the key is the option and val is the value
@?flag(optional): |string| ### A flag (append, prepend, remove) for the option
Takes key-value table of options
Generally, set
from Vim will try to use the global scope for anything.
If you want a local scope you have to use setlocal
. This is generally
not particularly clean, as you then have to remember what is what kind of
scope. This macro fixes this by always preferring the local scope if available
but not restricting the use of global-only scoped options
(M.set-opt-auto spell true)
-> will set spell locally
(M.set-opt-auto mouse :nvi)
-> will set mouse globally
@scope: |string| ### The scope of the variable
@variable: |object| or |string| ### The variable itself. Can be string or literal object
@value: |any| ### The value of the option
For b, w, and t scope, they can be indexed like (. b 1)
for their
Lua table equivalent. The other scopes can't take an index and will
return an error.
@scope: |string| ### The scope of the variable
@variables: |key/val table| ### The variables, where the key is the variable and val is the value
For b, w, and t scope, they can be indexed like (. b 1)
for their
Lua table equivalent. The other scopes can't take an index and will
return an error.
License: Unlicense