mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-12 18:24:35 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -5,12 +5,9 @@
|
|||
# - for `plugins.hydra.hydras.[].config`
|
||||
#
|
||||
# -> https://github.com/nvimtools/hydra.nvim?tab=readme-ov-file#config
|
||||
{ helpers, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
helpers,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
debug = helpers.defaultNullOpts.mkBool false ''
|
||||
Whether to enable debug mode.
|
||||
'';
|
||||
|
@ -19,28 +16,28 @@ with lib; {
|
|||
Set the default exit value for each head in the hydra.
|
||||
'';
|
||||
|
||||
foreign_keys = helpers.defaultNullOpts.mkEnum ["warn" "run"] "null" ''
|
||||
Decides what to do when a key which doesn't belong to any head is pressed
|
||||
- `null`: hydra exits and foreign key behaves normally, as if the hydra wasn't active
|
||||
- `"warn"`: hydra stays active, issues a warning and doesn't run the foreign key
|
||||
- `"run"`: hydra stays active, runs the foreign key
|
||||
'';
|
||||
foreign_keys =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
"warn"
|
||||
"run"
|
||||
]
|
||||
"null"
|
||||
''
|
||||
Decides what to do when a key which doesn't belong to any head is pressed
|
||||
- `null`: hydra exits and foreign key behaves normally, as if the hydra wasn't active
|
||||
- `"warn"`: hydra stays active, issues a warning and doesn't run the foreign key
|
||||
- `"run"`: hydra stays active, runs the foreign key
|
||||
'';
|
||||
|
||||
color = helpers.defaultNullOpts.mkStr "red" ''
|
||||
See `:h hydra-colors`.
|
||||
`"red" | "amaranth" | "teal" | "pink"`
|
||||
'';
|
||||
|
||||
buffer =
|
||||
helpers.defaultNullOpts.mkNullable
|
||||
(
|
||||
with types;
|
||||
either
|
||||
(enum [true])
|
||||
ints.unsigned
|
||||
)
|
||||
"null"
|
||||
"Define a hydra for the given buffer, pass `true` for current buf.";
|
||||
buffer = helpers.defaultNullOpts.mkNullable (
|
||||
with types; either (enum [ true ]) ints.unsigned
|
||||
) "null" "Define a hydra for the given buffer, pass `true` for current buf.";
|
||||
|
||||
invoke_on_body = helpers.defaultNullOpts.mkBool false ''
|
||||
When true, summon the hydra after pressing only the `body` keys.
|
||||
|
@ -73,32 +70,30 @@ with lib; {
|
|||
By default hydras wait forever (`false`).
|
||||
'';
|
||||
|
||||
hint = let
|
||||
hintConfigType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
type =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum
|
||||
[
|
||||
"window"
|
||||
"cmdline"
|
||||
"statusline"
|
||||
"statuslinemanual"
|
||||
])
|
||||
''
|
||||
- "window": show hint in a floating window
|
||||
- "cmdline": show hint in the echo area
|
||||
- "statusline": show auto-generated hint in the status line
|
||||
- "statuslinemanual": Do not show a hint, but return a custom status line hint from
|
||||
`require("hydra.statusline").get_hint()`
|
||||
hint =
|
||||
let
|
||||
hintConfigType = types.submodule {
|
||||
freeformType = with types; attrsOf anything;
|
||||
options = {
|
||||
type =
|
||||
helpers.mkNullOrOption
|
||||
(types.enum [
|
||||
"window"
|
||||
"cmdline"
|
||||
"statusline"
|
||||
"statuslinemanual"
|
||||
])
|
||||
''
|
||||
- "window": show hint in a floating window
|
||||
- "cmdline": show hint in the echo area
|
||||
- "statusline": show auto-generated hint in the status line
|
||||
- "statuslinemanual": Do not show a hint, but return a custom status line hint from
|
||||
`require("hydra.statusline").get_hint()`
|
||||
|
||||
Defaults to "window" if `hint` is passed to the hydra otherwise defaults to "cmdline".
|
||||
'';
|
||||
Defaults to "window" if `hint` is passed to the hydra otherwise defaults to "cmdline".
|
||||
'';
|
||||
|
||||
position =
|
||||
helpers.defaultNullOpts.mkEnum
|
||||
[
|
||||
position = helpers.defaultNullOpts.mkEnum [
|
||||
"top-left"
|
||||
"top"
|
||||
"top-right"
|
||||
|
@ -108,82 +103,74 @@ with lib; {
|
|||
"bottom-left"
|
||||
"bottom"
|
||||
"bottom-right"
|
||||
]
|
||||
"bottom"
|
||||
"Set the position of the hint window.";
|
||||
] "bottom" "Set the position of the hint window.";
|
||||
|
||||
offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offset of the floating window from the nearest editor border.
|
||||
'';
|
||||
|
||||
float_opts = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Options passed to `nvim_open_win()`. See `:h nvim_open_win()`.
|
||||
Lets you set `border`, `header`, `footer`, etc.
|
||||
|
||||
Note: `row`, `col`, `height`, `width`, `relative`, and `anchor` should not be overridden.
|
||||
'';
|
||||
|
||||
show_name = helpers.defaultNullOpts.mkBool true ''
|
||||
Show the hydras name (or "HYDRA:" if not given a name), at the beginning of an
|
||||
auto-generated hint.
|
||||
'';
|
||||
|
||||
hide_on_load = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, this will prevent the hydra's hint window from displaying immediately.
|
||||
|
||||
Note: you can still show the window manually by calling `Hydra.hint:show()` and manually
|
||||
close it with `Hydra.hint:close()`.
|
||||
'';
|
||||
|
||||
funcs = mkOption {
|
||||
type = with helpers.nixvimTypes; attrsOf strLuaFn;
|
||||
description = ''
|
||||
Table from function names to function.
|
||||
Functions should return a string.
|
||||
These functions can be used in hints with `%{func_name}` more in `:h hydra-hint`.
|
||||
offset = helpers.defaultNullOpts.mkInt 0 ''
|
||||
Offset of the floating window from the nearest editor border.
|
||||
'';
|
||||
default = {};
|
||||
example = {
|
||||
number = ''
|
||||
function()
|
||||
if vim.o.number then
|
||||
return '[x]'
|
||||
else
|
||||
return '[ ]'
|
||||
end
|
||||
end
|
||||
|
||||
float_opts = helpers.mkNullOrOption (with types; attrsOf anything) ''
|
||||
Options passed to `nvim_open_win()`. See `:h nvim_open_win()`.
|
||||
Lets you set `border`, `header`, `footer`, etc.
|
||||
|
||||
Note: `row`, `col`, `height`, `width`, `relative`, and `anchor` should not be overridden.
|
||||
'';
|
||||
|
||||
show_name = helpers.defaultNullOpts.mkBool true ''
|
||||
Show the hydras name (or "HYDRA:" if not given a name), at the beginning of an
|
||||
auto-generated hint.
|
||||
'';
|
||||
|
||||
hide_on_load = helpers.defaultNullOpts.mkBool false ''
|
||||
If set to true, this will prevent the hydra's hint window from displaying immediately.
|
||||
|
||||
Note: you can still show the window manually by calling `Hydra.hint:show()` and manually
|
||||
close it with `Hydra.hint:close()`.
|
||||
'';
|
||||
|
||||
funcs = mkOption {
|
||||
type = with helpers.nixvimTypes; attrsOf strLuaFn;
|
||||
description = ''
|
||||
Table from function names to function.
|
||||
Functions should return a string.
|
||||
These functions can be used in hints with `%{func_name}` more in `:h hydra-hint`.
|
||||
'';
|
||||
relativenumber = ''
|
||||
function()
|
||||
if vim.o.relativenumber then
|
||||
return '[x]'
|
||||
else
|
||||
return '[ ]'
|
||||
default = { };
|
||||
example = {
|
||||
number = ''
|
||||
function()
|
||||
if vim.o.number then
|
||||
return '[x]'
|
||||
else
|
||||
return '[ ]'
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
'';
|
||||
relativenumber = ''
|
||||
function()
|
||||
if vim.o.relativenumber then
|
||||
return '[x]'
|
||||
else
|
||||
return '[ ]'
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
apply = mapAttrs (_: helpers.mkRaw);
|
||||
};
|
||||
apply = mapAttrs (_: helpers.mkRaw);
|
||||
};
|
||||
};
|
||||
};
|
||||
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.
|
||||
'';
|
||||
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.
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue