helpers: move rawType to helpers.nixvimTypes (#871)

This is done in preparation of adding new (lua) types to help the
documentation.
This commit is contained in:
traxys 2024-01-01 23:33:53 +01:00 committed by GitHub
parent 2f13e3a21d
commit af41ea2d80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 80 additions and 75 deletions

View file

@ -40,7 +40,7 @@ in rec {
A textual description of this autocommand. A textual description of this autocommand.
''; '';
callback = helpers.mkNullOrOption (with types; either str helpers.rawType) '' callback = helpers.mkNullOrOption (with types; either str helpers.nixvimTypes.rawLua) ''
A function or a string. A function or a string.
- if a string, the name of a Vimscript function to call when this autocommand is triggered. - if a string, the name of a Vimscript function to call when this autocommand is triggered.
- Otherwise, a Lua function which is called when this autocommand is triggered. - Otherwise, a Lua function which is called when this autocommand is triggered.

View file

@ -141,7 +141,7 @@ with lib; rec {
); );
defaultNullOpts = let defaultNullOpts = let
maybeRaw = t: lib.types.either t rawType; maybeRaw = t: lib.types.either t nixvimTypes.rawLua;
in rec { in rec {
mkNullable = type: default: desc: mkNullable = type: default: desc:
mkNullOrOption type ( mkNullOrOption type (
@ -404,13 +404,18 @@ with lib; rec {
end end
''; '';
rawType = mkOptionType { nixvimTypes =
{
rawLua = mkOptionType {
name = "rawType"; name = "rawType";
description = "raw lua code"; description = "raw lua code";
descriptionClass = "noun"; descriptionClass = "noun";
merge = mergeEqualOption; merge = mergeEqualOption;
check = isRawType; check = isRawType;
}; };
}
# Allow to do `with nixvimTypes;` instead of `with types;`
// types;
isRawType = v: lib.isAttrs v && lib.hasAttr "__raw" v && lib.isString v.__raw; isRawType = v: lib.isAttrs v && lib.hasAttr "__raw" v && lib.isString v.__raw;
} }

View file

@ -15,7 +15,7 @@ with lib; let
nargs = helpers.mkNullOrOption (types.enum ["0" "1" "*" "?" "+"]) '' nargs = helpers.mkNullOrOption (types.enum ["0" "1" "*" "?" "+"]) ''
The number of arguments to expect, see :h command-nargs. The number of arguments to expect, see :h command-nargs.
''; '';
complete = helpers.mkNullOrOption (with types; either str helpers.rawType) '' complete = helpers.mkNullOrOption (with types; either str helpers.nixvimTypes.rawLua) ''
Tab-completion behaviour, see :h command-complete. Tab-completion behaviour, see :h command-complete.
''; '';
range = helpers.mkNullOrOption (with types; oneOf [bool int (enum ["%"])]) '' range = helpers.mkNullOrOption (with types; oneOf [bool int (enum ["%"])]) ''

View file

@ -13,7 +13,7 @@ with lib; let
# Raw filetype # Raw filetype
str str
# Function to set the filetype # Function to set the filetype
helpers.rawType helpers.nixvimTypes.rawLua
# ["filetype" {priority = xx;}] # ["filetype" {priority = xx;}]
(listOf (either str (submodule { (listOf (either str (submodule {
options = { options = {

View file

@ -121,7 +121,7 @@ in {
with types; with types;
either either
(enum ["none" "ordinal" "buffer_id" "both"]) (enum ["none" "ordinal" "buffer_id" "both"])
helpers.rawType helpers.nixvimTypes.rawLua
) )
"none" "none"
'' ''

View file

@ -70,7 +70,7 @@ in {
filetypes = filetypes =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; attrsOf (either bool helpers.rawType)) (with types; attrsOf (either bool helpers.nixvimTypes.rawLua))
'' ''
{ {
yaml = false; yaml = false;

View file

@ -123,7 +123,7 @@ in {
( (
with types; with types;
either either
helpers.rawType helpers.nixvimTypes.rawLua
(enum (attrNames snippetEngines)) (enum (attrNames snippetEngines))
) )
'' ''

View file

@ -31,7 +31,7 @@ in {
By default the `VIRTUAL_ENV` and `CONDA_PREFIX` environment variables are used if present. By default the `VIRTUAL_ENV` and `CONDA_PREFIX` environment variables are used if present.
''; '';
testRunner = helpers.mkNullOrOption (types.either types.str helpers.rawType) '' testRunner = helpers.mkNullOrOption (types.either types.str helpers.nixvimTypes.rawLua) ''
The name of test runner to use by default. The name of test runner to use by default.
The default value is dynamic and depends on `pytest.ini` or `manage.py` markers. The default value is dynamic and depends on `pytest.ini` or `manage.py` markers.
If neither is found "unittest" is used. If neither is found "unittest" is used.

View file

@ -99,7 +99,7 @@ in {
( (
types.either types.either
(types.enum ["name" "case_sensitive" "modification_time" "extension"]) (types.enum ["name" "case_sensitive" "modification_time" "extension"])
helpers.rawType helpers.nixvimTypes.rawLua
) )
"name" "name"
'' ''
@ -317,7 +317,7 @@ in {
onAttach = onAttach =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either (enum ["default"]) helpers.rawType) (with types; either (enum ["default"]) helpers.nixvimTypes.rawLua)
"default" "default"
'' ''
Function ran when creating the nvim-tree buffer. Function ran when creating the nvim-tree buffer.
@ -378,7 +378,7 @@ in {
padding = padding =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(either ints.unsigned helpers.rawType) (either ints.unsigned helpers.nixvimTypes.rawLua)
"1" "1"
"Extra padding to the right."; "Extra padding to the right.";
}; };
@ -466,7 +466,7 @@ in {
rootFolderLabel = rootFolderLabel =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
# Type # Type
(with types; oneOf [str bool helpers.rawType]) (with types; oneOf [str bool helpers.nixvimTypes.rawLua])
# Default # Default
":~:s?$?/..?" ":~:s?$?/..?"
# Description # Description
@ -740,7 +740,7 @@ in {
picker = picker =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.either types.str helpers.rawType) (types.either types.str helpers.nixvimTypes.rawLua)
"default" "default"
'' ''
Change the default window picker, can be a string `"default"` or a function. Change the default window picker, can be a string `"default"` or a function.

View file

@ -20,7 +20,7 @@ with lib; {
''; '';
actionCallback = actionCallback =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.rawType) helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
"copy_to_clipboard" "copy_to_clipboard"
'' ''
Callback for what to do with the url. Callback for what to do with the url.
@ -47,7 +47,7 @@ with lib; {
( (
either either
str str
helpers.rawType helpers.nixvimTypes.rawLua
) )
) )
'' ''

View file

@ -40,7 +40,7 @@ with lib; let
}; };
args = { args = {
type = listOf (either str helpers.rawType); type = listOf (either str helpers.nixvimTypes.rawLua);
description = '' description = ''
List of arguments. List of arguments.
Can contain functions with zero arguments that will be evaluated once the linter is used. Can contain functions with zero arguments that will be evaluated once the linter is used.
@ -229,7 +229,7 @@ in {
callback = mkOption { callback = mkOption {
type = with types; type = with types;
nullOr (either str helpers.rawType); nullOr (either str helpers.nixvimTypes.rawLua);
default = defaultCallback; default = defaultCallback;
description = "What action to perform for linting"; description = "What action to perform for linting";
}; };

View file

@ -63,7 +63,7 @@ in {
rootDir = rootDir =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.either types.str helpers.rawType) (types.either types.str helpers.nixvimTypes.rawLua)
''{ __raw = "require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'})"; }'' ''{ __raw = "require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'})"; }''
'' ''
This is the default if not provided, you can remove it. Or adjust as needed. This is the default if not provided, you can remove it. Or adjust as needed.

View file

@ -22,7 +22,7 @@ with lib; {
with types; with types;
attrsOf ( attrsOf (
either either
helpers.rawType helpers.nixvimTypes.rawLua
(enum ["global" "local" "noop"]) (enum ["global" "local" "noop"])
) )
) )
@ -106,7 +106,7 @@ with lib; {
log = { log = {
file = file =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
'' ''
{ {
__raw = "vim.fn.stdpath('log') .. '/rainbow-delimiters.log'"; __raw = "vim.fn.stdpath('log') .. '/rainbow-delimiters.log'";

View file

@ -46,7 +46,7 @@ in
defaultConfig = defaultConfig =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; attrsOf (either str helpers.rawType)) (with types; attrsOf (either str helpers.nixvimTypes.rawLua))
"null" "null"
'' ''
Pre-filled prompt answer. Pre-filled prompt answer.

View file

@ -14,7 +14,7 @@ with lib; let
with types; with types;
oneOf [ oneOf [
str str
helpers.rawType helpers.nixvimTypes.rawLua
(listOf str) (listOf str)
(attrsOf (either str ints.unsigned)) (attrsOf (either str ints.unsigned))
] ]
@ -593,7 +593,7 @@ in {
path = path =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
''{__raw = "string.format('%s/fidget.nvim.log', vim.fn.stdpath('cache'))";}'' ''{__raw = "string.format('%s/fidget.nvim.log', vim.fn.stdpath('cache'))";}''
'' ''
Where Fidget writes its logs to. Where Fidget writes its logs to.

View file

@ -323,7 +323,7 @@ with lib; let
nullOr nullOr
( (
listOf listOf
(either str helpers.rawType) (either str helpers.nixvimTypes.rawLua)
); );
description = '' description = ''
An array of abosolute or workspace-relative paths that will be added to the workspace An array of abosolute or workspace-relative paths that will be added to the workspace

View file

@ -190,7 +190,7 @@ in {
miscFormatters = languageTools "misc" "formatters"; miscFormatters = languageTools "misc" "formatters";
mkChooseOption = lang: kind: possible: let mkChooseOption = lang: kind: possible: let
toolType = with types; either (enum possible) helpers.rawType; toolType = with types; either (enum possible) helpers.nixvimTypes.rawLua;
in in
mkOption { mkOption {
type = with types; either toolType (listOf toolType); type = with types; either toolType (listOf toolType);

View file

@ -357,7 +357,7 @@ in {
overrides = overrides =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.listOf (types.listOf
(types.oneOf [types.bool types.str helpers.rawType])) (types.oneOf [types.bool types.str helpers.nixvimTypes.rawLua]))
"[true]" "[true]"
'' ''
Specifies a list of alternate or supplemental command-line options. Specifies a list of alternate or supplemental command-line options.

View file

@ -51,7 +51,7 @@ in {
Default AI popup type. Default AI popup type.
''; '';
openaiApiKey = helpers.mkNullOrOption (with types; either str helpers.rawType) '' openaiApiKey = helpers.mkNullOrOption (with types; either str helpers.nixvimTypes.rawLua) ''
An alternative way to set your API key. An alternative way to set your API key.
''; '';

View file

@ -55,8 +55,8 @@ in {
helpers.mkNullOrOption helpers.mkNullOrOption
(oneOf [ (oneOf [
str str
helpers.rawType helpers.nixvimTypes.rawLua
(listOf (either str helpers.rawType)) (listOf (either str helpers.nixvimTypes.rawLua))
]) ])
"Post-install hook"; "Post-install hook";
@ -67,11 +67,11 @@ in {
"Luarocks dependencies"; "Luarocks dependencies";
config = config =
helpers.mkNullOrOption (either str helpers.rawType) helpers.mkNullOrOption (either str helpers.nixvimTypes.rawLua)
"Code to run after this plugin is loaded"; "Code to run after this plugin is loaded";
setup = setup =
helpers.mkNullOrOption (either str helpers.rawType) helpers.mkNullOrOption (either str helpers.nixvimTypes.rawLua)
"Code to be run before this plugin is loaded"; "Code to be run before this plugin is loaded";
cmd = cmd =
@ -98,8 +98,8 @@ in {
helpers.mkNullOrOption helpers.mkNullOrOption
(oneOf [ (oneOf [
str str
helpers.rawType helpers.nixvimTypes.rawLua
(listOf (either str helpers.rawType)) (listOf (either str helpers.nixvimTypes.rawLua))
]) ])
"Conditional test to load this plugin"; "Conditional test to load this plugin";

View file

@ -60,12 +60,12 @@ in {
[ [
str str
path path
helpers.rawType helpers.nixvimTypes.rawLua
(listOf (oneOf (listOf (oneOf
[ [
str str
path path
helpers.rawType helpers.nixvimTypes.rawLua
])) ]))
]); ]);
}; };
@ -122,12 +122,12 @@ in {
[ [
str str
path path
helpers.rawType helpers.nixvimTypes.rawLua
(listOf (oneOf (listOf (oneOf
[ [
str str
path path
helpers.rawType helpers.nixvimTypes.rawLua
])) ]))
] ]
) )

View file

@ -25,7 +25,7 @@ with lib; let
(submodule { (submodule {
options = { options = {
name = mkOption { name = mkOption {
type = types.either types.str helpers.rawType; type = types.either types.str helpers.nixvimTypes.rawLua;
description = "Component name or function"; description = "Component name or function";
default = defaultName; default = defaultName;
}; };

View file

@ -31,12 +31,12 @@ in {
theme = helpers.mkNullOrOption types.str "Custom theme, will use your global theme by default."; theme = helpers.mkNullOrOption types.str "Custom theme, will use your global theme by default.";
path = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "vim.loop.cwd()" '' path = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "vim.loop.cwd()" ''
Directory to browse files from. Directory to browse files from.
`vim.fn.expanded` automatically. `vim.fn.expanded` automatically.
''; '';
cwd = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "vim.loop.cwd()" '' cwd = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "vim.loop.cwd()" ''
Directory to browse folders from. Directory to browse folders from.
`vim.fn.expanded` automatically. `vim.fn.expanded` automatically.
''; '';
@ -131,7 +131,7 @@ in {
mappings = mappings =
helpers.mkNullOrOption ( helpers.mkNullOrOption (
with types; with types;
attrsOf (attrsOf (either str helpers.rawType)) attrsOf (attrsOf (either str helpers.nixvimTypes.rawLua))
) '' ) ''
`fb_actions` mappings. `fb_actions` mappings.
Mappings can also be a lua function. Mappings can also be a lua function.

View file

@ -32,7 +32,7 @@ in {
executionMessage = { executionMessage = {
message = message =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
'' ''
{ {
__raw = \'\' __raw = \'\'

View file

@ -32,7 +32,7 @@ in {
rootDir = rootDir =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
"{__raw = \"vim.fn.stdpath 'data' .. '/sessions/'\";}" "{__raw = \"vim.fn.stdpath 'data' .. '/sessions/'\";}"
'' ''
Root directory for session files. Root directory for session files.
@ -128,7 +128,7 @@ in {
sessionControl = { sessionControl = {
controlDir = controlDir =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
"\"vim.fn.stdpath 'data' .. '/auto_session/'\"" "\"vim.fn.stdpath 'data' .. '/auto_session/'\""
'' ''
Auto session control dir, for control files, like alternating between two sessions Auto session control dir, for control files, like alternating between two sessions

View file

@ -39,7 +39,7 @@ in {
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
( (
with types; with types;
either str helpers.rawType either str helpers.nixvimTypes.rawLua
) )
"<ESC>" "<ESC>"
'' ''

View file

@ -34,7 +34,7 @@ in {
mode = mode =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either (enum ["exact" "search" "fuzzy"]) helpers.rawType) ''"exact"'' '' (with types; either (enum ["exact" "search" "fuzzy"]) helpers.nixvimTypes.rawLua) ''"exact"'' ''
- exact: exact match - exact: exact match
- search: regular search - search: regular search
- fuzzy: fuzzy search - fuzzy: fuzzy search
@ -48,7 +48,7 @@ in {
incremental = helpers.defaultNullOpts.mkBool false "behave like `incsearch`"; incremental = helpers.defaultNullOpts.mkBool false "behave like `incsearch`";
exclude = exclude =
helpers.defaultNullOpts.mkNullable (with types; listOf (either str helpers.rawType)) '' helpers.defaultNullOpts.mkNullable (with types; listOf (either str helpers.nixvimTypes.rawLua)) ''
[ [
"notify" "notify"
"cmp_menu" "cmp_menu"

View file

@ -126,7 +126,7 @@ in {
options = { options = {
message = lib.mkOption { message = lib.mkOption {
description = "Hint message to be displayed."; description = "Hint message to be displayed.";
type = helpers.rawType; type = helpers.nixvimTypes.rawLua;
}; };
length = lib.mkOption { length = lib.mkOption {

View file

@ -157,7 +157,7 @@ with import ../helpers.nix {inherit lib;};
Default: `{__raw = "vim.fn.stdpath('data')..'/molten'";}` Default: `{__raw = "vim.fn.stdpath('data')..'/molten'";}`
''; '';
type = with types; either str rawType; type = with nixvimTypes; either str rawLua;
}; };
useBorderHighlights = mkDefaultOpt { useBorderHighlights = mkDefaultOpt {

View file

@ -166,7 +166,7 @@ in {
( (
either either
str str
helpers.rawType helpers.nixvimTypes.rawLua
) )
) )
'' ''

View file

@ -21,11 +21,11 @@ in {
timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 "Default timeout for notification."; timeout = helpers.defaultNullOpts.mkUnsignedInt 5000 "Default timeout for notification.";
maxWidth = helpers.mkNullOrOption (with types; either ints.unsigned helpers.rawType) '' maxWidth = helpers.mkNullOrOption (with types; either ints.unsigned helpers.nixvimTypes.rawLua) ''
Max number of columns for messages. Max number of columns for messages.
''; '';
maxHeight = helpers.mkNullOrOption (with types; either ints.unsigned helpers.rawType) '' maxHeight = helpers.mkNullOrOption (with types; either ints.unsigned helpers.nixvimTypes.rawLua) ''
Max number of lines for a message. Max number of lines for a message.
''; '';
@ -85,7 +85,7 @@ in {
with types; with types;
either either
(enum ["default" "minimal"]) (enum ["default" "minimal"])
helpers.rawType helpers.nixvimTypes.rawLua
) )
"default" "default"
"Function to render a notification buffer or a built-in renderer name."; "Function to render a notification buffer or a built-in renderer name.";

View file

@ -67,7 +67,7 @@ in {
package = helpers.mkPackageOption "oil" pkgs.vimPlugins.oil-nvim; package = helpers.mkPackageOption "oil" pkgs.vimPlugins.oil-nvim;
columns = let columns = let
highlightsOption = helpers.mkNullOrOption (with types; either str helpers.rawType) '' highlightsOption = helpers.mkNullOrOption (with types; either str helpers.nixvimTypes.rawLua) ''
A string or a lua function (`fun(value: string): string`). A string or a lua function (`fun(value: string): string`).
Highlight group, or function that returns a highlight group. Highlight group, or function that returns a highlight group.
''; '';

View file

@ -14,7 +14,7 @@ with lib; {
package = helpers.mkPackageOption "persistence.nvim" pkgs.vimPlugins.persistence-nvim; package = helpers.mkPackageOption "persistence.nvim" pkgs.vimPlugins.persistence-nvim;
dir = dir =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.rawType) helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")'' ''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")''
"directory where session files are saved"; "directory where session files are saved";

View file

@ -54,7 +54,7 @@ in {
buttons = buttons =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.either helpers.rawType (types.either helpers.nixvimTypes.rawLua
(types.listOf (types.submodule { (types.listOf (types.submodule {
options = { options = {
label = helpers.mkNullOrOption types.str ""; label = helpers.mkNullOrOption types.str "";
@ -99,49 +99,49 @@ in {
showTime = helpers.defaultNullOpts.mkBool true "Show the timer."; showTime = helpers.defaultNullOpts.mkBool true "Show the timer.";
# Rich presence text options. # Rich presence text options.
editingText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Editing %s" '' editingText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Editing %s" ''
String rendered when an editable file is loaded in the buffer. String rendered when an editable file is loaded in the buffer.
Can also be a lua function: Can also be a lua function:
`function(filename: string): string` `function(filename: string): string`
''; '';
fileExplorerText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Browsing %s" '' fileExplorerText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Browsing %s" ''
String rendered when browsing a file explorer. String rendered when browsing a file explorer.
Can also be a lua function: Can also be a lua function:
`function(file_explorer_name: string): string` `function(file_explorer_name: string): string`
''; '';
gitCommitText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Committing changes" '' gitCommitText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Committing changes" ''
String rendered when committing changes in git. String rendered when committing changes in git.
Can also be a lua function: Can also be a lua function:
`function(filename: string): string` `function(filename: string): string`
''; '';
pluginManagerText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Managing plugins" '' pluginManagerText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Managing plugins" ''
String rendered when managing plugins. String rendered when managing plugins.
Can also be a lua function: Can also be a lua function:
`function(plugin_manager_name: string): string` `function(plugin_manager_name: string): string`
''; '';
readingText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Reading %s" '' readingText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Reading %s" ''
String rendered when a read-only/unmodifiable file is loaded into the buffer. String rendered when a read-only/unmodifiable file is loaded into the buffer.
Can also be a lua function: Can also be a lua function:
`function(filename: string): string` `function(filename: string): string`
''; '';
workspaceText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Working on %s" '' workspaceText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Working on %s" ''
String rendered when in a git repository. String rendered when in a git repository.
Can also be a lua function: Can also be a lua function:
`function(project_name: string|nil, filename: string): string` `function(project_name: string|nil, filename: string): string`
''; '';
lineNumberText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.rawType) "Line %s out of %s" '' lineNumberText = helpers.defaultNullOpts.mkNullable (types.either types.str helpers.nixvimTypes.rawLua) "Line %s out of %s" ''
String rendered when `enableLineNumber` is set to `true` to display the current line number. String rendered when `enableLineNumber` is set to `true` to display the current line number.
Can also be a lua function: Can also be a lua function:

View file

@ -64,7 +64,7 @@ in {
dataPath = dataPath =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
''{__raw = "vim.fn.stdpath('data')";}'' ''{__raw = "vim.fn.stdpath('data')";}''
"Path where project.nvim will store the project history for use in telescope."; "Path where project.nvim will store the project history for use in telescope.";
}; };

View file

@ -77,7 +77,7 @@ in {
(listOf str) (listOf str)
) )
) )
helpers.rawType helpers.nixvimTypes.rawLua
# for "oldfiles" sections # for "oldfiles" sections
(enum [""]) (enum [""])
] ]

View file

@ -40,7 +40,7 @@ in {
storagePath = storagePath =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(with types; either str helpers.rawType) (with types; either str helpers.nixvimTypes.rawLua)
''{__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";}'' ''{__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";}''
"Only for sqlite storage."; "Only for sqlite storage.";
@ -70,7 +70,7 @@ in {
picker = { picker = {
select = { select = {
action = helpers.mkNullOrOption (with types; either helpers.rawType str) '' action = helpers.mkNullOrOption (with types; either helpers.nixvimTypes.rawLua str) ''
This define the action that should be done when selecting an item in the This define the action that should be done when selecting an item in the
`vim.ui.select` prompt. `vim.ui.select` prompt.
If you let this option to `null`, this will use the default action: put selected item If you let this option to `null`, this will use the default action: put selected item

View file

@ -62,7 +62,7 @@
# tool options are a `either toolType (listOf toolType)` # tool options are a `either toolType (listOf toolType)`
# Look into `nestedTypes.left` to get a `toolType` option. # Look into `nestedTypes.left` to get a `toolType` option.
toolType = opt.type.nestedTypes.left; toolType = opt.type.nestedTypes.left;
# toolType is a `either (enum possible) helpers.rawType # toolType is a `either (enum possible) helpers.nixvimTypes.rawLua
# Look into `nestedTypes.left` for the enum # Look into `nestedTypes.left` for the enum
possible = toolType.nestedTypes.left; possible = toolType.nestedTypes.left;
# possible is an enum, look into functor.payload for the variants # possible is an enum, look into functor.payload for the variants