plugins/utils: normalize plugin defaults

This commit is contained in:
Matt Sturgeon 2024-06-11 16:54:57 +01:00
parent b10a391bd0
commit 6ab2a39e6a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
53 changed files with 1434 additions and 1221 deletions

View file

@ -100,7 +100,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
window =
helpers.defaultNullOpts.mkAttrsOf types.anything
''
{
relative = "editor";
width = "auto";
@ -110,7 +109,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
style = "minimal";
border = "single";
}
''
''
Controls the appearance and position of an arrow window.
See `:h nvim_open_win()` for all options.
@ -161,7 +159,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Keys mapped to bookmark index.
'';
full_path_list = helpers.defaultNullOpts.mkListOf types.str ''[ "update_stuff" ]'' ''
full_path_list = helpers.defaultNullOpts.mkListOf types.str [ "update_stuff" ] ''
Filenames on this list will ALWAYS show the file path too
'';
};

View file

@ -31,16 +31,14 @@ in
executionMessage = {
message =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
''
helpers.defaultNullOpts.mkStr
{
__raw = \'\'
__raw = ''
function()
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end
\'\';
'';
}
''
''
The message to print en save.
This can be a lua function that returns a string.
@ -48,7 +46,7 @@ in
dim = helpers.defaultNullOpts.mkNullable (types.numbers.between 0
1
) "0.18" "Dim the color of `message`.";
) 0.18 "Dim the color of `message`.";
cleaningInterval = helpers.defaultNullOpts.mkInt 1250 ''
Time (in milliseconds) to wait before automatically cleaning MsgArea after displaying
@ -58,7 +56,11 @@ in
};
triggerEvents =
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["InsertLeave" "TextChanged"]''
helpers.defaultNullOpts.mkListOf types.str
[
"InsertLeave"
"TextChanged"
]
''
Vim events that trigger auto-save.
See `:h events`.

View file

@ -31,10 +31,7 @@ in
Whether to enable the "last session" feature.
'';
rootDir =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
"{__raw = \"vim.fn.stdpath 'data' .. '/sessions/'\";}"
''
rootDir = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath 'data' .. '/sessions/'"; } ''
Root directory for session files.
Can be either a string or lua code (using `{__raw = 'foo';}`).
'';
@ -91,7 +88,7 @@ in
};
})
)
"false"
false
''
Config for handling the DirChangePre and DirChanged autocmds.
Set to `false` to disable the feature.
@ -108,9 +105,10 @@ in
`require("auto-session").setup_session_lens()` if they want to use session-lens.
'';
themeConf =
helpers.defaultNullOpts.mkNullable types.attrs "{winblend = 10; border = true;}"
"Theme configuration.";
themeConf = helpers.defaultNullOpts.mkAttrsOf types.anything {
winblend = 10;
border = true;
} "Theme configuration.";
previewer = helpers.defaultNullOpts.mkBool false ''
Use default previewer config by setting the value to `null` if some sets previewer to
@ -123,8 +121,7 @@ in
sessionControl = {
controlDir =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
"\"vim.fn.stdpath 'data' .. '/auto_session/'\""
helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath 'data' .. '/auto_session/'"; }
''
Auto session control dir, for control files, like alternating between two sessions
with session-lens.

View file

@ -35,7 +35,7 @@ in
'';
options = {
disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str ''["text"]'' ''
disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str [ "text" ] ''
The plugin will be disabled under the filetypes in this table.
'';

View file

@ -153,14 +153,14 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Whether to enable automatically on `BufEnter`.
'';
filetypes = helpers.defaultNullOpts.mkListOf types.str "[]" ''
filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
File types for which highlighting is enabled.
It is only used for automatic highlighting by `ccc-option-highlighter-auto-enable`, and is
ignored for manual activation.
An empty table means all file types.
'';
excludes = helpers.defaultNullOpts.mkListOf types.str "[]" ''
excludes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Used only when `ccc-option-highlighter-filetypes` is empty table.
You can specify file types to be excludes.
'';

View file

@ -37,7 +37,9 @@ let
]
) "img" "Dir that will be inserted into text/buffer.";
imgName = helpers.defaultNullOpts.mkStr ''{__raw = "function() return os.date('%Y-%m-%d-%H-%M-%S') end";}'' "Image's name.";
imgName = helpers.defaultNullOpts.mkStr {
__raw = "function() return os.date('%Y-%m-%d-%H-%M-%S') end";
} "Image's name.";
imgHandler = helpers.defaultNullOpts.mkLuaFn "function(img) end" ''
Function that will handle image after pasted.

View file

@ -64,7 +64,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
};
})
''
[
{
@ -73,7 +72,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
replace = null;
}
]
''
''
List of pattern configurations.
'';

View file

@ -203,12 +203,10 @@ helpers.neovim-plugin.mkNeovimPlugin config {
};
})
)
''
{
basic = true;
extra = true;
}
''
''
Enables keybindings.
NOTE: If given 'false', then the plugin won't create any mappings.

View file

@ -41,7 +41,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
type = str;
description = "Command to execute";
};
args = helpers.defaultNullOpts.mkListOf types.str "[]" ''
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Arguments to the command.
'';
};
@ -66,7 +66,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
type = str;
description = "Command to execute.";
};
args = helpers.defaultNullOpts.mkListOf types.str "[]" ''
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Arguments to the command.
'';
};

View file

@ -81,53 +81,53 @@ in
commands = helpers.defaultNullOpts.mkBool true "If true, create commands.";
highlights = {
covered =
helpers.defaultNullOpts.mkNullable types.attrs ''{fg = "#B7F071";}''
"Highlight group for covered signs.";
covered = helpers.defaultNullOpts.mkAttributeSet {
fg = "#B7F071";
} "Highlight group for covered signs.";
uncovered =
helpers.defaultNullOpts.mkNullable types.attrs ''{fg = "#F07178";}''
"Highlight group for uncovered signs.";
uncovered = helpers.defaultNullOpts.mkAttributeSet {
fg = "#F07178";
} "Highlight group for uncovered signs.";
partial =
helpers.defaultNullOpts.mkNullable types.attrs ''{fg = "#AA71F0";}''
"Highlight group for partial coverage signs.";
partial = helpers.defaultNullOpts.mkAttributeSet {
fg = "#AA71F0";
} "Highlight group for partial coverage signs.";
summaryBorder =
helpers.defaultNullOpts.mkNullable types.attrs ''{link = "FloatBorder";}''
"Border highlight group of the summary pop-up.";
summaryBorder = helpers.defaultNullOpts.mkAttributeSet {
link = "FloatBorder";
} "Border highlight group of the summary pop-up.";
summaryNormal =
helpers.defaultNullOpts.mkNullable types.attrs ''{link = "NormalFloat";}''
"Normal text highlight group of the summary pop-up.";
summaryNormal = helpers.defaultNullOpts.mkAttributeSet {
link = "NormalFloat";
} "Normal text highlight group of the summary pop-up.";
summaryCursorLine =
helpers.defaultNullOpts.mkNullable types.attrs ''{link = "CursorLine";}''
"Cursor line highlight group of the summary pop-up.";
summaryCursorLine = helpers.defaultNullOpts.mkAttributeSet {
link = "CursorLine";
} "Cursor line highlight group of the summary pop-up.";
summaryHeader =
helpers.defaultNullOpts.mkNullable types.attrs ''{ style = "bold,underline"; sp = "bg"; }''
"Header text highlight group of the summary pop-up.";
summaryHeader = helpers.defaultNullOpts.mkAttributeSet {
style = "bold,underline";
sp = "bg";
} "Header text highlight group of the summary pop-up.";
summaryPass =
helpers.defaultNullOpts.mkNullable types.attrs ''{link = "CoverageCovered";}''
"Pass text highlight group of the summary pop-up.";
summaryPass = helpers.defaultNullOpts.mkAttributeSet {
link = "CoverageCovered";
} "Pass text highlight group of the summary pop-up.";
summaryFail =
helpers.defaultNullOpts.mkNullable types.attrs ''{link = "CoverageUncovered";}''
"Fail text highlight group of the summary pop-up.";
summaryFail = helpers.defaultNullOpts.mkAttributeSet {
link = "CoverageUncovered";
} "Fail text highlight group of the summary pop-up.";
};
loadCoverageCb = helpers.defaultNullOpts.mkLuaFn "nil" ''
A lua function that will be called when a coverage file is loaded.
Example:
```
loadCoverageCb = helpers.defaultNullOpts.mkLuaFn' {
description = "A lua function that will be called when a coverage file is loaded.";
pluginDefault = "nil";
example = ''
function(ftype)
vim.notify("Loaded " .. ftype .. " coverage")
end
```
'';
};
signs =
mapAttrs
@ -173,11 +173,11 @@ in
summary = {
widthPercentage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0
1.0
) "0.70" "Width of the pop-up window.";
) 0.7 "Width of the pop-up window.";
heightPercentage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0
1.0
) "0.50" "Height of the pop-up window.";
) 0.5 "Height of the pop-up window.";
borders = mapAttrs (optionName: default: helpers.defaultNullOpts.mkStr default "") {
topleft = "";
@ -191,21 +191,22 @@ in
highlight = "Normal:CoverageSummaryBorder";
};
minCoverage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0 100) "80" ''
minCoverage = helpers.defaultNullOpts.mkNullable (types.numbers.between 0 100) 80 ''
Minimum coverage percentage.
Values below this are highlighted with the fail group, values above are highlighted with
the pass group.
'';
};
lang = helpers.defaultNullOpts.mkNullable types.attrs "see upstream documentation" ''
lang = helpers.defaultNullOpts.mkAttributeSet' {
description = ''
Each key corresponds with the `filetype` of the language and maps to an attrs of
configuration values that differ.
See plugin documentation for language specific options.
Example:
```nix
{
See plugin documentation for language specific options.
'';
example = {
python = {
coverage_file = ".coverage";
coverage_command = "coverage json --fail-under=0 -q -o -";
@ -213,9 +214,8 @@ in
ruby = {
coverage_file = "coverage/coverage.json";
};
}
```
'';
};
};
lcovFile = helpers.mkNullOrOption types.str "File that the plugin will try to read lcov coverage from.";
};

View file

@ -27,9 +27,9 @@ in
minLength = helpers.defaultNullOpts.mkInt 3 "Minimum length for underlined words.";
hl =
helpers.defaultNullOpts.mkNullable types.attrs "{underline = true;}"
"Highliht definition map for cursorword highlighting.";
hl = helpers.defaultNullOpts.mkAttrsOf types.anything {
underline = true;
} "Highliht definition map for cursorword highlighting.";
};
};

View file

@ -64,7 +64,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
If 'editor' or 'win', will default to being centered.
'';
prefer_width = helpers.defaultNullOpts.mkNullable intOrRatio "40" ''
prefer_width = helpers.defaultNullOpts.mkNullable intOrRatio 40 ''
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
'';
@ -73,7 +73,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
max_width =
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[140 0.9]"
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
[
140
0.9
]
''
Max width of window.
@ -82,7 +86,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
min_width =
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[20 0.2]"
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
[
20
0.2
]
''
Min width of window.
@ -90,22 +98,19 @@ helpers.neovim-plugin.mkNeovimPlugin config {
total."
'';
buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
An attribute set of neovim buffer options.
'';
win_options = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
win_options = helpers.defaultNullOpts.mkAttrsOf types.anything {
wrap = false;
list = true;
listchars = "precedes:...,extends:...";
sidescrolloff = 0;
}
'' "An attribute set of window options.";
} "An attribute set of window options.";
mappings =
helpers.defaultNullOpts.mkAttrsOf (with types; attrsOf (either str (enum [ false ])))
''
{
n = {
"<Esc>" = "Close";
@ -118,7 +123,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"<Down>" = "HistoryNext";
};
}
''
''
Mappings for defined modes.
@ -144,9 +148,13 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Enable the vim.ui.select implementation.
'';
backend = helpers.defaultNullOpts.mkListOf types.str ''
["telescope" "fzf_lua" "fzf" "builtin" "nui"]
'' "Priority list of preferred vim.select implementations. ";
backend = helpers.defaultNullOpts.mkListOf types.str [
"telescope"
"fzf_lua"
"fzf"
"builtin"
"nui"
] "Priority list of preferred vim.select implementations. ";
trim_prompt = helpers.defaultNullOpts.mkBool true ''
Trim trailing `:` from prompt.
@ -165,20 +173,17 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
fzf = {
window = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
window = helpers.defaultNullOpts.mkAttrsOf types.anything {
width = 0.5;
height = 0.4;
}
'' "Window options for fzf selector. ";
} "Window options for fzf selector. ";
};
fzf_lua = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
fzf_lua = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
Options for fzf-lua selector.
'';
nui = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
nui = helpers.defaultNullOpts.mkAttrsOf types.anything {
position = "50%";
size = null;
relative = "editor";
@ -196,8 +201,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
max_height = 40;
min_width = 40;
min_height = 10;
}
'' "Options for nui selector. ";
} "Options for nui selector. ";
builtin = {
show_numbers = helpers.defaultNullOpts.mkBool true ''
@ -218,23 +222,25 @@ helpers.neovim-plugin.mkNeovimPlugin config {
If 'editor' or 'win', will default to being centered.
'';
buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything "{}" ''
buf_options = helpers.defaultNullOpts.mkAttrsOf types.anything { } ''
An attribute set of buffer options.
'';
win_options = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
win_options = helpers.defaultNullOpts.mkAttrsOf types.anything {
cursorline = true;
cursorlineopt = "both";
}
'' "An attribute set of window options.";
} "An attribute set of window options.";
width = helpers.defaultNullOpts.mkNullable intOrRatio null ''
Can be an integer or a float between 0 and 1 (e.g. 0.4 for 40%).
'';
max_width =
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[140 0.8]"
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
[
140
0.8
]
''
Max width of window.
@ -243,7 +249,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
min_width =
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[40 0.2]"
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
[
40
0.2
]
''
Min width of window.
@ -256,7 +266,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
max_height =
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "0.9"
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) 0.9
''
Max height of window.
@ -265,7 +275,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
min_height =
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio)) "[10 0.2]"
helpers.defaultNullOpts.mkNullable (with types; either intOrRatio (listOf intOrRatio))
[
10
0.2
]
''
Min height of window.
@ -275,13 +289,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
mappings =
helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ]))
''
{
"<Esc>" = "Close";
"<C-c>" = "Close";
"<CR>" = "Confirm";
}
''
''
Mappings in normal mode for the builtin selector.
@ -294,7 +306,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
};
format_item_override = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.strLuaFn "{}" ''
format_item_override = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.strLuaFn { } ''
Override the formatting/display for a specific "kind" when using vim.ui.select.
For example, code actions from vim.lsp.buf.code_action use a kind="codeaction".
You can override the format function when selecting for that kind, e.g.

View file

@ -60,23 +60,20 @@ in
incremental = helpers.defaultNullOpts.mkBool false "behave like `incsearch`";
exclude =
helpers.defaultNullOpts.mkNullable (with types; listOf (either str helpers.nixvimTypes.rawLua))
''
helpers.defaultNullOpts.mkListOf types.str
[
"notify"
"cmp_menu"
"noice"
"flash_prompt"
(
helpers.mkRaw
'''
{
__raw = ''
function(win)
return not vim.api.nvim_win_get_config(win).focusable
end
'''
)
'';
}
]
''
''
Excluded filetypes and custom window filters
'';
@ -87,7 +84,7 @@ in
'';
maxLength =
helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) types.int) "false"
helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) types.int) false
''
max pattern length. If the pattern length is equal to this labels will no longer be
skipped. When it exceeds this length it will either end in a jump or terminate the search
@ -137,11 +134,11 @@ in
you can always jump to the first match with `<CR>`
'';
after = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) "true" ''
after = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) true ''
show the label after the match
'';
before = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) "false" ''
before = helpers.defaultNullOpts.mkNullable (with types; either bool (listOf int)) false ''
show the label before the match
'';
@ -185,7 +182,7 @@ in
Can be useful for visualizing Treesitter ranges.
'';
shade = helpers.defaultNullOpts.mkNullable (types.ints.between 1 9) "5" "";
shade = helpers.defaultNullOpts.mkNullable (types.ints.between 1 9) 5 "";
};
format =
@ -245,19 +242,20 @@ in
'';
# Not sure what is the type...
prefix = helpers.defaultNullOpts.mkNullable (types.listOf types.anything) ''
[ ["" "FlashPromptIcon"] ]
'' "";
winConfig = helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) ''
{
prefix = helpers.defaultNullOpts.mkListOf types.anything [
[
""
"FlashPromptIcon"
]
] "";
winConfig = helpers.defaultNullOpts.mkAttrsOf types.anything {
relative = "editor";
width = 1;
height = 1;
row = -1;
col = 0;
zindex = 1000;
}
'' "See nvim_open_win for more details";
} "See nvim_open_win for more details";
};
remoteOp = {
@ -283,39 +281,47 @@ in
modes =
let
mkModeConfig =
extra: default: desc:
{
extra ? { },
default,
description ? "",
}:
helpers.defaultNullOpts.mkNullable (types.submodule {
options = configOpts // extra;
}) default desc;
}) default description;
in
{
search =
mkModeConfig
{
search = mkModeConfig {
description = ''
options used when flash is activated through a regular search with `/` or `?`
'';
extra = {
enabled = helpers.defaultNullOpts.mkBool true ''
when `true`, flash will be activated during regular search by default.
You can always toggle when searching with `require("flash").toggle()`
'';
}
''
{
};
default = {
enabled = true;
highlight = { backdrop = false; };
jump = { history = true; register = true; nohlsearch = true; };
highlight = {
backdrop = false;
};
jump = {
history = true;
register = true;
nohlsearch = true;
};
/*
forward will be automatically set to the search direction
mode is always set to 'search'
incremental is set to 'true' when 'incsearch' is enabled
*/
search.automatic = true;
}
''
''
options used when flash is activated through a regular search with `/` or `?`
'';
char =
mkModeConfig
{
};
};
char = mkModeConfig {
description = "options used when flash is activated through a regular search with `/` or `?`";
extra = {
enabled = helpers.defaultNullOpts.mkBool true "";
autohide = helpers.defaultNullOpts.mkBool false ''
@ -329,10 +335,16 @@ in
'';
keys =
helpers.defaultNullOpts.mkNullable (types.attrsOf types.str)
''
helpers.listToUnkeyedAttrs [ "f" "F" "t" "T" ";" "," ]
''
helpers.defaultNullOpts.mkAttrsOf types.str
# FIXME can't show helper func in docs
(helpers.listToUnkeyedAttrs [
"f"
"F"
"t"
"T"
";"
","
])
''
by default all keymaps are enabled, but you can disable some of them,
by removing them from the list.
@ -360,12 +372,11 @@ in
The direction for `prev` and `next` is determined by the motion.
`left` and `right` are always left and right.
'';
}
''
{
};
default = {
enabled = true;
/* dynamic configuration for ftFT motions */
config = '''
# dynamic configuration for ftFT motions
config = ''
function(opts)
-- autohide flash when in operator-pending mode
opts.autohide = vim.fn.mode(true):find("no") and vim.v.operator == "y"
@ -380,13 +391,23 @@ in
-- Show jump labels only in operator-pending mode
-- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o")
end
''';
'';
autohide = false;
jumpLabels = false;
multiLine = false;
label = { exclude = "hjkliardc"; };
keys = helpers.listToUnkeyedAttrs [ "f" "F" "t" "T" ";" "," ];
charActions = '''
label = {
exclude = "hjkliardc";
};
# FIXME can't show the function call in the docs...
keys = helpers.listToUnkeyedAttrs [
"f"
"F"
"t"
"T"
";"
","
];
charActions = ''
function(motion)
return {
[";"] = "next", -- set to right to always go right
@ -399,38 +420,70 @@ in
-- [motion:match("%l") and motion:upper() or motion:lower()] = "prev",
}
end
''';
search = { wrap = false; };
highlight = { backdrop = true; };
jump = { register = false; };
}
''
"options used when flash is activated through a regular search with `/` or `?`";
treesitter =
mkModeConfig { }
''
{
labels = "abcdefghijklmnopqrstuvwxyz";
jump = { pos = "range"; };
search = { incremental = false; };
label = { before = true; after = true; style = "inline"; };
highlight = { backdrop = false; matches = false; };
}helpers.ifNonNull'
''
''
'';
search = {
wrap = false;
};
highlight = {
backdrop = true;
};
jump = {
register = false;
};
};
};
treesitter = mkModeConfig {
description = ''
options used for treesitter selections `require("flash").treesitter()`
'';
treesitterSearch = mkModeConfig { } ''
{
jump = { pos = "range"; };
search = { multiWindow = true; wrap = true; incremental = false; };
remoteOp = { restore = true };
label = { before = true; after = true; style = "inline"; };
}
'' "";
remote = mkModeConfig { } ''
{ remoteOp = { restore = true; motion = true; }; }
'' "options used for remote flash";
default = {
labels = "abcdefghijklmnopqrstuvwxyz";
jump = {
pos = "range";
};
search = {
incremental = false;
};
label = {
before = true;
after = true;
style = "inline";
};
highlight = {
backdrop = false;
matches = false;
};
};
};
treesitterSearch = mkModeConfig {
default = {
jump = {
pos = "range";
};
search = {
multiWindow = true;
wrap = true;
incremental = false;
};
remoteOp = {
restore = true;
};
label = {
before = true;
after = true;
style = "inline";
};
};
};
remote = mkModeConfig {
default = {
remoteOp = {
restore = true;
motion = true;
};
};
description = "options used for remote flash";
};
};
}
// configOpts;

View file

@ -44,21 +44,43 @@ in
Whether the plugin in enabled by default or not.
'';
resettingKeys = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
Keys in what modes that reset the count.
default:
```nix
{
"1" = [ "n" "x" ];
"2" = [ "n" "x" ];
"3" = [ "n" "x" ];
"4" = [ "n" "x" ];
"5" = [ "n" "x" ];
"6" = [ "n" "x" ];
"7" = [ "n" "x" ];
"8" = [ "n" "x" ];
"9" = [ "n" "x" ];
resettingKeys = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) {
"1" = [
"n"
"x"
];
"2" = [
"n"
"x"
];
"3" = [
"n"
"x"
];
"4" = [
"n"
"x"
];
"5" = [
"n"
"x"
];
"6" = [
"n"
"x"
];
"7" = [
"n"
"x"
];
"8" = [
"n"
"x"
];
"9" = [
"n"
"x"
];
"c" = [ "n" ];
"C" = [ "n" ];
"d" = [ "n" ];
@ -68,31 +90,58 @@ in
"Y" = [ "n" ];
"p" = [ "n" ];
"P" = [ "n" ];
}
```
'';
} "Keys in what modes that reset the count.";
restrictedKeys = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
Keys in what modes triggering the count mechanism.
default:
```nix
{
"h" = [ "n" "x" ];
"j" = [ "n" "x" ];
"k" = [ "n" "x" ];
"l" = [ "n" "x" ];
"-" = [ "n" "x" ];
"+" = [ "n" "x" ];
"gj" = [ "n" "x" ];
"gk" = [ "n" "x" ];
"<CR>" = [ "n" "x" ];
"<C-M>" = [ "n" "x" ];
"<C-N>" = [ "n" "x" ];
"<C-P>" = [ "n" "x" ];
}
```
'';
restrictedKeys = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) {
"h" = [
"n"
"x"
];
"j" = [
"n"
"x"
];
"k" = [
"n"
"x"
];
"l" = [
"n"
"x"
];
"-" = [
"n"
"x"
];
"+" = [
"n"
"x"
];
"gj" = [
"n"
"x"
];
"gk" = [
"n"
"x"
];
"<CR>" = [
"n"
"x"
];
"<C-M>" = [
"n"
"x"
];
"<C-N>" = [
"n"
"x"
];
"<C-P>" = [
"n"
"x"
];
} "Keys in what modes triggering the count mechanism.";
restrictionMode =
helpers.defaultNullOpts.mkEnumFirstDefault
@ -104,28 +153,32 @@ in
The behavior when `restricted_keys` trigger count mechanism.
'';
disabledKeys = helpers.mkNullOrOption (with types; attrsOf (listOf str)) ''
Keys in what modes are disabled.
disabledKeys = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) {
"<Up>" = [
""
"i"
];
"<Down>" = [
""
"i"
];
"<Left>" = [
""
"i"
];
"<Right>" = [
""
"i"
];
} "Keys in what modes are disabled.";
default:
```nix
{
"<Up>" = [ "" "i" ];
"<Down>" = [ "" "i" ];
"<Left>" = [ "" "i" ];
"<Right>" = [ "" "i" ];
}
```
'';
disabledFiletypes = helpers.mkNullOrOption (with types; listOf str) ''
`hardtime.nvim` is disabled under these filetypes.
default:
```nix
["qf" "netrw" "NvimTree" "lazy" "mason"]
```
'';
disabledFiletypes = helpers.defaultNullOpts.mkListOf types.str [
"qf"
"netrw"
"NvimTree"
"lazy"
"mason"
] "`hardtime.nvim` is disabled under these filetypes.";
hints =
helpers.mkNullOrOption

View file

@ -109,9 +109,9 @@ in
Closes any tmux windows harpoon that harpoon creates when you close Neovim.
'';
excludedFiletypes = helpers.defaultNullOpts.mkNullable (
with types; listOf str
) ''["harpoon"]'' "Filetypes that you want to prevent from adding to the harpoon list menu.";
excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str [ "harpoon" ] ''
Filetypes that you want to prevent from adding to the harpoon list menu.
'';
markBranch = helpers.defaultNullOpts.mkBool false ''
Set marks specific to each git branch inside git repository.
@ -144,9 +144,16 @@ in
Menu window height
'';
borderChars = helpers.defaultNullOpts.mkNullable (
with types; listOf str
) ''["" "" "" "" "" "" "" ""]'' "Border characters";
borderChars = helpers.defaultNullOpts.mkListOf types.str [
""
""
""
""
""
""
""
""
] "Border characters";
};
};

View file

@ -243,7 +243,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
should be good if you have enough keys in `|hop-config-keys|`).
'';
excluded_filetypes = helpers.defaultNullOpts.mkListOf types.str "[]" ''
excluded_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Skip hinting windows with the excluded filetypes.
Those windows to check filetypes are collected only when you enable `multi_windows` or
execute `MW`-commands.
@ -251,7 +251,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
for editing.
'';
match_mappings = helpers.defaultNullOpts.mkListOf types.str "[]" ''
match_mappings = helpers.defaultNullOpts.mkListOf types.str [ ] ''
This option allows you to specify the match mappings to use when applying the hint.
If you set a non-empty `match_mappings`, the hint will be used as a key to look up the
pattern to search for.

View file

@ -61,7 +61,7 @@ with lib;
Called after every hydra head.
'';
timeout = helpers.defaultNullOpts.mkNullable (with types; either bool ints.unsigned) "false" ''
timeout = helpers.defaultNullOpts.mkNullable (with types; either bool ints.unsigned) false ''
Timeout after which the hydra is automatically disabled.
Calling any head will refresh the timeout
- `true`: timeout set to value of `timeoutlen` (`:h timeoutlen`)
@ -162,13 +162,11 @@ with lib;
};
in
helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) hintConfigType)
''
{
show_name = true;
position = "bottom";
offset = 0;
}
''
''
Configure the hint.
Set to `false` to disable.

View file

@ -9,10 +9,17 @@ with lib;
let
cfg = config.plugins.illuminate;
mkListStr = helpers.defaultNullOpts.mkNullable (types.listOf types.str);
mkListStr = helpers.defaultNullOpts.mkListOf types.str;
commonOptions = with helpers.defaultNullOpts; {
providers = mkListStr ''["lsp" "treesitter" "regex"]'' ''
providers =
mkListStr
[
"lsp"
"treesitter"
"regex"
]
''
Provider used to get references in the buffer, ordered by priority.
'';
@ -20,23 +27,23 @@ let
Delay in milliseconds.
'';
modesDenylist = mkListStr "[]" ''
modesDenylist = mkListStr [ ] ''
Modes to not illuminate, this overrides `modes_allowlist`.
See `:help mode()` for possible values.
'';
modesAllowlist = mkListStr "[]" ''
modesAllowlist = mkListStr [ ] ''
Modes to illuminate, this is overridden by `modes_denylist`.
See `:help mode()` for possible values.
'';
providersRegexSyntaxDenylist = mkListStr "[]" ''
providersRegexSyntaxDenylist = mkListStr [ ] ''
Syntax to not illuminate, this overrides `providers_regex_syntax_allowlist`.
Only applies to the 'regex' provider.
Use `:echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')`.
'';
providersRegexSyntaxAllowlist = mkListStr "[]" ''
providersRegexSyntaxAllowlist = mkListStr [ ] ''
Syntax to illuminate, this is overridden by `providers_regex_syntax_denylist`.
Only applies to the 'regex' provider.
Use `:echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')`.
@ -57,11 +64,17 @@ let
};
filetypeOptions = {
filetypesDenylist = mkListStr ''["dirvish" "fugitive"]'' ''
filetypesDenylist =
mkListStr
[
"dirvish"
"fugitive"
]
''
Filetypes to not illuminate, this overrides `filetypes_allowlist`.
'';
filetypesAllowlist = mkListStr "[]" ''
filetypesAllowlist = mkListStr [ ] ''
Filetypes to illuminate, this is overridden by `filetypes_denylist`.
'';
};
@ -77,14 +90,7 @@ in
package = mkPluginPackageOption "vim-illuminate" pkgs.vimPlugins.vim-illuminate;
filetypeOverrides =
helpers.defaultNullOpts.mkNullable
(
with types;
attrsOf (submodule {
options = commonOptions;
})
)
"{}"
helpers.defaultNullOpts.mkAttrsOf (types.submodule { options = commonOptions; }) { }
''
Filetype specific overrides.
The keys are strings to represent the filetype.

View file

@ -212,7 +212,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
include = {
node_type = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) "{}" ''
node_type = helpers.defaultNullOpts.mkAttrsOf (with types; listOf str) { } ''
Map of language to a list of node types which can be used as scope.
- Use `*` as the language to act as a wildcard for all languages.
@ -221,19 +221,20 @@ helpers.neovim-plugin.mkNeovimPlugin config {
};
exclude = {
language = helpers.defaultNullOpts.mkListOf types.str "[]" ''
language = helpers.defaultNullOpts.mkListOf types.str [ ] ''
List of treesitter languages for which scope is disabled.
'';
node_type =
helpers.defaultNullOpts.mkAttrsOf (with types; (listOf str))
''
{
"*" = ["source_file" "program"];
"*" = [
"source_file"
"program"
];
lua = [ "chunk" ];
python = [ "module" ];
}
''
''
Map of language to a list of node types which should not be used as scope.
@ -243,8 +244,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
};
exclude = {
filetypes = helpers.defaultNullOpts.mkListOf types.str ''
[
filetypes = helpers.defaultNullOpts.mkListOf types.str [
"lspinfo"
"packer"
"checkhealth"
@ -253,18 +253,15 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"gitcommit"
"TelescopePrompt"
"TelescopeResults"
"\'\'"
]
'' "List of filetypes for which indent-blankline is disabled.";
"''"
] "List of filetypes for which indent-blankline is disabled.";
buftypes = helpers.defaultNullOpts.mkListOf types.str ''
[
buftypes = helpers.defaultNullOpts.mkListOf types.str [
"terminal"
"nofile"
"quickfix"
"prompt"
]
'' "List of buftypes for which indent-blankline is disabled.";
] "List of buftypes for which indent-blankline is disabled.";
};
};

View file

@ -15,9 +15,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
helpers.defaultNullOpts.mkInt 2048
"Number of lines without indentation before giving up (use -1 for infinite)";
skip_multiline = helpers.defaultNullOpts.mkBool false "Skip multi-line comments and strings (more accurate detection but less performant)";
standard_widths =
helpers.defaultNullOpts.mkListOf types.ints.unsigned ''[2 4 8]''
"Space indentations that should be detected";
standard_widths = helpers.defaultNullOpts.mkListOf types.ints.unsigned [
2
4
8
] "Space indentations that should be detected";
};
settingsExample = {

View file

@ -15,14 +15,18 @@ with lib;
package = helpers.mkPluginPackageOption "lastplace" pkgs.vimPlugins.nvim-lastplace;
ignoreBuftype =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["quickfix" "nofix" "help"]''
"The list of buffer types to ignore by lastplace.";
ignoreBuftype = helpers.defaultNullOpts.mkListOf types.str [
"quickfix"
"nofix"
"help"
] "The list of buffer types to ignore by lastplace.";
ignoreFiletype =
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
''["gitcommit" "gitrebase" "svn" "hgcommit"]''
"The list of file types to ignore by lastplace.";
ignoreFiletype = helpers.defaultNullOpts.mkListOf types.str [
"gitcommit"
"gitrebase"
"svn"
"hgcommit"
] "The list of file types to ignore by lastplace.";
openFolds = helpers.defaultNullOpts.mkBool true "Whether closed folds are automatically opened when jumping to the last edit position.";
};

View file

@ -43,22 +43,12 @@ in
Whether to consider case in search patterns.
'';
equivalenceClasses =
helpers.defaultNullOpts.mkNullable (with types; listOf (either str (listOf str))) ''[" \t\r\n"]''
''
equivalenceClasses = helpers.defaultNullOpts.mkListOf' {
type = with types; either str (listOf str);
description = ''
A character will match any other in its equivalence class. The sets can
either be defined as strings or tables.
Example:
```nix
[
"\r\n"
")]}>"
"([{<"
[ "\"" "'" "`" ]
]
```
Note: Make sure to have a set containing `\n` if you want to be able to
target characters at the end of the line.
@ -67,20 +57,34 @@ in
different labels, corresponding to two different futures, at the same
time.
'';
pluginDefault = [ " \t\r\n" ];
example = [
"\r\n"
")]}>"
"([{<"
[
"\""
"'"
"`"
]
];
};
substituteChars = helpers.defaultNullOpts.mkNullable (with types; attrsOf str) "{}" ''
substituteChars = helpers.defaultNullOpts.mkAttrsOf' {
type = types.str;
description = ''
The keys in this attrs will be substituted in labels and highlighted matches by the given
characters.
This way special (e.g. whitespace) characters can be made visible in matches, or even be
used as labels.
Example: `{"\r" = "¬";}`
'';
pluginDefault = { };
example = {
"\r" = "¬";
};
};
safeLabels =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
''["s" "f" "n" "u" "t" "/" "S" "F" "N" "L" "H" "M" "U" "G" "T" "?" "Z"]''
''
safeLabels = helpers.defaultNullOpts.mkListOf types.str (stringToCharacters "sfnut/SFNLHMUGT?Z") ''
When the number of matches does not exceed the number of these "safe" labels plus one, the
plugin jumps to the first match automatically after entering the pattern.
Obviously, for this purpose you should choose keys that are unlikely to be used right
@ -93,14 +97,8 @@ in
'';
labels =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
''
[
"s" "f" "n" "j" "k" "l" "h" "o" "d" "w" "e" "m" "b" "u" "y" "v" "r" "g" "t" "c" "x" "/"
"z" "S" "F" "N" "J" "K" "L" "H" "O" "D" "W" "E" "M" "B" "U" "Y" "V" "R" "G" "T" "C" "X"
"?" "Z"
]
''
helpers.defaultNullOpts.mkListOf types.str
(stringToCharacters "sfnjklhodwembuyvrgtcx/zSFNJKLHODWEMBUYVRGTCX?Z")
''
Target labels to be used when there are more matches than labels in
`|leap.opts.safe_labels|` plus one.

View file

@ -67,7 +67,7 @@ mkVimPlugin config {
The highlight group to be used for highlighting cells.
'';
save_path = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('data') .. '/magma'";}'' ''
save_path = helpers.defaultNullOpts.mkStr { __raw = "vim.fn.stdpath('data') .. '/magma'"; } ''
Where to save/load with `:MagmaSave` and `:MagmaLoad` (with no parameters).
The generated file is placed in this directory, with the filename itself being the
buffer's name, with `%` replaced by `%%` and `/` replaced by `%`, and postfixed with the

View file

@ -26,7 +26,7 @@ in
"<"
">"
])
"[]"
[ ]
''
Which builtin marks to track and show. If set, these marks will also show up in the
signcolumn and will update on `|CursorMoved|`.
@ -76,7 +76,7 @@ in
};
})
)
"10"
10
''
The sign priority to be used for marks.
Can either be a number, in which case the priority applies to all types of marks, or a
@ -88,7 +88,7 @@ in
- bookmark: sign priority for bookmarks
'';
excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str "[]" ''
excludedFiletypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Which filetypes to ignore.
If a buffer with this filetype is opened, then `marks.nvim` will not track any marks set in
this buffer, and will not display any signs.
@ -96,7 +96,7 @@ in
"m[" will not.
'';
excludedBuftypes = helpers.defaultNullOpts.mkListOf types.str "[]" ''
excludedBuftypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Which buftypes to ignore.
If a buffer with this buftype is opened, then `marks.nvim` will not track any marks set in
this buffer, and will not display any signs.
@ -138,7 +138,7 @@ in
);
};
mappings = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])) "{}" ''
mappings = helpers.defaultNullOpts.mkAttrsOf (with types; either str (enum [ false ])) { } ''
Custom mappings.
Set a mapping to `false` to disable it.
'';

View file

@ -79,8 +79,12 @@ in
};
filetypes =
helpers.defaultNullOpts.mkNullable (with types; attrsOf bool)
"{md = true; rmd = true; markdown = true;}"
helpers.defaultNullOpts.mkAttrsOf types.bool
{
md = true;
rmd = true;
markdown = true;
}
''
A matching extension will enable the plugin's functionality for a file with that
extension.
@ -137,7 +141,7 @@ in
notebook (requires `perspective.root_tell` to be specified)
'';
rootTell = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str) "false" ''
rootTell = helpers.defaultNullOpts.mkNullable (with types; either (enum [ false ]) str) false ''
- `<any file name>`: Any arbitrary filename by which the plugin can uniquely identify
the root directory of the current notebook.
- If `false` is used instead, the plugin will never search for a root directory, even
@ -233,7 +237,7 @@ in
an extension, and (b) that new links should be created without an explicit extension.
'';
transformExplicit = helpers.defaultNullOpts.mkStrLuaFnOr (types.enum [ false ]) "false" ''
transformExplicit = helpers.defaultNullOpts.mkStrLuaFnOr (types.enum [ false ]) false ''
A function that transforms the text to be inserted as the source/path of a link when a
link is created.
Anchor links are not currently customizable.
@ -282,7 +286,14 @@ in
};
toDo = {
symbols = helpers.defaultNullOpts.mkNullable (with types; listOf str) ''[" " "-" "X"]'' ''
symbols =
helpers.defaultNullOpts.mkListOf types.str
[
" "
"-"
"X"
]
''
A list of symbols (each no more than one character) that represent to-do list completion
statuses.
`MkdnToggleToDo` references these when toggling the status of a to-do item.
@ -392,10 +403,9 @@ in
};
mappings =
helpers.defaultNullOpts.mkNullable
helpers.defaultNullOpts.mkAttrsOf
(
with types;
attrsOf (
either (enum [ false ]) (submodule {
options = {
modes = mkOption {
@ -418,11 +428,13 @@ in
};
})
)
)
''
{
MkdnEnter = {
modes = ["n" "v" "i"];
modes = [
"n"
"v"
"i"
];
key = "<CR>";
};
MkdnTab = false;
@ -454,7 +466,10 @@ in
MkdnFollowLink = false; # see MkdnEnter
MkdnCreateLink = false; # see MkdnEnter
MkdnCreateLinkFromClipboard = {
modes = ["n" "v"];
modes = [
"n"
"v"
];
key = "<leader>p";
}; # see MkdnEnter
MkdnDestroyLink = {
@ -482,7 +497,10 @@ in
key = "-";
};
MkdnToggleToDo = {
modes = ["n" "v"];
modes = [
"n"
"v"
];
key = "<C-Space>";
};
MkdnNewListItem = false;
@ -537,7 +555,6 @@ in
key = "<leader>F";
};
}
''
''
An attrs declaring the key mappings.
The keys should be the name of a commands defined in

View file

@ -63,7 +63,7 @@ mkVimPlugin config {
cell.
'';
cover_lines_starting_with = helpers.defaultNullOpts.mkListOf types.str "[]" ''
cover_lines_starting_with = helpers.defaultNullOpts.mkListOf types.str [ ] ''
When `cover_empty_lines` is `true`, also covers lines starting with these strings.
'';
@ -108,7 +108,12 @@ mkVimPlugin config {
it's open.
'';
output_win_border = helpers.defaultNullOpts.mkBorder ''["" "" "" ""]'' "output window" "";
output_win_border = helpers.defaultNullOpts.mkBorder [
""
""
""
""
] "output window" "";
output_win_cover_gutter = helpers.defaultNullOpts.mkBool true ''
Should the output window cover the gutter (numbers and sign col), or not.
@ -138,7 +143,9 @@ mkVimPlugin config {
Value passed to the style option in `:h nvim_open_win()`.
'';
save_path = helpers.defaultNullOpts.mkStr ''{__raw = "vim.fn.stdpath('data')..'/molten'";}'' "Where to save/load data with `:MoltenSave` and `:MoltenLoad`.";
save_path = helpers.defaultNullOpts.mkStr {
__raw = "vim.fn.stdpath('data')..'/molten'";
} "Where to save/load data with `:MoltenSave` and `:MoltenLoad`.";
tick_rate = helpers.defaultNullOpts.mkUnsignedInt 500 ''
How often (in ms) we poll the kernel for updates.

View file

@ -161,7 +161,7 @@ in
]
(
mode:
helpers.defaultNullOpts.mkNullable (with types; either bool str) "false" ''
helpers.defaultNullOpts.mkNullable (with types; either bool str) false ''
Hints for ${mode} mode.
Accepted values:

View file

@ -33,7 +33,7 @@ in
width = mkPercentageOpt 100 "The width size (in %).";
};
})
) "60" "The size of the window.";
) 60 "The size of the window.";
position = helpers.defaultNullOpts.mkNullable (
with types;
@ -44,7 +44,7 @@ in
width = mkPercentageOpt 100 "The width size (in %).";
};
})
) "50" "The position of the window.";
) 50 "The position of the window.";
scrolloff = helpers.mkNullOrOption types.int ''
scrolloff value within navbuddy window
@ -76,13 +76,12 @@ in
'';
preview =
helpers.defaultNullOpts.mkEnum
helpers.defaultNullOpts.mkEnumFirstDefault
[
"leaf"
"always"
"never"
]
"leaf"
''
Right section can show previews too.
Options: "leaf", "always" or "never"
@ -149,8 +148,7 @@ in
};
mappings =
helpers.defaultNullOpts.mkNullable (with types; attrsOf (either str helpers.nixvimTypes.rawLua))
''
helpers.defaultNullOpts.mkAttrsOf types.str
{
"<esc>" = "close";
"q" = "close";
@ -192,7 +190,6 @@ in
"<C-v>" = "vsplit";
"<C-s>" = "hsplit";
}
''
''
Actions to be triggered for specified keybindings. It can take either action name i.e `toggle_preview`
Or it can a `rawLua`.
@ -214,14 +211,13 @@ in
highlight = helpers.defaultNullOpts.mkBool true "Highlight the currently focused node";
reorient =
helpers.defaultNullOpts.mkEnum
helpers.defaultNullOpts.mkEnumFirstDefault
[
"smart"
"top"
"mid"
"none"
]
"smart"
''
Right section can show previews too.
Options: "leaf", "always" or "never"

View file

@ -29,12 +29,11 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
main_image =
helpers.defaultNullOpts.mkEnum
helpers.defaultNullOpts.mkEnumFirstDefault
[
"language"
"logo"
]
"language"
''
Main image display (either "language" or "logo")
'';
@ -65,25 +64,23 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Displays the current line number instead of the current project.
'';
blacklist = helpers.defaultNullOpts.mkListOf types.str "[]" ''
blacklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
A list of strings or Lua patterns that disable Rich Presence if the
current file name, path, or workspace matches.
'';
buttons =
helpers.defaultNullOpts.mkNullable
helpers.defaultNullOpts.mkListOf
(
with types;
either helpers.nixvimTypes.rawLua (
listOf (submodule {
submodule {
options = {
label = helpers.mkNullOrOption str "";
url = helpers.mkNullOrOption str "";
label = helpers.mkNullOrStr "";
url = helpers.mkNullOrStr "";
};
})
}
)
)
"[]"
[ ]
''
Button configurations which will always appear in Rich Presence.
Can be a list of attribute sets, each with the following attributes:

View file

@ -67,7 +67,10 @@ in
If true, enables placeholders when inserting annotation
'';
languages = helpers.defaultNullOpts.mkNullable types.attrs "see upstream documentation" ''
languages = helpers.defaultNullOpts.mkAttrsOf' {
# No plugin default (see upstream)
type = types.anything;
description = ''
Configuration for languages.
`template.annotation_convention` (default: check the language default configurations):
@ -93,18 +96,15 @@ in
Template for an annotation convention.
To know more about how to create your own template, go here:
https://github.com/danymat/neogen/blob/main/docs/adding-languages.md#default-generator
Example:
```nix
{
'';
example = {
csharp = {
template = {
annotation_convention = "...";
};
};
}
```
'';
};
};
snippetEngine = helpers.mkNullOrOption types.str ''
Use a snippet engine to generate annotations.

View file

@ -80,7 +80,7 @@ with lib;
}
) modes;
floatPrecision = helpers.defaultNullOpts.mkNullable types.float "0.01" ''
floatPrecision = helpers.defaultNullOpts.mkNullable types.float 1.0e-2 ''
Can limit the number of decimals displayed for floats
'';
};

View file

@ -70,13 +70,10 @@ in
Function called when a new window is closed.
'';
render = helpers.defaultNullOpts.mkNullable (
with types;
either (enum [
render = helpers.defaultNullOpts.mkEnumFirstDefault [
"default"
"minimal"
]) helpers.nixvimTypes.rawLua
) "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.";
minimumWidth = helpers.defaultNullOpts.mkUnsignedInt 50 ''
Minimum width for notification windows.

View file

@ -53,9 +53,10 @@ helpers.neovim-plugin.mkNeovimPlugin config {
];
settingsOptions = {
disable_filetype =
helpers.defaultNullOpts.mkListOf types.str ''["TelescopePrompt" "spectre_panel"]''
"Disabled filetypes.";
disable_filetype = helpers.defaultNullOpts.mkListOf types.str [
"TelescopePrompt"
"spectre_panel"
] "Disabled filetypes.";
disable_in_macro = helpers.defaultNullOpts.mkBool false ''
Disable when recording or executing a macro.
@ -101,8 +102,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Use treesitter to check for a pair.
'';
ts_config = helpers.defaultNullOpts.mkAttrsOf types.anything ''
{
ts_config = helpers.defaultNullOpts.mkAttrsOf types.anything {
lua = [
"string"
"source"
@ -112,8 +112,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"string"
"template_string"
];
}
'' "Configuration for TreeSitter.";
} "Configuration for TreeSitter.";
map_cr = helpers.defaultNullOpts.mkBool true ''
Map the `<CR>` key to confirm the completion.
@ -136,7 +135,16 @@ helpers.neovim-plugin.mkNeovimPlugin config {
The key to trigger fast_wrap.
'';
chars = helpers.defaultNullOpts.mkListOf types.str ''["{" "[" "(" "\"" "'"]'' ''
chars =
helpers.defaultNullOpts.mkListOf types.str
[
"{"
"["
"("
"\""
"'"
]
''
Characters for which to enable fast wrap.
'';

View file

@ -38,8 +38,18 @@ in
'';
borderChars =
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
"[ \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" ]"
helpers.defaultNullOpts.mkListOf types.str
[
""
""
""
""
""
""
""
""
""
]
''
Border and scroll bar chars, they respectively represent:
vline, vline, hline, hline, ulcorner, urcorner, blcorner, brcorner, sbar
@ -111,9 +121,10 @@ in
'';
};
extraOpts =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[ \"--bind\" \"ctrl-o:toggle-all\" ]"
"Extra options for fzf.";
extraOpts = helpers.defaultNullOpts.mkListOf types.str [
"--bind"
"ctrl-o:toggle-all"
] "Extra options for fzf.";
};
};
};

View file

@ -229,7 +229,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
}
)
)
"[]"
[ ]
''
A list of vault names and paths.
Each path should be the path to the vault root.

View file

@ -32,7 +32,7 @@ with lib;
substitutions = helpers.defaultNullOpts.mkAttrsOf (
with helpers.nixvimTypes; either str rawLua
) "{}" "A map for custom variables, the key should be the variable and the value a function.";
) { } "A map for custom variables, the key should be the variable and the value a function.";
};
new_notes_location =
@ -203,11 +203,14 @@ with lib;
'';
completion = {
nvim_cmp = helpers.mkNullOrOption types.bool ''
# FIXME should this accept raw types?
nvim_cmp = helpers.mkNullOrOption' {
type = types.bool;
description = ''
Set to false to disable completion.
Default: `true` if `nvim-cmp` is enabled (`plugins.cmp.enable`).
'';
defaultText = literalMD "`true` if `plugins.cmp.enable` is enabled (otherwise `null`).";
};
min_chars = helpers.defaultNullOpts.mkUnsignedInt 2 ''
Trigger completion at this many chars.
@ -233,7 +236,6 @@ with lib;
};
})
)
''
{
gf = {
action = "require('obsidian').util.gf_passthrough";
@ -249,7 +251,6 @@ with lib;
opts.buffer = true;
};
}
''
''
Configure key mappings.
'';
@ -268,12 +269,10 @@ with lib;
note_mappings =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
new = "<C-x>";
insert_link = "<C-l>";
}
''
''
Optional, configure note mappings for the picker. These are the defaults.
Not all pickers support all mappings.
@ -281,12 +280,10 @@ with lib;
tag_mappings =
helpers.defaultNullOpts.mkAttrsOf types.str
''
{
tag_note = "<C-x>";
insert_tag = "<C-l>";
}
''
''
Optional, configure tag mappings for the picker. These are the defaults.
Not all pickers support all mappings.
@ -369,10 +366,10 @@ with lib;
'';
checkboxes =
helpers.defaultNullOpts.mkNullable
helpers.defaultNullOpts.mkAttrsOf
(
with types;
attrsOf (submodule {
submodule {
options = {
char = mkOption {
type = with helpers.nixvimTypes; maybeRaw str;
@ -384,9 +381,8 @@ with lib;
description = "The name of the highlight group to use for this checkbox.";
};
};
})
}
)
''
{
" " = {
char = "󰄱";
@ -405,7 +401,6 @@ with lib;
hl_group = "ObsidianTilde";
};
}
''
''
Define how various check-boxes are displayed.
You can also add more custom ones...
@ -452,8 +447,7 @@ with lib;
'';
};
hl_groups = helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; attrsOf highlight) ''
{
hl_groups = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight {
ObsidianTodo = {
bold = true;
fg = "#f78c6c";
@ -484,8 +478,7 @@ with lib;
ObsidianHighlightText = {
bg = "#75662e";
};
}
'' "Highlight group definitions.";
} "Highlight group definitions.";
};
attachments = {

View file

@ -277,7 +277,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
cleanup_delay_ms =
helpers.defaultNullOpts.mkNullable (with types; either types.ints.unsigned (enum [ false ])) "2000"
helpers.defaultNullOpts.mkNullable (with types; either types.ints.unsigned (enum [ false ])) 2000
''
Oil will automatically delete hidden buffers after this delay.
You can set the delay to false to disable cleanup entirely.
@ -317,7 +317,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
(enum [ false ])
]
)
''
{
"g?" = "actions.show_help";
"<CR>" = "actions.select";
@ -336,7 +335,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"g." = "actions.toggle_hidden";
"g\\" = "actions.toggle_trash";
}
''
''
Keymaps in oil buffer.
Can be any value that `vim.keymap.set` accepts OR a table of keymap options with a
@ -347,7 +345,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
See `:help oil-actions` for a list of all available actions.
'';
keymaps_help = helpers.defaultNullOpts.mkAttrsOf types.anything ''{border = "rounded";}'' ''
keymaps_help = helpers.defaultNullOpts.mkAttrsOf types.anything { border = "rounded"; } ''
Configuration for the floating keymaps help window.
'';
@ -379,12 +377,16 @@ helpers.neovim-plugin.mkNeovimPlugin config {
sort =
helpers.defaultNullOpts.mkListOf (with types; listOf str)
''
[
["type" "asc"]
["name" "asc"]
[
"type"
"asc"
]
[
"name"
"asc"
]
]
''
''
Sort order can be "asc" or "desc".
See `:help oil-columns` to see which columns are sortable.
@ -418,13 +420,19 @@ helpers.neovim-plugin.mkNeovimPlugin config {
};
preview = {
max_width = helpers.defaultNullOpts.mkNullable dimensionType "0.9" ''
max_width = helpers.defaultNullOpts.mkNullable dimensionType 0.9 ''
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`max_width = [100 0.8]` means "the lesser of 100 columns or 80% of total".
'';
min_width = helpers.defaultNullOpts.mkNullable dimensionType "[40 0.4]" ''
min_width =
helpers.defaultNullOpts.mkNullable dimensionType
[
40
0.4
]
''
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`min_width = [40 0.4]` means "the greater of 40 columns or 40% of total".
@ -434,13 +442,19 @@ helpers.neovim-plugin.mkNeovimPlugin config {
with types; either int (numbers.between 0.0 1.0)
) "Optionally define an integer/float for the exact width of the preview window.";
max_height = helpers.defaultNullOpts.mkNullable dimensionType "0.9" ''
max_height = helpers.defaultNullOpts.mkNullable dimensionType 0.9 ''
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`max_height = [80 0.9]` means "the lesser of 80 columns or 90% of total".
'';
min_height = helpers.defaultNullOpts.mkNullable dimensionType "[5 0.1]" ''
min_height =
helpers.defaultNullOpts.mkNullable dimensionType
[
5
0.1
]
''
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`min_height = [5 0.1]` means "the greater of 5 columns or 10% of total".
@ -462,13 +476,19 @@ helpers.neovim-plugin.mkNeovimPlugin config {
};
progress = {
max_width = helpers.defaultNullOpts.mkNullable dimensionType "0.9" ''
max_width = helpers.defaultNullOpts.mkNullable dimensionType 0.9 ''
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`max_width = [100 0.8]` means "the lesser of 100 columns or 80% of total".
'';
min_width = helpers.defaultNullOpts.mkNullable dimensionType "[40 0.4]" ''
min_width =
helpers.defaultNullOpts.mkNullable dimensionType
[
40
0.4
]
''
Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`min_width = [40 0.4]` means "the greater of 40 columns or 40% of total".
@ -478,13 +498,19 @@ helpers.neovim-plugin.mkNeovimPlugin config {
with types; either int (numbers.between 0.0 1.0)
) "Optionally define an integer/float for the exact width of the preview window.";
max_height = helpers.defaultNullOpts.mkNullable dimensionType "0.9" ''
max_height = helpers.defaultNullOpts.mkNullable dimensionType 0.9 ''
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`max_height = [80 0.9]` means "the lesser of 80 columns or 90% of total".
'';
min_height = helpers.defaultNullOpts.mkNullable dimensionType "[5 0.1]" ''
min_height =
helpers.defaultNullOpts.mkNullable dimensionType
[
5
0.1
]
''
Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%).
Can be a single value or a list of mixed integer/float types.
`min_height = [5 0.1]` means "the greater of 5 columns or 10% of total".

View file

@ -178,7 +178,7 @@ in
The command to use to start the ollama server.
'';
args = helpers.defaultNullOpts.mkListOf types.str ''["serve"]'' ''
args = helpers.defaultNullOpts.mkListOf types.str [ "serve" ] ''
The arguments to pass to the serve command.
'';
@ -186,7 +186,13 @@ in
The command to use to stop the ollama server.
'';
stopArgs = helpers.defaultNullOpts.mkListOf types.str ''["-SIGTERM" "ollama"]'' ''
stopArgs =
helpers.defaultNullOpts.mkListOf types.str
[
"-SIGTERM"
"ollama"
]
''
The arguments to pass to the stop command.
'';
};

View file

@ -12,10 +12,9 @@ with lib;
package = helpers.mkPluginPackageOption "persistence.nvim" pkgs.vimPlugins.persistence-nvim;
dir =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")''
"directory where session files are saved";
dir = helpers.defaultNullOpts.mkStr {
__raw = ''vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/")'';
} "directory where session files are saved";
options =
let
@ -38,9 +37,13 @@ with lib;
"winsize"
];
in
helpers.defaultNullOpts.mkNullable (
with types; listOf (enum sessionOpts)
) ''["buffers" "curdir" "tabpages" "winsize" "skiprtp"]'' "sessionoptions used for saving";
helpers.defaultNullOpts.mkListOf (types.enum sessionOpts) [
"buffers"
"curdir"
"tabpages"
"winsize"
"skiprtp"
] "sessionoptions used for saving";
preSave = helpers.defaultNullOpts.mkLuaFn "nil" "a function to call before saving the session";

View file

@ -27,12 +27,11 @@ in
'';
mainImage =
helpers.defaultNullOpts.mkEnum
helpers.defaultNullOpts.mkEnumFirstDefault
[
"neovim"
"file"
]
"neovim"
''
Main image display.
'';
@ -63,24 +62,20 @@ in
Displays the current line number instead of the current project.
'';
blacklist = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
blacklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
A list of strings or Lua patterns that disable Rich Presence if the
current file name, path, or workspace matches.
'';
buttons =
helpers.defaultNullOpts.mkNullable
(types.either helpers.nixvimTypes.rawLua (
types.listOf (
types.submodule {
helpers.defaultNullOpts.mkListOf
(types.submodule {
options = {
label = helpers.mkNullOrOption types.str "";
url = helpers.mkNullOrOption types.str "";
};
}
)
))
"[]"
})
[ ]
''
Button configurations which will always appear in Rich Presence.

View file

@ -38,7 +38,11 @@ in
'';
detectionMethods =
helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["lsp" "pattern"]''
helpers.defaultNullOpts.mkListOf types.str
[
"lsp"
"pattern"
]
''
Methods of detecting the root directory.
**"lsp"** uses the native neovim lsp, while **"pattern"** uses vim-rooter like glob pattern
@ -48,19 +52,27 @@ in
'';
patterns =
helpers.defaultNullOpts.mkNullable (with types; listOf str)
''[".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json"]''
helpers.defaultNullOpts.mkListOf types.str
[
".git"
"_darcs"
".hg"
".bzr"
".svn"
"Makefile"
"package.json"
]
''
All the patterns used to detect root dir, when **"pattern"** is in `detectionMethods`.
'';
ignoreLsp = helpers.defaultNullOpts.mkNullable (
with types; listOf str
) "[]" "Table of lsp clients to ignore by name.";
ignoreLsp =
helpers.defaultNullOpts.mkListOf types.str [ ]
"Table of lsp clients to ignore by name.";
excludeDirs = helpers.defaultNullOpts.mkNullable (
with types; listOf str
) "[]" "Don't calculate root dir on specific directories.";
excludeDirs =
helpers.defaultNullOpts.mkListOf types.str [ ]
"Don't calculate root dir on specific directories.";
showHidden = helpers.defaultNullOpts.mkBool false "Show hidden files in telescope.";
@ -79,14 +91,11 @@ in
What scope to change the directory.
'';
dataPath =
helpers.defaultNullOpts.mkNullable (with types; either str helpers.nixvimTypes.rawLua)
''{__raw = "vim.fn.stdpath('data')";}''
"Path where project.nvim will store the project history for use in telescope.";
dataPath = helpers.defaultNullOpts.mkStr {
__raw = "vim.fn.stdpath('data')";
} "Path where project.nvim will store the project history for use in telescope.";
enableTelescope = mkEnableOption ''
When set to true, enabled project-nvim telescope integration.
'';
enableTelescope = mkEnableOption "project-nvim telescope integration";
};
config = mkIf cfg.enable {

View file

@ -43,7 +43,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
settingsOptions = with helpers.nixvimTypes; {
prompt_func_return_type =
helpers.defaultNullOpts.mkAttrsOf bool
''
{
go = false;
java = false;
@ -53,7 +52,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
hpp = false;
cxx = false;
}
''
''
For certain languages like Golang, types are required for functions that return an object(s).
Unfortunately, for some functions there is no way to automatically find their type. In those instances,
@ -74,7 +72,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
prompt_func_param_type =
helpers.defaultNullOpts.mkAttrsOf bool
''
{
go = false;
java = false;
@ -84,7 +81,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
hpp = false;
cxx = false;
}
''
''
For certain languages like Golang, types are required for functions parameters.
Unfortunately, for some parameters there is no way to automatically find their type. In those instances,
@ -102,7 +98,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
}
'';
printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) "{ }" ''
printf_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } ''
In any custom printf statement, it is possible to optionally add a **max of one `%s` pattern**, which is where the debug path will go.
For an example custom printf statement, go to [this folder][folder], select your language, and click on `multiple-statements/printf.config`.
@ -121,7 +117,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
[folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/printf
'';
print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) "{ }" ''
print_var_statements = helpers.defaultNullOpts.mkAttrsOf (listOf (maybeRaw str)) { } ''
In any custom print var statement, it is possible to optionally add a **max of two `%s` patterns**, which is where the debug path and
the actual variable reference will go, respectively. To add a literal `"%s"` to the string, escape the sequence like this: `%%s`.
For an example custom print var statement, go to [this folder][folder], select your language, and view `multiple-statements/print_var.config`.
@ -141,7 +137,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
[folder]: https://github.com/ThePrimeagen/refactoring.nvim/blob/master/lua/refactoring/tests/debug/print_var
'';
extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str "{ }" ''
extract_var_statements = helpers.defaultNullOpts.mkAttrsOf str { } ''
When performing an `extract_var` refactor operation, you can custom how the new variable would be declared by setting configuration
like the below example.

View file

@ -287,8 +287,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Whether to enable statistics or not.
'';
stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) ''
[
stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) [
{
__unkeyed = "total_time";
title = "Time taken:";
@ -297,8 +296,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
__unkeyed = "size_download_t";
title = "Download size:";
}
]
'' "See https://curl.se/libcurl/c/curl_easy_getinfo.html.";
] "See https://curl.se/libcurl/c/curl_easy_getinfo.html.";
};
formatters = {
@ -306,9 +304,8 @@ helpers.neovim-plugin.mkNeovimPlugin config {
JSON formatter.
'';
html = helpers.defaultNullOpts.mkStr ''
{
__raw = \'\'
html = helpers.defaultNullOpts.mkStr {
__raw = ''
function(body)
if vim.fn.executable("tidy") == 0 then
return body, { found = false, name = "tidy" }
@ -326,9 +323,8 @@ helpers.neovim-plugin.mkNeovimPlugin config {
return fmt_body, { found = true, name = "tidy" }
end
\'\';
}
'' "HTML formatter.";
'';
} "HTML formatter.";
};
};
@ -359,7 +355,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
keybinds =
helpers.defaultNullOpts.mkListOf (with types; listOf str)
''
[
[
"<localleader>rr"
@ -372,7 +367,6 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"Re-run latest request"
]
]
''
''
Declare some keybindings.
Format: list of 3 strings lists: key, action and description.

View file

@ -36,7 +36,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
description = "Executable to run.";
};
args = helpers.defaultNullOpts.mkListOf types.str "[]" ''
args = helpers.defaultNullOpts.mkListOf types.str [ ] ''
List of arguments to provide to the engine.
'';
@ -58,7 +58,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
The description for this option.
'';
};
}) "{}" "The options for this engine.";
}) { } "The options for this engine.";
};
})
)
@ -93,8 +93,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
line_sep = helpers.defaultNullOpts.mkStr "" "Line separator.";
highlight = helpers.defaultNullOpts.mkAttrsOf types.str ''
{
highlight = helpers.defaultNullOpts.mkAttrsOf types.str {
headers = "SpectreHeader";
ui = "SpectreBody";
filename = "SpectreFile";
@ -102,8 +101,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
search = "SpectreSearch";
border = "SpectreBorder";
replace = "SpectreReplace";
}
'' "Highlight groups.";
} "Highlight groups.";
mapping =
helpers.mkNullOrOption
@ -144,7 +142,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Which find engine to use. Pick one from the `find_engine` list.
'';
options = helpers.defaultNullOpts.mkListOf types.str ''["ignore-case"]'' ''
options = helpers.defaultNullOpts.mkListOf types.str [ "ignore-case" ] ''
Options to use for this engine.
'';
};
@ -154,7 +152,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Which find engine to use. Pick one from the `replace_engine` list.
'';
options = helpers.defaultNullOpts.mkListOf types.str "[]" ''
options = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Options to use for this engine.
'';
};

View file

@ -74,7 +74,7 @@ with lib;
attrs
]
)
"[]"
[ ]
''
A list of files or directories to bookmark.
The list can contain two kinds of types.
@ -91,7 +91,7 @@ with lib;
(listOf str)
]
)
"[]"
[ ]
''
A list of commands to execute on selection.
Leading colons are optional.
@ -132,7 +132,7 @@ with lib;
NOTE: This option is affected by `session_delete_buffers`.
'';
session_before_save = helpers.defaultNullOpts.mkListOf types.str "[]" ''
session_before_save = helpers.defaultNullOpts.mkListOf types.str [ ] ''
This is a list of commands to be executed before saving a session.
Example: `["silent! tabdo NERDTreeClose"]`
@ -181,7 +181,7 @@ with lib;
Affects `change_to_dir` and `change_to_vcs_root`.
'';
skiplist = helpers.defaultNullOpts.mkListOf types.str "[]" ''
skiplist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
A list of Vim regular expressions that is used to filter recently used files.
See `|pattern.txt|` for what patterns can be used.
@ -227,7 +227,7 @@ with lib;
The number of spaces used for left padding.
'';
skiplist_server = helpers.defaultNullOpts.mkListOf (with helpers.nixvimTypes; maybeRaw str) "[]" ''
skiplist_server = helpers.defaultNullOpts.mkListOf (with helpers.nixvimTypes; maybeRaw str) [ ] ''
Do not create the startify buffer, if this is a Vim server instance with a name contained in
this list.
@ -255,7 +255,7 @@ with lib;
- don't filter through the bookmark list
'';
session_remove_lines = helpers.defaultNullOpts.mkListOf types.str "[]" ''
session_remove_lines = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Lines matching any of the patterns in this list, will be removed from the session file.
Example:
@ -272,7 +272,7 @@ with lib;
probably get problems when trying to load it.
'';
session_savevars = helpers.defaultNullOpts.mkListOf types.str "[]" ''
session_savevars = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Include a list of variables in here which you would like Startify to save into the session file
in addition to what Vim normally saves into the session file.
@ -286,7 +286,7 @@ with lib;
```
'';
session_savecmds = helpers.defaultNullOpts.mkListOf types.str "[]" ''
session_savecmds = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Include a list of cmdline commands which Vim will run upon loading the session.
Example:
@ -307,33 +307,33 @@ with lib;
alphabetically.
'';
custom_indices =
helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; maybeRaw (listOf str)) "[]"
''
custom_indices = helpers.defaultNullOpts.mkListOf' {
type = types.str;
pluginDefault = [ ];
description = ''
Use any list of strings as indices instead of increasing numbers. If there are more startify
entries than actual items in the custom list, the remaining entries will be filled using the
default numbering scheme starting from 0.
Thus you can create your own indexing scheme that fits your keyboard layout.
You don't want to leave the home row, do you?!
Example:
```nix
["f" "g" "h"]
```
'';
example = [
"f"
"g"
"h"
];
};
custom_header =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf (maybeRaw str)))
''
custom_header = helpers.defaultNullOpts.mkListOf' {
type = types.str;
description = ''
Define your own header.
This option takes a `list of strings`, whereas each string will be put on its own line.
If it is a simple `string`, it should evaluate to a list of strings.
Example:
```nix
[
'';
example = [
""
" "
" "
@ -341,25 +341,35 @@ with lib;
" "
" "
" "
]
```
'';
];
};
custom_header_quotes = helpers.defaultNullOpts.mkListOf (with types; listOf str) "[]" ''
Example:
```nix
[
custom_header_quotes = helpers.defaultNullOpts.mkListOf' {
type = with types; listOf str;
pluginDefault = [ ];
description = ''
If you don't set `custom_header`, the internal cowsay implementation with
predefined random quotes will be used.
To use your own quotes, set this option to a list of quotes. Each quote is
either another list or a `|Funcref|` (see `|expr-lambda|`) that returns a list.
'';
example = [
[ "quote #1" ]
["quote #2" "using" "three lines"]
[
"quote #2"
"using"
"three lines"
]
```
'';
];
};
custom_footer =
helpers.mkNullOrOption (with helpers.nixvimTypes; maybeRaw (listOf (maybeRaw str)))
''
custom_footer = helpers.defaultNullOpts.mkListOf' {
type = types.str;
description = ''
Same as the custom header, but shown at the bottom of the startify buffer.
'';
};
disable_at_vimenter = helpers.defaultNullOpts.mkBool false ''
Don't run Startify at Vim startup.

View file

@ -65,7 +65,7 @@ in
'';
margin =
helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) "5"
helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) 5
''
The margin for left or right alignment.
- if < 1 fraction of screen width
@ -179,8 +179,7 @@ in
'';
cursorColumn =
helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive)
"0.5"
helpers.defaultNullOpts.mkNullable (with types; either (numbers.between 0.0 1.0) ints.positive) 0.5
''
- if < 1, fraction of screen width
- if > 1 numbers of column
@ -198,7 +197,7 @@ in
Disable status-, buffer- and tablines.
'';
paddings = helpers.defaultNullOpts.mkNullable (with types; listOf ints.unsigned) "[]" ''
paddings = helpers.defaultNullOpts.mkListOf types.ints.unsigned [ ] ''
Amount of empty lines before each section (must be equal to amount of sections).
'';
};

View file

@ -81,7 +81,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
];
settingsOptions = {
size = helpers.defaultNullOpts.mkStrLuaFnOr types.number "12" ''
size = helpers.defaultNullOpts.mkStrLuaFnOr types.number 12 ''
Size of the terminal.
`size` can be a number or a function.
@ -149,7 +149,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Hide the number column in toggleterm buffers.
'';
shade_filetypes = helpers.defaultNullOpts.mkListOf types.str "[]" ''
shade_filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Shade filetypes.
'';
@ -158,8 +158,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
opened.
'';
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight ''
{
highlights = helpers.defaultNullOpts.mkAttrsOf helpers.nixvimTypes.highlight {
NormalFloat.link = "Normal";
FloatBorder.link = "Normal";
StatusLine.gui = "NONE";
@ -167,8 +166,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
cterm = "italic";
gui = "NONE";
};
}
'' "Highlights which map a highlight group name to an attrs of it's values.";
} "Highlights which map a highlight group name to an attrs of it's values.";
shade_terminals = helpers.defaultNullOpts.mkBool true ''
NOTE: This option takes priority over highlights specified so if you specify Normal
@ -212,7 +210,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Close the terminal window when the process exits.
'';
shell = helpers.defaultNullOpts.mkStr ''{__raw = "vim.o.shell";}'' ''
shell = helpers.defaultNullOpts.mkStr { __raw = "vim.o.shell"; } ''
Change the default shell.
'';

View file

@ -14,7 +14,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
maintainers = [ maintainers.GaetanLepage ];
settingsOptions = {
ft_blocklist = helpers.defaultNullOpts.mkListOf types.str "[]" ''
ft_blocklist = helpers.defaultNullOpts.mkListOf types.str [ ] ''
Filetypes to exclude.
'';

View file

@ -15,7 +15,7 @@ with lib;
treesitterIntegration = {
enable = mkEnableOption "treesitter integration";
disable =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]"
helpers.defaultNullOpts.mkListOf types.str [ ]
"Languages for each to disable this module";
disableVirtualText = helpers.defaultNullOpts.mkBool false ''
@ -66,7 +66,7 @@ with lib;
This is intended to prevent flickering while scrolling with j and k.
'';
};
}) ''{method = "status";}'' "Dictionary controlling the behavior with off-screen matches.";
}) { method = "status"; } "Dictionary controlling the behavior with off-screen matches.";
stopline = helpers.defaultNullOpts.mkInt 400 ''
The number of lines to search in either direction while highlighting matches.
@ -123,9 +123,10 @@ with lib;
textObj = {
enable = helpers.defaultNullOpts.mkBool true "Controls text objects";
linewiseOperators =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["d" "y"]''
"Modify the set of operators which may operate line-wise";
linewiseOperators = helpers.defaultNullOpts.mkListOf types.str [
"d"
"y"
] "Modify the set of operators which may operate line-wise";
};
enableSurround = helpers.defaultNullOpts.mkBool false "To enable the delete surrounding (ds%) and change surrounding (cs%) maps";
@ -138,13 +139,12 @@ with lib;
'';
delimNoSkips =
helpers.defaultNullOpts.mkNullable
(types.enum [
helpers.defaultNullOpts.mkEnumFirstDefault
[
0
1
2
])
"0"
]
''
To disable matching within strings and comments:
- 0: matching is enabled within strings and comments

View file

@ -42,12 +42,12 @@ with lib;
};
};
operators = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) ''{gc = "Comments";}'' ''
operators = helpers.defaultNullOpts.mkAttrsOf types.str { gc = "Comments"; } ''
add operators that will trigger motion and text object completion
to enable all native operators, set the preset / operators plugin above
'';
keyLabels = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) ''{}'' ''
keyLabels = helpers.defaultNullOpts.mkAttrsOf types.str { } ''
override the label used to display some keys. It doesn't effect WK in any other way.
'';
@ -92,15 +92,21 @@ with lib;
"bottom"
"top"
] "";
margin =
helpers.defaultNullOpts.mkNullable spacingOptions ''{top = 1; right = 0; bottom = 1; left = 0;}''
"extra window margin";
padding =
helpers.defaultNullOpts.mkNullable spacingOptions ''{top = 1; right = 2; bottom = 1; left = 2;}''
"extra window padding";
margin = helpers.defaultNullOpts.mkNullable spacingOptions {
top = 1;
right = 0;
bottom = 1;
left = 0;
} "extra window margin";
padding = helpers.defaultNullOpts.mkNullable spacingOptions {
top = 1;
right = 2;
bottom = 1;
left = 2;
} "extra window padding";
winblend = helpers.defaultNullOpts.mkNullable (types.ints.between 0
100
) "0" "0 for fully opaque and 100 for fully transparent";
) 0 "0 for fully opaque and 100 for fully transparent";
};
layout =
@ -137,38 +143,60 @@ with lib;
ignoreMissing = helpers.defaultNullOpts.mkBool false "enable this to hide mappings for which you didn't specify a label";
hidden = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''
["<silent>" "<cmd>" "<Cmd>" "<CR>" "^:" "^ " "^call " "^lua "]
'' "hide mapping boilerplate";
hidden = helpers.defaultNullOpts.mkListOf types.str [
"<silent>"
"<cmd>"
"<Cmd>"
"<CR>"
"^:"
"^ "
"^call "
"^lua "
] "hide mapping boilerplate";
showHelp = helpers.defaultNullOpts.mkBool true "show a help message in the command line for using WhichKey";
showKeys = helpers.defaultNullOpts.mkBool true "show the currently pressed key and its label as a message in the command line";
triggers = helpers.defaultNullOpts.mkNullable (types.either (types.enum [ "auto" ]) (
types.listOf types.str
)) ''"auto"'' "automatically setup triggers, or specify a list manually";
triggers = helpers.defaultNullOpts.mkNullable (
with types; either (enum [ "auto" ]) (listOf str)
) "auto" "automatically setup triggers, or specify a list manually";
triggersNoWait =
helpers.defaultNullOpts.mkNullable (types.listOf types.str)
''["`" "'" "g`" "g'" "\"" "<c-r>" "z="]''
helpers.defaultNullOpts.mkListOf types.str
[
"`"
"'"
"g`"
"g'"
"\""
"<c-r>"
"z="
]
''
list of triggers, where WhichKey should not wait for timeoutlen and show immediately
'';
triggersBlackList =
helpers.defaultNullOpts.mkNullable (types.attrsOf (types.listOf types.str))
''{ i = ["j" "k"]; v = ["j" "k"]}}''
helpers.defaultNullOpts.mkAttrsOf (types.listOf types.str)
{
i = [
"j"
"k"
];
v = [
"j"
"k"
];
}
''
list of mode / prefixes that should never be hooked by WhichKey
this is mostly relevant for keymaps that start with a native binding
'';
disable = {
buftypes =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]"
"Disabled by default for Telescope";
filetypes = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "";
buftypes = helpers.defaultNullOpts.mkListOf types.str [ ] "Disabled by default for Telescope";
filetypes = helpers.defaultNullOpts.mkListOf types.str [ ] "";
};
};

View file

@ -76,20 +76,17 @@ in
'';
modes =
helpers.defaultNullOpts.mkNullable
(
with types;
listOf (enum [
helpers.defaultNullOpts.mkListOf
(types.enum [
"/"
"?"
":"
])
)
''["/" "?"]''
''
List of modes which wilderw will be active in.
Possible elements: '/', '?' and ':'
'';
[
"/"
"?"
]
"List of modes that wilder will be active in.";
wildcharm =
helpers.defaultNullOpts.mkNullable (with types; either str (enum [ false ])) "&wildchar"

View file

@ -45,9 +45,9 @@ in
You can change the storage path using `ring.storagePath` option.
'';
storagePath = helpers.defaultNullOpts.mkNullable (
with types; either str helpers.nixvimTypes.rawLua
) ''{__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";}'' "Only for sqlite storage.";
storagePath = helpers.defaultNullOpts.mkStr {
__raw = "vim.fn.stdpath('data') .. '/databases/yanky.db'";
} "Only for sqlite storage.";
syncWithNumberedRegisters = helpers.defaultNullOpts.mkBool true ''
History can also be synchronized with numbered registers.
@ -68,7 +68,7 @@ in
cursor or content changed.
'';
ignoreRegisters = helpers.defaultNullOpts.mkNullable (with types; listOf str) ''["_"]'' ''
ignoreRegisters = helpers.defaultNullOpts.mkListOf types.str [ "_" ] ''
Define registers to be ignored.
By default the black hole register is ignored.
'';

View file

@ -25,15 +25,18 @@ with lib;
lsp = {
config = helpers.neovim-plugin.extraOptionsOptions // {
cmd = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["zk" "lsp"]'' "";
cmd = helpers.defaultNullOpts.mkListOf types.str [
"zk"
"lsp"
] "";
name = helpers.defaultNullOpts.mkStr "zk" "";
};
autoAttach = {
enabled = helpers.defaultNullOpts.mkBool true "automatically attach buffers in a zk notebook";
filetypes =
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["markdown"]''
"matching the given filetypes";
filetypes = helpers.defaultNullOpts.mkListOf types.str [
"markdown"
] "matching the given filetypes";
};
};
};