plugins: remove mkCompositeOptions from implementation

This commit is contained in:
Gaetan Lepage 2023-12-09 23:09:50 +01:00 committed by Gaétan Lepage
parent 70b4e2d981
commit d8cffe2ead
13 changed files with 607 additions and 681 deletions

View file

@ -23,17 +23,15 @@ with lib; let
"the button which is clicked to close / save a buffer, or indicate that it is pinned."; "the button which is clicked to close / save a buffer, or indicate that it is pinned.";
diagnostics = diagnostics =
helpers.mkCompositeOption "Diagnostics icons" genAttrs
["error" "warn" "info" "hint"]
( (
genAttrs name:
["error" "warn" "info" "hint"] helpers.mkCompositeOption "${name} diagnostic icon." {
( enable = helpers.defaultNullOpts.mkBool false "Enable the ${name} diagnostic symbol";
name:
helpers.mkCompositeOption "${name} diagnostic icon" { icon = helpers.mkNullOrOption types.str "${name} diagnostic symbol";
enable = helpers.defaultNullOpts.mkBool false "Enable the ${name} diagnostic symbol"; }
icon = helpers.mkNullOrOption types.str "${name} diagnostic symbol";
}
)
); );
filetype = { filetype = {
@ -250,7 +248,7 @@ in {
buffer_index = bufferIndex; buffer_index = bufferIndex;
buffer_number = bufferNumber; buffer_number = bufferNumber;
inherit button; inherit button;
diagnostics = helpers.ifNonNull' bufferOption.diagnostics ( diagnostics =
/* /*
Because the keys of this lua table are not strings (but Because the keys of this lua table are not strings (but
`vim.diagnostic.severity.XXXX`), we have to manualy build a raw lua string here. `vim.diagnostic.severity.XXXX`), we have to manualy build a raw lua string here.
@ -277,8 +275,7 @@ in {
setIconsList setIconsList
) )
+ "}" + "}"
) );
);
filetype = with filetype; { filetype = with filetype; {
custom_color = customColors; custom_color = customColors;
enabled = enable; enabled = enable;

View file

@ -240,19 +240,19 @@ in {
offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets"; offsets = helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "null" "offsets";
groups = helpers.mkCompositeOption "groups" { groups = {
items = items =
helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]" helpers.defaultNullOpts.mkNullable (types.listOf types.attrs) "[]"
"List of groups."; "List of groups.";
options = helpers.mkCompositeOption "Group options" { options = {
toggleHiddenOnEnter = toggleHiddenOnEnter =
helpers.defaultNullOpts.mkBool true helpers.defaultNullOpts.mkBool true
"Re-open hidden groups on bufenter."; "Re-open hidden groups on bufenter.";
}; };
}; };
hover = helpers.mkCompositeOption "Hover" { hover = {
enabled = mkEnableOption "hover"; enabled = mkEnableOption "hover";
reveal = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "reveal"; reveal = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "reveal";
@ -260,7 +260,7 @@ in {
delay = helpers.defaultNullOpts.mkInt 200 "delay"; delay = helpers.defaultNullOpts.mkInt 200 "delay";
}; };
debug = helpers.mkCompositeOption "Debug options" { debug = {
logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging"; logging = helpers.defaultNullOpts.mkBool false "Whether to enable logging";
}; };
@ -319,14 +319,23 @@ in {
diagnostics_indicator = helpers.mkRaw diagnosticsIndicator; diagnostics_indicator = helpers.mkRaw diagnosticsIndicator;
diagnostics_update_in_insert = diagnosticsUpdateInInsert; diagnostics_update_in_insert = diagnosticsUpdateInInsert;
inherit offsets; inherit offsets;
groups = helpers.ifNonNull' groups { groups = {
inherit (groups) items; inherit (groups) items;
options = helpers.ifNonNull' groups.options { options = {
toggle_hidden_on_enter = groups.options.toggleHiddenOnEnter; toggle_hidden_on_enter = groups.options.toggleHiddenOnEnter;
}; };
}; };
inherit hover; hover = {
inherit debug; inherit
(hover)
enabled
reveal
delay
;
};
debug = {
inherit (debug) logging;
};
custom_filter = helpers.mkRaw customFilter; custom_filter = helpers.mkRaw customFilter;
} }
// cfg.extraOptions; // cfg.extraOptions;

View file

@ -58,7 +58,7 @@ in {
package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui; package = helpers.mkPackageOption "dap-ui" pkgs.vimPlugins.nvim-dap-ui;
controls = helpers.mkCompositeOption "Options for dap-ui controls." { controls = {
enabled = helpers.defaultNullOpts.mkBool true "Enable controls"; enabled = helpers.defaultNullOpts.mkBool true "Enable controls";
element = element =
@ -178,7 +178,7 @@ in {
}) })
"Keys to trigger actions in elements."; "Keys to trigger actions in elements.";
render = helpers.mkCompositeOption "Rendering options which can be updated after initial setup." { render = {
indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size."; indent = helpers.defaultNullOpts.mkInt 1 "Default indentation size.";
maxTypeLength = helpers.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming."; maxTypeLength = helpers.mkNullOrOption types.int "Maximum number of characters to allow a type name to fill before trimming.";
@ -206,11 +206,11 @@ in {
force_buffers = forceBuffers; force_buffers = forceBuffers;
render = helpers.ifNonNull' render (with render; { render = with render; {
inherit indent; inherit indent;
max_type_length = maxTypeLength; max_type_length = maxTypeLength;
max_value_lines = maxValueLines; max_value_lines = maxValueLines;
}); };
select_window = helpers.mkRaw selectWindow; select_window = helpers.mkRaw selectWindow;
} }

View file

@ -158,69 +158,60 @@ in {
Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree. Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
''; '';
hijackDirectories = hijackDirectories = {
helpers.mkCompositeOption enable = helpers.defaultNullOpts.mkBool true ''
"Hijacks new directory buffers when they are opened (`:e dir`)." Hijacks new directory buffers when they are opened (`:e dir`).
{
enable = helpers.defaultNullOpts.mkBool true ''
Enable the feature.
Disable this option if you use vim-dirvish or dirbuf.nvim.
If `hijackNetrw` and `disableNetrw` are `false`, this feature will be disabled.
'';
autoOpen = helpers.defaultNullOpts.mkBool true '' Disable this option if you use vim-dirvish or dirbuf.nvim.
Opens the tree if the tree was previously closed. If `hijackNetrw` and `disableNetrw` are `false`, this feature will be disabled.
''; '';
};
updateFocusedFile = autoOpen = helpers.defaultNullOpts.mkBool true ''
helpers.mkCompositeOption Opens the tree if the tree was previously closed.
'' '';
};
updateFocusedFile = {
enable = helpers.defaultNullOpts.mkBool false ''
Update the focused file on `BufEnter`, un-collapses the folders recursively until it finds Update the focused file on `BufEnter`, un-collapses the folders recursively until it finds
the file. the file.
'' '';
{
enable = helpers.defaultNullOpts.mkBool false "Enable this feature.";
updateRoot = helpers.defaultNullOpts.mkBool false '' updateRoot = helpers.defaultNullOpts.mkBool false ''
Update the root directory of the tree if the file is not under current root directory. Update the root directory of the tree if the file is not under current root directory.
It prefers vim's cwd and `root_dirs`. It prefers vim's cwd and `root_dirs`.
Otherwise it falls back to the folder containing the file. Otherwise it falls back to the folder containing the file.
Only relevant when `updateFocusedFile.enable` is `true` Only relevant when `updateFocusedFile.enable` is `true`
''; '';
ignoreList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' ignoreList = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
List of buffer names and filetypes that will not update the root dir of the tree if the List of buffer names and filetypes that will not update the root dir of the tree if the
file isn't found under the current root directory. file isn't found under the current root directory.
Only relevant when `updateFocusedFile.updateRoot` and `updateFocusedFile.enable` are Only relevant when `updateFocusedFile.updateRoot` and `updateFocusedFile.enable` are
`true`. `true`.
''; '';
}; };
systemOpen = systemOpen = {
helpers.mkCompositeOption cmd = helpers.defaultNullOpts.mkStr "" ''
"Open a file or directory in your preferred application." The open command itself.
{
cmd = helpers.defaultNullOpts.mkStr "" ''
The open command itself.
Leave empty for OS specific default: Leave empty for OS specific default:
UNIX: `"xdg-open"` UNIX: `"xdg-open"`
macOS: `"open"` macOS: `"open"`
Windows: "`cmd"` Windows: "`cmd"`
''; '';
args = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' args = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
Optional argument list. Optional argument list.
Leave empty for OS specific default: Leave empty for OS specific default:
Windows: `{ "/c", "start", '""' }` Windows: `{ "/c", "start", '""' }`
''; '';
}; };
diagnostics = diagnostics = {
helpers.mkCompositeOption enable = helpers.defaultNullOpts.mkBool false ''
''
Show LSP and COC diagnostics in the signcolumn Show LSP and COC diagnostics in the signcolumn
Note that the modified sign will take precedence over the diagnostics signs. Note that the modified sign will take precedence over the diagnostics signs.
@ -230,46 +221,46 @@ in {
- `NvimTreeLspDiagnosticsWarning` - `NvimTreeLspDiagnosticsWarning`
- `NvimTreeLspDiagnosticsInformation` - `NvimTreeLspDiagnosticsInformation`
- `NvimTreeLspDiagnosticsHint` - `NvimTreeLspDiagnosticsHint`
'' '';
{
enable = helpers.defaultNullOpts.mkBool false "Enable/disable the feature.";
debounceDelay = helpers.defaultNullOpts.mkInt 50 '' debounceDelay = helpers.defaultNullOpts.mkInt 50 ''
Idle milliseconds between diagnostic event and update. Idle milliseconds between diagnostic event and update.
''; '';
showOnDirs = helpers.defaultNullOpts.mkBool false '' showOnDirs = helpers.defaultNullOpts.mkBool false ''
Show diagnostic icons on parent directories. Show diagnostic icons on parent directories.
''; '';
showOnOpenDirs = helpers.defaultNullOpts.mkBool true '' showOnOpenDirs = helpers.defaultNullOpts.mkBool true ''
Show diagnostics icons on directories that are open. Show diagnostics icons on directories that are open.
Only relevant when `diagnostics.showOnDirs` is `true Only relevant when `diagnostics.showOnDirs` is `true
''; '';
icons = helpers.mkCompositeOption "Icons for diagnostic severity." { icons = {
hint = helpers.defaultNullOpts.mkStr "" ""; hint = helpers.defaultNullOpts.mkStr "" "";
info = helpers.defaultNullOpts.mkStr "" ""; info = helpers.defaultNullOpts.mkStr "" "";
warning = helpers.defaultNullOpts.mkStr "" ""; warning = helpers.defaultNullOpts.mkStr "" "";
error = helpers.defaultNullOpts.mkStr "" ""; error = helpers.defaultNullOpts.mkStr "" "";
};
severity = let
severityEnum = ["error" "warn" "info" "hint"];
in
helpers.mkCompositeOption
''
Severity for which the diagnostics will be displayed.
See |diagnostic-severity|.
''
{
min = helpers.defaultNullOpts.mkEnum severityEnum "hint" "Minimum severity.";
max = helpers.defaultNullOpts.mkEnum severityEnum "error" "Maximum severity.";
};
}; };
git = helpers.mkCompositeOption "Git integration with icons and colors." { severity = let
enable = helpers.defaultNullOpts.mkBool true "Enable / disable the feature."; severityEnum = ["error" "warn" "info" "hint"];
in {
min = helpers.defaultNullOpts.mkEnum severityEnum "hint" ''
Minimum severity for which the diagnostics will be displayed.
See `|diagnostic-severity|`.
'';
max = helpers.defaultNullOpts.mkEnum severityEnum "error" ''
Maximum severity for which the diagnostics will be displayed.
See `|diagnostic-severity|`.
'';
};
};
git = {
enable = helpers.defaultNullOpts.mkBool true ''
Git integration with icons and colors.
'';
ignore = helpers.defaultNullOpts.mkBool true '' ignore = helpers.defaultNullOpts.mkBool true ''
Ignore files based on `.gitignore`. Requires `git.enable` to be `true`. Ignore files based on `.gitignore`. Requires `git.enable` to be `true`.
@ -290,8 +281,10 @@ in {
''; '';
}; };
modified = helpers.mkCompositeOption "Indicate which file have unsaved modification." { modified = {
enable = helpers.defaultNullOpts.mkBool false "Enable / disable the feature."; enable = helpers.defaultNullOpts.mkBool false ''
Indicate which file have unsaved modification.
'';
showOnDirs = helpers.defaultNullOpts.mkBool true '' showOnDirs = helpers.defaultNullOpts.mkBool true ''
Show modified indication on directory whose children are modified. Show modified indication on directory whose children are modified.
@ -303,29 +296,26 @@ in {
''; '';
}; };
filesystemWatchers = filesystemWatchers = {
helpers.mkCompositeOption enable = helpers.defaultNullOpts.mkBool true ''
''
Will use file system watcher (libuv fs_event) to watch the filesystem for changes. Will use file system watcher (libuv fs_event) to watch the filesystem for changes.
Using this will disable BufEnter / BufWritePost events in nvim-tree which were used to Using this will disable BufEnter / BufWritePost events in nvim-tree which were used to
update the whole tree. update the whole tree.
With this feature, the tree will be updated only for the appropriate folder change, With this feature, the tree will be updated only for the appropriate folder change,
resulting in better performance. resulting in better performance.
'' '';
{
enable = helpers.defaultNullOpts.mkBool true "Enable / disable the feature.";
debounceDelay = helpers.defaultNullOpts.mkInt 50 '' debounceDelay = helpers.defaultNullOpts.mkInt 50 ''
Idle milliseconds between filesystem change and action. Idle milliseconds between filesystem change and action.
''; '';
ignoreDirs = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' ignoreDirs = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
List of vim regex for absolute directory paths that will not be watched. List of vim regex for absolute directory paths that will not be watched.
Backslashes must be escaped e.g. `"my-project/\\.build$"`. Backslashes must be escaped e.g. `"my-project/\\.build$"`.
See |string-match|. See |string-match|.
Useful when path is not in `.gitignore` or git integration is disabled. Useful when path is not in `.gitignore` or git integration is disabled.
''; '';
}; };
onAttach = onAttach =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
@ -425,7 +415,7 @@ in {
Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`. Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`.
''; '';
float = helpers.mkCompositeOption "Configuration options for floating window." { float = {
enable = helpers.defaultNullOpts.mkBool false '' enable = helpers.defaultNullOpts.mkBool false ''
Tree window will be floating. Tree window will be floating.
''; '';
@ -438,7 +428,7 @@ in {
}; };
}; };
renderer = helpers.mkCompositeOption "UI rendering setup" { renderer = {
addTrailing = helpers.defaultNullOpts.mkBool false '' addTrailing = helpers.defaultNullOpts.mkBool false ''
Appends a trailing slash to folder names. Appends a trailing slash to folder names.
''; '';
@ -505,7 +495,7 @@ in {
Number of spaces for an each tree nesting level. Minimum 1. Number of spaces for an each tree nesting level. Minimum 1.
''; '';
indentMarkers = helpers.mkCompositeOption "Configuration options for tree indent markers." { indentMarkers = {
enable = helpers.defaultNullOpts.mkBool false '' enable = helpers.defaultNullOpts.mkBool false ''
Display indent markers when folders are open Display indent markers when folders are open
''; '';
@ -515,7 +505,7 @@ in {
|renderer.icons.show.folder_arrow|. |renderer.icons.show.folder_arrow|.
''; '';
icons = helpers.mkCompositeOption "Icons shown before the file/directory. Length 1." { icons = {
corner = helpers.defaultNullOpts.mkStr "" ""; corner = helpers.defaultNullOpts.mkStr "" "";
edge = helpers.defaultNullOpts.mkStr "" ""; edge = helpers.defaultNullOpts.mkStr "" "";
item = helpers.defaultNullOpts.mkStr "" ""; item = helpers.defaultNullOpts.mkStr "" "";
@ -524,7 +514,7 @@ in {
}; };
}; };
icons = helpers.mkCompositeOption "Configuration options for icons." { icons = {
webdevColors = helpers.defaultNullOpts.mkBool true '' webdevColors = helpers.defaultNullOpts.mkBool true ''
Use the webdev icon colors, otherwise `NvimTreeFileIcon`. Use the webdev icon colors, otherwise `NvimTreeFileIcon`.
''; '';
@ -559,7 +549,7 @@ in {
Used as a separator between symlinks' source and target. Used as a separator between symlinks' source and target.
''; '';
show = helpers.mkCompositeOption "Configuration options for showing icon types." { show = {
file = helpers.defaultNullOpts.mkBool true '' file = helpers.defaultNullOpts.mkBool true ''
Show an icon before the file name. `nvim-web-devicons` will be used if available. Show an icon before the file name. `nvim-web-devicons` will be used if available.
''; '';
@ -584,7 +574,7 @@ in {
''; '';
}; };
glyphs = helpers.mkCompositeOption "Configuration options for icon glyphs." { glyphs = {
default = helpers.defaultNullOpts.mkStr "" '' default = helpers.defaultNullOpts.mkStr "" ''
Glyph for files. Will be overridden by `nvim-web-devicons` if available. Glyph for files. Will be overridden by `nvim-web-devicons` if available.
''; '';
@ -597,7 +587,7 @@ in {
Icon to display for modified files. Icon to display for modified files.
''; '';
folder = helpers.mkCompositeOption "Glyphs for directories." { folder = {
arrowClosed = helpers.defaultNullOpts.mkStr "" '' arrowClosed = helpers.defaultNullOpts.mkStr "" ''
Arrow glyphs for closed directories. Arrow glyphs for closed directories.
''; '';
@ -624,7 +614,7 @@ in {
''; '';
}; };
git = helpers.mkCompositeOption "Glyphs for git status." { git = {
unstaged = helpers.defaultNullOpts.mkStr "" '' unstaged = helpers.defaultNullOpts.mkStr "" ''
Glyph for unstaged nodes. Glyph for unstaged nodes.
''; '';
@ -661,7 +651,7 @@ in {
''; '';
}; };
filters = helpers.mkCompositeOption "Filtering options." { filters = {
dotfiles = helpers.defaultNullOpts.mkBool false '' dotfiles = helpers.defaultNullOpts.mkBool false ''
Do not show dotfiles: files starting with a `.` Do not show dotfiles: files starting with a `.`
Toggle via the `toggle_dotfiles` action, default mapping `H`. Toggle via the `toggle_dotfiles` action, default mapping `H`.
@ -692,7 +682,7 @@ in {
''; '';
}; };
trash = helpers.mkCompositeOption "Configuration options for trashing." { trash = {
cmd = helpers.defaultNullOpts.mkStr "gio trash" '' cmd = helpers.defaultNullOpts.mkStr "gio trash" ''
The command used to trash items (must be installed on your system). The command used to trash items (must be installed on your system).
The default is shipped with glib2 which is a common linux package. The default is shipped with glib2 which is a common linux package.
@ -700,8 +690,8 @@ in {
''; '';
}; };
actions = helpers.mkCompositeOption "Configuration for various actions." { actions = {
changeDir = helpers.mkCompositeOption "vim |current-directory| behaviour." { changeDir = {
enable = helpers.defaultNullOpts.mkBool true '' enable = helpers.defaultNullOpts.mkBool true ''
Change the working directory when changing directories in the tree. Change the working directory when changing directories in the tree.
''; '';
@ -716,7 +706,7 @@ in {
''; '';
}; };
expandAll = helpers.mkCompositeOption "Configuration for expand_all behaviour." { expandAll = {
maxFolderDiscovery = helpers.defaultNullOpts.mkInt 300 '' maxFolderDiscovery = helpers.defaultNullOpts.mkInt 300 ''
Limit the number of folders being explored when expanding every folders. Limit the number of folders being explored when expanding every folders.
Avoids hanging neovim when running this action on very large folders. Avoids hanging neovim when running this action on very large folders.
@ -728,28 +718,26 @@ in {
''; '';
}; };
filePopup = helpers.mkCompositeOption "Configuration for file_popup behaviour." { filePopup = {
openWinConfig = openWinConfigOption; openWinConfig = openWinConfigOption;
}; };
openFile = openFile = {
helpers.mkCompositeOption quitOnOpen = helpers.defaultNullOpts.mkBool false ''
"Configuration options for opening a file from nvim-tree." Closes the explorer when opening a file.
{ It will also disable preventing a buffer overriding the tree.
quitOnOpen = helpers.defaultNullOpts.mkBool false '' '';
Closes the explorer when opening a file.
It will also disable preventing a buffer overriding the tree.
'';
resizeWindow = helpers.defaultNullOpts.mkBool true '' resizeWindow = helpers.defaultNullOpts.mkBool true ''
Resizes the tree when opening a file. Resizes the tree when opening a file.
''; '';
}; };
windowPicker = helpers.mkCompositeOption "Window picker configuration." { windowPicker = {
enable = helpers.defaultNullOpts.mkBool true '' enable = helpers.defaultNullOpts.mkBool true ''
Enable the feature. If the feature is not enabled, files will open in window from Enable the window picker.
which you last opened the tree. If the feature is not enabled, files will open in window from which you last opened the
tree.
''; '';
picker = picker =
@ -783,7 +771,7 @@ in {
''; '';
}; };
removeFile = helpers.mkCompositeOption "" { removeFile = {
closeWindow = helpers.defaultNullOpts.mkBool true '' closeWindow = helpers.defaultNullOpts.mkBool true ''
Close any window displaying a file when removing the file from the tree. Close any window displaying a file when removing the file from the tree.
''; '';
@ -797,27 +785,18 @@ in {
''; '';
}; };
liveFilter = liveFilter = {
helpers.mkCompositeOption prefix = helpers.defaultNullOpts.mkStr "[FILTER]: " ''
'' Prefix of the filter displayed in the buffer.
Configurations for the live_filtering feature. '';
The live filter allows you to filter the tree nodes dynamically, based on regex matching
(see |vim.regex|).
This feature is bound to the `f` key by default.
The filter can be cleared with the `F` key by default.
''
{
prefix = helpers.defaultNullOpts.mkStr "[FILTER]: " ''
Prefix of the filter displayed in the buffer.
'';
alwaysShowFolders = helpers.defaultNullOpts.mkBool true '' alwaysShowFolders = helpers.defaultNullOpts.mkBool true ''
Whether to filter folders or not. Whether to filter folders or not.
''; '';
}; };
tab = helpers.mkCompositeOption "Configuration for tab behaviour." { tab = {
sync = helpers.mkCompositeOption "Configuration for syncing nvim-tree across tabs." { sync = {
open = helpers.defaultNullOpts.mkBool false '' open = helpers.defaultNullOpts.mkBool false ''
Opens the tree automatically when switching tabpage or opening a new tabpage if the tree Opens the tree automatically when switching tabpage or opening a new tabpage if the tree
was previously open. was previously open.
@ -827,14 +806,14 @@ in {
Closes the tree across all tabpages when the tree is closed. Closes the tree across all tabpages when the tree is closed.
''; '';
ignore = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' ignore = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
List of filetypes or buffer names on new tab that will prevent List of filetypes or buffer names on new tab that will prevent
|nvim-tree.tab.sync.open| and |nvim-tree.tab.sync.close| |nvim-tree.tab.sync.open| and |nvim-tree.tab.sync.close|
''; '';
}; };
}; };
notify = helpers.mkCompositeOption "Configuration for notification." { notify = {
threshold = helpers.defaultNullOpts.mkEnum ["error" "warning" "info" "debug"] "info" '' threshold = helpers.defaultNullOpts.mkEnum ["error" "warning" "info" "debug"] "info" ''
Specify minimum notification level, uses the values from |vim.log.levels| Specify minimum notification level, uses the values from |vim.log.levels|
@ -845,8 +824,8 @@ in {
''; '';
}; };
ui = helpers.mkCompositeOption "General UI configuration." { ui = {
confirm = helpers.mkCompositeOption "Confirmation prompts." { confirm = {
remove = helpers.defaultNullOpts.mkBool true '' remove = helpers.defaultNullOpts.mkBool true ''
Prompt before removing. Prompt before removing.
''; '';
@ -857,7 +836,7 @@ in {
}; };
}; };
log = helpers.mkCompositeOption "Configuration for diagnostic logging." { log = {
enable = helpers.defaultNullOpts.mkBool false '' enable = helpers.defaultNullOpts.mkBool false ''
Enable logging to a file `$XDG_CACHE_HOME/nvim/nvim-tree.log` Enable logging to a file `$XDG_CACHE_HOME/nvim/nvim-tree.log`
''; '';
@ -866,7 +845,7 @@ in {
Remove existing log file at startup. Remove existing log file at startup.
''; '';
types = helpers.mkCompositeOption "Specify which information to log." { types = {
all = helpers.defaultNullOpts.mkBool false "Everything."; all = helpers.defaultNullOpts.mkBool false "Everything.";
profile = helpers.defaultNullOpts.mkBool false "Timing of some operations."; profile = helpers.defaultNullOpts.mkBool false "Timing of some operations.";
@ -904,54 +883,47 @@ in {
sync_root_with_cwd = syncRootWithCwd; sync_root_with_cwd = syncRootWithCwd;
reload_on_bufenter = reloadOnBufenter; reload_on_bufenter = reloadOnBufenter;
respect_buf_cwd = respectBufCwd; respect_buf_cwd = respectBufCwd;
hijack_directories = with hijackDirectories; hijack_directories = with hijackDirectories; {
ifNonNull' cfg.hijackDirectories { inherit enable;
inherit enable; auto_open = autoOpenEnabled;
auto_open = autoOpenEnabled; };
}; update_focused_file = with updateFocusedFile; {
update_focused_file = with updateFocusedFile; inherit enable;
ifNonNull' cfg.updateFocusedFile { update_root = updateRoot;
inherit enable; ignore_list = ignoreList;
update_root = updateRoot; };
ignore_list = ignoreList;
};
system_open = systemOpen; system_open = systemOpen;
diagnostics = with diagnostics; diagnostics = with diagnostics; {
ifNonNull' cfg.diagnostics { inherit enable;
inherit enable; debounce_delay = debounceDelay;
debounce_delay = debounceDelay; show_on_dirs = showOnDirs;
show_on_dirs = showOnDirs; show_on_open_dirs = showOnOpenDirs;
show_on_open_dirs = showOnOpenDirs; inherit icons;
inherit icons; severity =
severity = ifNonNull' cfg.diagnostics.severity ( mapAttrs (
mapAttrs ( name: value:
name: value: ifNonNull' value
ifNonNull' value (helpers.mkRaw "vim.diagnostic.severity.${strings.toUpper value}")
(helpers.mkRaw "vim.diagnostic.severity.${strings.toUpper value}") )
) severity;
severity };
); git = with git; {
}; inherit enable;
git = with git; inherit ignore;
ifNonNull' cfg.git { show_on_dirs = showOnDirs;
inherit enable; show_on_open_dirs = showOnOpenDirs;
inherit ignore; inherit timeout;
show_on_dirs = showOnDirs; };
show_on_open_dirs = showOnOpenDirs; modified = with modified; {
inherit timeout; inherit enable;
}; show_on_dirs = showOnDirs;
modified = with modified; show_on_open_dirs = showOnOpenDirs;
ifNonNull' cfg.modified { };
inherit enable; filesystem_watchers = with filesystemWatchers; {
show_on_dirs = showOnDirs; inherit enable;
show_on_open_dirs = showOnOpenDirs; debounce_delay = debounceDelay;
}; ignore_dirs = ignoreDirs;
filesystem_watchers = with filesystemWatchers; };
ifNonNull' cfg.filesystemWatchers {
inherit enable;
debounce_delay = debounceDelay;
ignore_dirs = ignoreDirs;
};
on_attach = onAttach; on_attach = onAttach;
select_prompts = selectPrompts; select_prompts = selectPrompts;
view = with view; { view = with view; {
@ -964,114 +936,96 @@ in {
inherit number; inherit number;
inherit relativenumber; inherit relativenumber;
inherit signcolumn; inherit signcolumn;
float = with float; float = with float; {
ifNonNull' cfg.view.float { inherit enable;
inherit enable; quit_on_focus_loss = quitOnFocusLoss;
quit_on_focus_loss = quitOnFocusLoss; open_win_config = openWinConfig;
open_win_config = openWinConfig; };
};
}; };
renderer = with renderer; renderer = with renderer; {
ifNonNull' cfg.renderer { add_trailing = addTrailing;
add_trailing = addTrailing; group_empty = groupEmpty;
group_empty = groupEmpty; full_name = fullName;
full_name = fullName; highlight_git = highlightGit;
highlight_git = highlightGit; highlight_opened_files = highlightOpenedFiles;
highlight_opened_files = highlightOpenedFiles; highlight_modified = highlightModified;
highlight_modified = highlightModified; root_folder_label = rootFolderLabel;
root_folder_label = rootFolderLabel; indent_width = indentWidth;
indent_width = indentWidth; indent_markers = with indentMarkers; {
indent_markers = with indentMarkers; inherit enable icons;
ifNonNull' cfg.renderer.indentMarkers { inline_arrows = inlineArrows;
inherit enable icons;
inline_arrows = inlineArrows;
};
icons = with icons;
ifNonNull' cfg.renderer.icons {
webdev_colors = webdevColors;
git_placement = gitPlacement;
modified_placement = modifiedPlacement;
inherit padding;
symlink_arrow = symlinkArrow;
show = with show;
ifNonNull' cfg.renderer.icons.show {
inherit file folder git modified;
folder_arrow = folderArrow;
};
glyphs = with glyphs;
ifNonNull' cfg.renderer.icons.glyphs {
inherit default symlink modified git;
folder = with folder; {
arrow_closed = arrowClosed;
arrow_open = arrowOpen;
inherit default open empty symlink;
empty_open = emptyOpen;
symlink_open = symlinkOpen;
};
};
};
special_files = specialFiles;
symlink_destination = symlinkDestination;
}; };
filters = with filters; icons = with icons; {
ifNonNull' cfg.filters { webdev_colors = webdevColors;
inherit dotfiles custom exclude; git_placement = gitPlacement;
git_clean = gitClean; modified_placement = modifiedPlacement;
no_buffer = noBuffer; inherit padding;
symlink_arrow = symlinkArrow;
show = with show; {
inherit file folder git modified;
folder_arrow = folderArrow;
};
glyphs = with glyphs; {
inherit default symlink modified git;
folder = with folder; {
arrow_closed = arrowClosed;
arrow_open = arrowOpen;
inherit default open empty symlink;
empty_open = emptyOpen;
symlink_open = symlinkOpen;
};
};
}; };
special_files = specialFiles;
symlink_destination = symlinkDestination;
};
filters = with filters; {
inherit dotfiles custom exclude;
git_clean = gitClean;
no_buffer = noBuffer;
};
inherit trash; inherit trash;
actions = with actions; actions = with actions; {
ifNonNull' cfg.actions { change_dir = with changeDir; {
change_dir = with changeDir; inherit enable global;
ifNonNull' cfg.actions.changeDir { restrict_above_cwd = restrictAboveCwd;
inherit enable global;
restrict_above_cwd = restrictAboveCwd;
};
expand_all = with expandAll;
ifNonNull' cfg.actions.expandAll {
max_folder_discovery = maxFolderDiscovery;
inherit exclude;
};
file_popup = with filePopup;
ifNonNull' cfg.actions.filePopup {
open_win_config = filePopup.openWinConfig;
};
open_file = with openFile;
ifNonNull' cfg.actions.openFile {
quit_on_open = quitOnOpen;
resize_window = resizeWindow;
window_picker = windowPicker;
};
remove_file = with removeFile;
ifNonNull' cfg.actions.removeFile {
close_window = removeFile.closeWindow;
};
use_system_clipboard = useSystemClipboard;
}; };
live_filter = with liveFilter; expand_all = with expandAll; {
ifNonNull' cfg.liveFilter { max_folder_discovery = maxFolderDiscovery;
inherit prefix; inherit exclude;
always_show_folders = alwaysShowFolders;
}; };
file_popup = with filePopup; {
open_win_config = openWinConfig;
};
open_file = with openFile; {
quit_on_open = quitOnOpen;
resize_window = resizeWindow;
window_picker = windowPicker;
};
remove_file = with removeFile; {
close_window = closeWindow;
};
use_system_clipboard = useSystemClipboard;
};
live_filter = with liveFilter; {
inherit prefix;
always_show_folders = alwaysShowFolders;
};
inherit tab; inherit tab;
notify = with notify; notify = with notify; {
ifNonNull' cfg.notify { threshold =
threshold = ifNonNull' cfg.notify.threshold
ifNonNull' cfg.notify.threshold (helpers.mkRaw "vim.log.levels.${strings.toUpper notify.threshold}");
(helpers.mkRaw "vim.log.levels.${strings.toUpper notify.threshold}"); };
};
inherit ui; inherit ui;
log = with log; log = with log; {
ifNonNull' cfg.log { inherit enable truncate;
inherit enable truncate; types = with log.types; {
types = ifNonNull' log.types ( inherit all profile dev diagnostics git watcher;
with log.types; { inherit (log.types) config;
inherit all profile dev diagnostics git watcher; copy_paste = copyPaste;
inherit (log.types) config;
copy_paste = copyPaste;
}
);
}; };
};
} }
// cfg.extraOptions; // cfg.extraOptions;

View file

@ -51,7 +51,7 @@ in {
A custom vim function name to open preview page. This function will receive url as param. A custom vim function name to open preview page. This function will receive url as param.
''; '';
previewOptions = helpers.mkCompositeOption "Options for markdown render" { previewOptions = {
mkit = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it options for render"; mkit = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it options for render";
katex = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "katex options for math"; katex = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "katex options for math";
uml = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it-plantuml options"; uml = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" "markdown-it-plantuml options";
@ -108,7 +108,7 @@ in {
mkdp_browser = mkIf (cfg.browser != null) cfg.browser; mkdp_browser = mkIf (cfg.browser != null) cfg.browser;
mkdp_echo_preview_url = mkIf (cfg.echoPreviewUrl != null) cfg.echoPreviewUrl; mkdp_echo_preview_url = mkIf (cfg.echoPreviewUrl != null) cfg.echoPreviewUrl;
mkdp_browserfunc = mkIf (cfg.browserFunc != null) cfg.browserFunc; mkdp_browserfunc = mkIf (cfg.browserFunc != null) cfg.browserFunc;
mkdp_preview_options = mkIf (cfg.previewOptions != null) cfg.previewOptions; mkdp_preview_options = cfg.previewOptions;
mkdp_markdown_css = mkIf (cfg.markdownCss != null) cfg.markdownCss; mkdp_markdown_css = mkIf (cfg.markdownCss != null) cfg.markdownCss;
mkdp_highlight_css = mkIf (cfg.highlightCss != null) cfg.highlightCss; mkdp_highlight_css = mkIf (cfg.highlightCss != null) cfg.highlightCss;
mkdp_port = mkIf (cfg.port != null) cfg.port; mkdp_port = mkIf (cfg.port != null) cfg.port;

View file

@ -35,7 +35,7 @@ in {
Automatically call RustReloadWorkspace when writing to a Cargo.toml file. Automatically call RustReloadWorkspace when writing to a Cargo.toml file.
''; '';
inlayHints = helpers.mkCompositeOption "inlay hints" { inlayHints = {
auto = helpers.defaultNullOpts.mkBool true "automatically set inlay hints (type hints)"; auto = helpers.defaultNullOpts.mkBool true "automatically set inlay hints (type hints)";
onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show for current line"; onlyCurrentLine = helpers.defaultNullOpts.mkBool false "Only show for current line";
@ -71,7 +71,7 @@ in {
highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints"; highlight = helpers.defaultNullOpts.mkStr "Comment" "The color of the hints";
}; };
hoverActions = helpers.mkCompositeOption "hover actions" { hoverActions = {
border = border =
helpers.defaultNullOpts.mkBorder '' helpers.defaultNullOpts.mkBorder ''
[ [
@ -100,7 +100,7 @@ in {
"whether the hover action window gets automatically focused"; "whether the hover action window gets automatically focused";
}; };
crateGraph = helpers.mkCompositeOption "create graph" { crateGraph = {
backend = helpers.defaultNullOpts.mkStr "x11" '' backend = helpers.defaultNullOpts.mkStr "x11" ''
Backend used for displaying the graph Backend used for displaying the graph
see: https://graphviz.org/docs/outputs/ see: https://graphviz.org/docs/outputs/
@ -146,34 +146,30 @@ in {
on_initialized = helpers.mkRaw cfg.onInitialized; on_initialized = helpers.mkRaw cfg.onInitialized;
reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml; reload_workspace_from_cargo_toml = cfg.reloadWorkspaceFromCargoToml;
inlay_hints = with cfg.inlayHints; inlay_hints = with cfg.inlayHints; {
helpers.ifNonNull' cfg.inlayHints { inherit auto;
inherit auto; only_current_line = onlyCurrentLine;
only_current_line = onlyCurrentLine; show_parameter_hints = showParameterHints;
show_parameter_hints = showParameterHints; parameter_hints_prefix = parameterHintsPrefix;
parameter_hints_prefix = parameterHintsPrefix; other_hints_prefix = otherHintsPrefix;
other_hints_prefix = otherHintsPrefix; max_len_align = maxLenAlign;
max_len_align = maxLenAlign; max_len_align_padding = maxLenAlignPadding;
max_len_align_padding = maxLenAlignPadding; right_align = rightAlign;
right_align = rightAlign; right_align_padding = rightAlignPadding;
right_align_padding = rightAlignPadding; inherit highlight;
inherit highlight; };
};
hover_actions = with cfg.hoverActions; hover_actions = with cfg.hoverActions; {
helpers.ifNonNull' cfg.hoverActions inherit border;
{ max_width = maxWidth;
inherit border; max_height = maxHeight;
max_width = maxWidth; auto_focus = autoFocus;
max_height = maxHeight; };
auto_focus = autoFocus;
};
crate_graph = with cfg.crateGraph; crate_graph = with cfg.crateGraph; {
helpers.ifNonNull' cfg.crateGraph { inherit backend output full;
inherit backend output full; enabled_graphviz_backends = enabledGraphvizBackends;
enabled_graphviz_backends = enabledGraphvizBackends; };
};
}; };
server = { server = {
inherit (cfg.server) standalone; inherit (cfg.server) standalone;

View file

@ -56,7 +56,7 @@ in {
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["VirtualTextOk"]'' helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["VirtualTextOk"]''
"Display modes used in live_mode"; "Display modes used in live_mode";
displayOptions = helpers.mkCompositeOption "Display options" { displayOptions = {
terminalWidth = terminalWidth =
helpers.defaultNullOpts.mkInt 45 helpers.defaultNullOpts.mkInt 45
"Change the terminal display option width."; "Change the terminal display option width.";
@ -77,42 +77,37 @@ in {
bg ? "", bg ? "",
ctermbg ? "", ctermbg ? "",
ctermfg ? "", ctermfg ? "",
}: }: {
helpers.mkCompositeOption "" { bg = helpers.defaultNullOpts.mkStr fg "Background color";
bg = helpers.defaultNullOpts.mkStr fg "Background color"; fg = helpers.defaultNullOpts.mkStr bg "Foreground color";
fg = helpers.defaultNullOpts.mkStr bg "Foreground color"; ctermbg = helpers.defaultNullOpts.mkStr ctermbg "Foreground color";
ctermbg = helpers.defaultNullOpts.mkStr ctermbg "Foreground color"; ctermfg = helpers.defaultNullOpts.mkStr ctermfg "Foreground color";
ctermfg = helpers.defaultNullOpts.mkStr ctermfg "Foreground color"; };
};
in in
helpers.mkCompositeOption mapAttrs
"Customize highlight groups (setting this overrides colorscheme)" (optionName: colorOption)
( {
mapAttrs SniprunVirtualTextOk = {
(optionName: colorOption) bg = "#66eeff";
{ fg = "#000000";
SniprunVirtualTextOk = { ctermbg = "Cyan";
bg = "#66eeff"; ctermfg = "Black";
fg = "#000000"; };
ctermbg = "Cyan"; SniprunFloatingWinOk = {
ctermfg = "Black"; fg = "#66eeff";
}; ctermfg = "Cyan";
SniprunFloatingWinOk = { };
fg = "#66eeff"; SniprunVirtualTextErr = {
ctermfg = "Cyan"; bg = "#881515";
}; fg = "#000000";
SniprunVirtualTextErr = { ctermbg = "DarkRed";
bg = "#881515"; ctermfg = "Black";
fg = "#000000"; };
ctermbg = "DarkRed"; SniprunFloatingWinErr = {
ctermfg = "Black"; fg = "#881515";
}; ctermfg = "DarkRed";
SniprunFloatingWinErr = { };
fg = "#881515"; };
ctermfg = "DarkRed";
};
}
);
liveModeToggle = liveModeToggle =
helpers.defaultNullOpts.mkStr "off" helpers.defaultNullOpts.mkStr "off"
@ -144,11 +139,10 @@ in {
interpreter_options = cfg.interpreterOptions; interpreter_options = cfg.interpreterOptions;
inherit (cfg) display; inherit (cfg) display;
live_display = cfg.liveDisplay; live_display = cfg.liveDisplay;
display_options = with cfg.displayOptions; display_options = with cfg.displayOptions; {
helpers.ifNonNull' cfg.displayOptions { terminal_width = terminalWidth;
terminal_width = terminalWidth; notification_timeout = notificationTimeout;
notification_timeout = notificationTimeout; };
};
show_no_output = cfg.showNoOutput; show_no_output = cfg.showNoOutput;
inherit (cfg) snipruncolors; inherit (cfg) snipruncolors;
live_mode_toggle = cfg.liveModeToggle; live_mode_toggle = cfg.liveModeToggle;

View file

@ -16,7 +16,7 @@ in {
package = helpers.mkPackageOption "fidget" pkgs.vimPlugins.fidget-nvim; package = helpers.mkPackageOption "fidget" pkgs.vimPlugins.fidget-nvim;
text = helpers.mkCompositeOption "Fidget text options." { text = {
spinner = spinner =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.either (types.either
@ -75,7 +75,7 @@ in {
''; '';
}; };
align = helpers.mkCompositeOption "Fidget alignment options." { align = {
bottom = helpers.defaultNullOpts.mkBool true '' bottom = helpers.defaultNullOpts.mkBool true ''
Whether to align fidgets along the bottom edge of each buffer. Whether to align fidgets along the bottom edge of each buffer.
''; '';
@ -88,7 +88,7 @@ in {
''; '';
}; };
timer = helpers.mkCompositeOption "Fidget timing options." { timer = {
spinnerRate = helpers.defaultNullOpts.mkNum 125 '' spinnerRate = helpers.defaultNullOpts.mkNum 125 ''
Duration of each frame of the spinner animation, in ms. Set to Duration of each frame of the spinner animation, in ms. Set to
`0` to only use the first frame of the spinner animation. `0` to only use the first frame of the spinner animation.
@ -109,7 +109,7 @@ in {
''; '';
}; };
window = helpers.mkCompositeOption "Windowing rules options." { window = {
relative = helpers.defaultNullOpts.mkEnum ["win" "editor"] "win" '' relative = helpers.defaultNullOpts.mkEnum ["win" "editor"] "win" ''
Whether to position the window relative to the current window, Whether to position the window relative to the current window,
or the editor. Valid values are `"win"` or `"editor"`. or the editor. Valid values are `"win"` or `"editor"`.
@ -129,7 +129,7 @@ in {
''; '';
}; };
fmt = helpers.mkCompositeOption "Fidget formatting options." { fmt = {
leftpad = helpers.defaultNullOpts.mkBool true '' leftpad = helpers.defaultNullOpts.mkBool true ''
Whether to right-justify the text in a fidget box by left-padding Whether to right-justify the text in a fidget box by left-padding
it with spaces. Recommended when `align.right` is `true`. it with spaces. Recommended when `align.right` is `true`.
@ -194,7 +194,7 @@ in {
List of options for fidget sources. List of options for fidget sources.
''; '';
debug = helpers.mkCompositeOption "Fidget debugging options." { debug = {
logging = helpers.defaultNullOpts.mkBool false '' logging = helpers.defaultNullOpts.mkBool false ''
Whether to enable logging, for debugging. The log is written to Whether to enable logging, for debugging. The log is written to
`~/.local/share/nvim/fidget.nvim.log`. `~/.local/share/nvim/fidget.nvim.log`.
@ -216,12 +216,12 @@ in {
setupOptions = setupOptions =
{ {
inherit (cfg) text align window sources; inherit (cfg) text align window sources;
timer = helpers.ifNonNull' cfg.timer { timer = {
spinner_rate = cfg.timer.spinnerRate; spinner_rate = cfg.timer.spinnerRate;
fidget_decay = cfg.timer.fidgetDecay; fidget_decay = cfg.timer.fidgetDecay;
task_decay = cfg.timer.taskDecay; task_decay = cfg.timer.taskDecay;
}; };
fmt = helpers.ifNonNull' cfg.fmt { fmt = {
inherit (cfg.fmt) leftpad fidget task; inherit (cfg.fmt) leftpad fidget task;
stack_upwards = cfg.fmt.stackUpwards; stack_upwards = cfg.fmt.stackUpwards;
max_width = cfg.fmt.maxWidth; max_width = cfg.fmt.maxWidth;

View file

@ -23,14 +23,14 @@ in {
}; };
plugins = { plugins = {
autopep8 = helpers.mkCompositeOption "autopep8 settings" { autopep8 = {
enabled = helpers.defaultNullOpts.mkBool true '' enabled = helpers.defaultNullOpts.mkBool true ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (autopep8). Setting this explicitely to `true` will install the dependency for this plugin (autopep8).
''; '';
}; };
flake8 = helpers.mkCompositeOption "flake8 settings" { flake8 = {
config = helpers.mkNullOrOption types.str '' config = helpers.mkNullOrOption types.str ''
Path to the config file that will be the authoritative config source. Path to the config file that will be the authoritative config source.
''; '';
@ -84,7 +84,7 @@ in {
''; '';
}; };
jedi = helpers.mkCompositeOption "jedi settings" { jedi = {
auto_import_modules = auto_import_modules =
helpers.defaultNullOpts.mkNullable helpers.defaultNullOpts.mkNullable
(types.listOf types.str) (types.listOf types.str)
@ -100,7 +100,7 @@ in {
''; '';
}; };
jedi_completion = helpers.mkCompositeOption "jedi_completion settings" { jedi_completion = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
include_params = helpers.defaultNullOpts.mkBool true '' include_params = helpers.defaultNullOpts.mkBool true ''
@ -134,7 +134,7 @@ in {
"Modules for which labels and snippets should be cached."; "Modules for which labels and snippets should be cached.";
}; };
jedi_definition = helpers.mkCompositeOption "jedi_definition settings" { jedi_definition = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
follow_imports = helpers.defaultNullOpts.mkBool true '' follow_imports = helpers.defaultNullOpts.mkBool true ''
@ -150,19 +150,19 @@ in {
''; '';
}; };
jedi_hover = helpers.mkCompositeOption "jedi_hover settings" { jedi_hover = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
}; };
jedi_references = helpers.mkCompositeOption "jedi_references settings" { jedi_references = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
}; };
jedi_signature_help = helpers.mkCompositeOption "jedi_signature_help settings" { jedi_signature_help = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
}; };
jedi_symbols = helpers.mkCompositeOption "jedi_symbols settings" { jedi_symbols = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
all_scopes = helpers.defaultNullOpts.mkBool true '' all_scopes = helpers.defaultNullOpts.mkBool true ''
@ -174,7 +174,7 @@ in {
''; '';
}; };
mccabe = helpers.mkCompositeOption "mccabe settings" { mccabe = {
enabled = helpers.defaultNullOpts.mkBool true '' enabled = helpers.defaultNullOpts.mkBool true ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (mccabe). Setting this explicitely to `true` will install the dependency for this plugin (mccabe).
@ -185,7 +185,7 @@ in {
''; '';
}; };
preload = helpers.mkCompositeOption "preload settings" { preload = {
enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin."; enabled = helpers.defaultNullOpts.mkBool true "Enable or disable the plugin.";
modules = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" '' modules = helpers.defaultNullOpts.mkNullable (types.listOf types.str) "[]" ''
@ -193,7 +193,7 @@ in {
''; '';
}; };
pycodestyle = helpers.mkCompositeOption "pycodestyle settings" { pycodestyle = {
enabled = helpers.defaultNullOpts.mkBool true '' enabled = helpers.defaultNullOpts.mkBool true ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin Setting this explicitely to `true` will install the dependency for this plugin
@ -229,7 +229,7 @@ in {
''; '';
}; };
pydocstyle = helpers.mkCompositeOption "pydocstyle settings" { pydocstyle = {
enabled = helpers.defaultNullOpts.mkBool false '' enabled = helpers.defaultNullOpts.mkBool false ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin Setting this explicitely to `true` will install the dependency for this plugin
@ -273,14 +273,14 @@ in {
''; '';
}; };
pyflakes = helpers.mkCompositeOption "pyflakes settings" { pyflakes = {
enabled = helpers.defaultNullOpts.mkBool true '' enabled = helpers.defaultNullOpts.mkBool true ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (pyflakes). Setting this explicitely to `true` will install the dependency for this plugin (pyflakes).
''; '';
}; };
pylint = helpers.mkCompositeOption "pylint settings" { pylint = {
enabled = helpers.defaultNullOpts.mkBool false '' enabled = helpers.defaultNullOpts.mkBool false ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (pylint). Setting this explicitely to `true` will install the dependency for this plugin (pylint).
@ -297,7 +297,7 @@ in {
''; '';
}; };
rope_autoimport = helpers.mkCompositeOption "rope_autoimport settings" { rope_autoimport = {
enabled = helpers.defaultNullOpts.mkBool false '' enabled = helpers.defaultNullOpts.mkBool false ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (rope). Setting this explicitely to `true` will install the dependency for this plugin (rope).
@ -309,7 +309,7 @@ in {
''; '';
}; };
rope_completion = helpers.mkCompositeOption "rope_completion settings" { rope_completion = {
enabled = helpers.defaultNullOpts.mkBool false '' enabled = helpers.defaultNullOpts.mkBool false ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (rope). Setting this explicitely to `true` will install the dependency for this plugin (rope).
@ -320,7 +320,7 @@ in {
''; '';
}; };
yapf = helpers.mkCompositeOption "yapf settings" { yapf = {
enabled = helpers.defaultNullOpts.mkBool true '' enabled = helpers.defaultNullOpts.mkBool true ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin (yapf). Setting this explicitely to `true` will install the dependency for this plugin (yapf).
@ -328,7 +328,7 @@ in {
}; };
### THIRD-PARTY PLUGINS ### THIRD-PARTY PLUGINS
pylsp_mypy = helpers.mkCompositeOption "pylsp_mypy settings" { pylsp_mypy = {
enabled = helpers.defaultNullOpts.mkBool false '' enabled = helpers.defaultNullOpts.mkBool false ''
Enable or disable the plugin. Enable or disable the plugin.
Setting this explicitely to `true` will install the dependency for this plugin Setting this explicitely to `true` will install the dependency for this plugin
@ -484,7 +484,7 @@ in {
### END OF THIRD-PARTY PLUGINS ### END OF THIRD-PARTY PLUGINS
}; };
rope = helpers.mkCompositeOption "rope settings" { rope = {
extensionModules = helpers.mkNullOrOption types.str '' extensionModules = helpers.mkNullOrOption types.str ''
Builtin and c-extension modules that are allowed to be imported and inspected by rope. Builtin and c-extension modules that are allowed to be imported and inspected by rope.
''; '';
@ -504,7 +504,7 @@ in {
# plugins to its `propagatedBuildInputs`. # plugins to its `propagatedBuildInputs`.
# See https://github.com/NixOS/nixpkgs/issues/229337 # See https://github.com/NixOS/nixpkgs/issues/229337
plugins.lsp.servers.pylsp.package = let plugins.lsp.servers.pylsp.package = let
isEnabled = x: (x != null) && (x.enabled != null && x.enabled); isEnabled = x: (x.enabled != null && x.enabled);
inherit (cfg.settings) plugins; inherit (cfg.settings) plugins;
nativePlugins = nativePlugins =

View file

@ -48,90 +48,84 @@ in
padding = helpers.defaultNullOpts.mkBool true "Add an extra new line on top of the list"; padding = helpers.defaultNullOpts.mkBool true "Add an extra new line on top of the list";
actionKeys = actionKeys =
helpers.mkCompositeOption mapAttrs
'' (
Key mappings for actions in the trouble list. action: config:
Map to `{}` to remove a mapping, for example: helpers.defaultNullOpts.mkNullable
`close = {};` (with types; either str (listOf str))
'' config.default
(mapAttrs config.description
( )
action: config: {
helpers.defaultNullOpts.mkNullable close = {
(with types; either str (listOf str)) default = "q";
config.default description = "Close the list";
config.description };
) cancel = {
{ default = "<esc>";
close = { description = "Cancel the preview and get back to your last window / buffer / cursor";
default = "q"; };
description = "Close the list"; refresh = {
}; default = "r";
cancel = { description = "Manually refresh";
default = "<esc>"; };
description = "Cancel the preview and get back to your last window / buffer / cursor"; jump = {
}; default = "[ \"<cr>\" \"<tab>\" ]";
refresh = { description = "Jump to the diagnostic or open / close folds";
default = "r"; };
description = "Manually refresh"; openSplit = {
}; default = "[ \"<c-x>\" ]";
jump = { description = "Open buffer in new split";
default = "[ \"<cr>\" \"<tab>\" ]"; };
description = "Jump to the diagnostic or open / close folds"; openVsplit = {
}; default = "[ \"<c-v>\" ]";
openSplit = { description = "Open buffer in new vsplit";
default = "[ \"<c-x>\" ]"; };
description = "Open buffer in new split"; openTab = {
}; default = "[ \"<c-t>\" ]";
openVsplit = { description = "Open buffer in new tab";
default = "[ \"<c-v>\" ]"; };
description = "Open buffer in new vsplit"; jumpClose = {
}; default = "[ \"o\" ]";
openTab = { description = "Jump to the diagnostic and close the list";
default = "[ \"<c-t>\" ]"; };
description = "Open buffer in new tab"; toggleMode = {
}; default = "m";
jumpClose = { description = "toggle between 'workspace' and 'document' diagnostics mode";
default = "[ \"o\" ]"; };
description = "Jump to the diagnostic and close the list"; togglePreview = {
}; default = "P";
toggleMode = { description = "Toggle auto_preview";
default = "m"; };
description = "toggle between 'workspace' and 'document' diagnostics mode"; hover = {
}; default = "K";
togglePreview = { description = "Opens a small popup with the full multiline message";
default = "P"; };
description = "Toggle auto_preview"; preview = {
}; default = "p";
hover = { description = "Preview the diagnostic location";
default = "K"; };
description = "Opens a small popup with the full multiline message"; closeFolds = {
}; default = "[ \"zM\" \"zm\" ]";
preview = { description = "Close all folds";
default = "p"; };
description = "Preview the diagnostic location"; openFolds = {
}; default = "[ \"zR\" \"zr\" ]";
closeFolds = { description = "Open all folds";
default = "[ \"zM\" \"zm\" ]"; };
description = "Close all folds"; toggleFold = {
}; default = "[ \"zA\" \"za\" ]";
openFolds = { description = "Toggle fold of current file";
default = "[ \"zR\" \"zr\" ]"; };
description = "Open all folds"; previous = {
}; default = "k";
toggleFold = { description = "Previous item";
default = "[ \"zA\" \"za\" ]"; };
description = "Toggle fold of current file"; next = {
}; default = "j";
previous = { description = "Next item";
default = "k"; };
description = "Previous item"; };
};
next = {
default = "j";
description = "Next item";
};
});
indentLines = helpers.defaultNullOpts.mkBool true '' indentLines = helpers.defaultNullOpts.mkBool true ''
Add an indent guide below the fold icons. Add an indent guide below the fold icons.
@ -161,21 +155,18 @@ in
"For the given modes, automatically jump if there is only a single result."; "For the given modes, automatically jump if there is only a single result.";
signs = signs =
helpers.mkCompositeOption "Incons/text used for the different diagnostics." mapAttrs
( (
mapAttrs diagnostic: default:
( helpers.defaultNullOpts.mkStr default "Icon/text for ${diagnostic} diagnostics."
diagnostic: default: )
helpers.defaultNullOpts.mkStr default "Icon/text for ${diagnostic} diagnostics." {
) error = "";
{ warning = "";
error = ""; hint = "";
warning = ""; information = "";
hint = ""; other = "";
information = ""; };
other = "";
}
);
useDiagnosticSigns = helpers.defaultNullOpts.mkBool false '' useDiagnosticSigns = helpers.defaultNullOpts.mkBool false ''
Enabling this will use the signs defined in your lsp client Enabling this will use the signs defined in your lsp client
@ -197,22 +188,6 @@ in
fold_open = cfg.foldOpen; fold_open = cfg.foldOpen;
fold_closed = cfg.foldClosed; fold_closed = cfg.foldClosed;
inherit (cfg) group padding; inherit (cfg) group padding;
action_keys =
helpers.ifNonNull' cfg.actionKeys
(with cfg.actionKeys; {
inherit close cancel refresh jump;
open_split = openSplit;
open_vsplit = openVsplit;
open_tab = openTab;
jump_close = jumpClose;
toggle_mode = toggleMode;
toggle_preview = togglePreview;
inherit hover preview;
close_folds = closeFolds;
open_folds = openFolds;
toggle_fold = toggleFold;
inherit next;
});
indent_lines = cfg.indentLines; indent_lines = cfg.indentLines;
auto_open = cfg.autoOpen; auto_open = cfg.autoOpen;
auto_close = cfg.autoClose; auto_close = cfg.autoClose;
@ -220,6 +195,23 @@ in
auto_fold = cfg.autoFold; auto_fold = cfg.autoFold;
auto_jump = cfg.autoJump; auto_jump = cfg.autoJump;
inherit (cfg) signs; inherit (cfg) signs;
action_keys = with cfg.actionKeys; {
inherit close cancel refresh jump;
open_split = openSplit;
open_vsplit = openVsplit;
open_tab = openTab;
jump_close = jumpClose;
toggle_mode = toggleMode;
toggle_preview = togglePreview;
inherit
hover
preview
;
close_folds = closeFolds;
open_folds = openFolds;
toggle_fold = toggleFold;
inherit next;
};
use_diagnostic_signs = cfg.useDiagnosticSigns; use_diagnostic_signs = cfg.useDiagnosticSigns;
} }
// cfg.extraOptions; // cfg.extraOptions;

View file

@ -11,12 +11,10 @@ with lib; let
mkSeparatorsOption = { mkSeparatorsOption = {
leftDefault ? " ", leftDefault ? " ",
rightDefault ? " ", rightDefault ? " ",
name, }: {
}: left = helpers.defaultNullOpts.mkStr leftDefault "Left separator";
helpers.mkCompositeOption "${name} separtors." { right = helpers.defaultNullOpts.mkStr rightDefault "Right separator";
left = helpers.defaultNullOpts.mkStr leftDefault "Left separator"; };
right = helpers.defaultNullOpts.mkStr rightDefault "Right separator";
};
mkComponentOptions = defaultName: mkComponentOptions = defaultName:
helpers.mkNullOrOption helpers.mkNullOrOption
@ -55,7 +53,7 @@ with lib; let
) )
"Defines the icon to be displayed in front of the component."; "Defines the icon to be displayed in front of the component.";
separator = mkSeparatorsOption {name = "Component";}; separator = mkSeparatorsOption {};
color = helpers.mkNullOrOption (types.attrsOf types.str) '' color = helpers.mkNullOrOption (types.attrsOf types.str) ''
Defines a custom color for the component. Defines a custom color for the component.
@ -92,15 +90,14 @@ with lib; let
)) ))
""; "";
mkEmptySectionOption = name: mkEmptySectionOption = name: {
helpers.mkCompositeOption name { lualine_a = mkComponentOptions "";
lualine_a = mkComponentOptions ""; lualine_b = mkComponentOptions "";
lualine_b = mkComponentOptions ""; lualine_c = mkComponentOptions "";
lualine_c = mkComponentOptions ""; lualine_x = mkComponentOptions "";
lualine_x = mkComponentOptions ""; lualine_y = mkComponentOptions "";
lualine_y = mkComponentOptions ""; lualine_z = mkComponentOptions "";
lualine_z = mkComponentOptions ""; };
};
in { in {
options = { options = {
plugins.lualine = { plugins.lualine = {
@ -119,16 +116,14 @@ in {
componentSeparators = mkSeparatorsOption { componentSeparators = mkSeparatorsOption {
leftDefault = ""; leftDefault = "";
rightDefault = ""; rightDefault = "";
name = "component";
}; };
sectionSeparators = mkSeparatorsOption { sectionSeparators = mkSeparatorsOption {
leftDefault = ""; leftDefault = "";
rightDefault = ""; rightDefault = "";
name = "section";
}; };
disabledFiletypes = helpers.mkCompositeOption "Filetypes to disable lualine for." { disabledFiletypes = {
statusline = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" '' statusline = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
Only ignores the ft for statusline. Only ignores the ft for statusline.
''; '';
@ -157,23 +152,15 @@ in {
This feature is only available in neovim 0.7 and higher. This feature is only available in neovim 0.7 and higher.
''; '';
refresh = refresh = {
helpers.mkCompositeOption statusline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the status line (ms)";
''
Sets how often lualine should refresh it's contents (in ms).
The refresh option sets minimum time that lualine tries to maintain between refresh.
It's not guarantied if situation arises that lualine needs to refresh itself before this
time it'll do it.
''
{
statusline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the status line (ms)";
tabline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the tabline (ms)"; tabline = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the tabline (ms)";
winbar = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the winbar (ms)"; winbar = helpers.defaultNullOpts.mkInt 1000 "Refresh time for the winbar (ms)";
}; };
sections = helpers.mkCompositeOption "Sections configuration" { sections = {
lualine_a = mkComponentOptions "mode"; lualine_a = mkComponentOptions "mode";
lualine_b = mkComponentOptions "branch"; lualine_b = mkComponentOptions "branch";
lualine_c = mkComponentOptions "filename"; lualine_c = mkComponentOptions "filename";
@ -183,7 +170,7 @@ in {
lualine_z = mkComponentOptions "location"; lualine_z = mkComponentOptions "location";
}; };
inactiveSections = helpers.mkCompositeOption "Inactive Sections configuration" { inactiveSections = {
lualine_a = mkComponentOptions ""; lualine_a = mkComponentOptions "";
lualine_b = mkComponentOptions ""; lualine_b = mkComponentOptions "";
lualine_c = mkComponentOptions "filename"; lualine_c = mkComponentOptions "filename";
@ -245,11 +232,11 @@ in {
always_divide_middle = cfg.alwaysDivideMiddle; always_divide_middle = cfg.alwaysDivideMiddle;
}; };
sections = mapNullable processSections cfg.sections; sections = processSections cfg.sections;
inactive_sections = mapNullable processSections cfg.inactiveSections; inactive_sections = processSections cfg.inactiveSections;
tabline = mapNullable processSections cfg.tabline; tabline = processSections cfg.tabline;
winbar = mapNullable processSections cfg.winbar; winbar = processSections cfg.winbar;
inactive_winbar = mapNullable processSections cfg.inactiveWinbar; inactive_winbar = processSections cfg.inactiveWinbar;
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {

View file

@ -20,7 +20,7 @@ with lib; {
package = helpers.mkPackageOption "noice" pkgs.vimPlugins.noice-nvim; package = helpers.mkPackageOption "noice" pkgs.vimPlugins.noice-nvim;
cmdline = helpers.mkCompositeOption "" { cmdline = {
enabled = helpers.defaultNullOpts.mkBool true "enables Noice cmdline UI"; enabled = helpers.defaultNullOpts.mkBool true "enables Noice cmdline UI";
view = helpers.defaultNullOpts.mkStr "cmdline_popup" ""; view = helpers.defaultNullOpts.mkStr "cmdline_popup" "";
opts = helpers.defaultNullOpts.mkNullable types.anything "{}" ""; opts = helpers.defaultNullOpts.mkNullable types.anything "{}" "";
@ -45,18 +45,19 @@ with lib; {
''; '';
}; };
messages = messages = {
helpers.mkCompositeOption enabled = helpers.defaultNullOpts.mkBool true ''
"NOTE: If you enable messages, then the cmdline is enabled automatically" { Enables the messages UI.
enabled = helpers.defaultNullOpts.mkBool true "enables the messages UI"; NOTE: If you enable messages, then the cmdline is enabled automatically.
view = helpers.defaultNullOpts.mkStr "notify" "default view for messages"; '';
viewError = helpers.defaultNullOpts.mkStr "notify" "default view for errors"; view = helpers.defaultNullOpts.mkStr "notify" "default view for messages";
viewWarn = helpers.defaultNullOpts.mkStr "notify" "default view for warnings"; viewError = helpers.defaultNullOpts.mkStr "notify" "default view for errors";
viewHistory = helpers.defaultNullOpts.mkStr "messages" "view for :messages"; viewWarn = helpers.defaultNullOpts.mkStr "notify" "default view for warnings";
viewSearch = helpers.defaultNullOpts.mkStr "virtualtext" "view for search count messages"; viewHistory = helpers.defaultNullOpts.mkStr "messages" "view for :messages";
}; viewSearch = helpers.defaultNullOpts.mkStr "virtualtext" "view for search count messages";
};
popupmenu = helpers.mkCompositeOption "" { popupmenu = {
enabled = helpers.defaultNullOpts.mkBool true "enables the Noice popupmenu UI"; enabled = helpers.defaultNullOpts.mkBool true "enables the Noice popupmenu UI";
backend = helpers.defaultNullOpts.mkEnumFirstDefault ["nui" "cmp"] ""; backend = helpers.defaultNullOpts.mkEnumFirstDefault ["nui" "cmp"] "";
kindIcons = kindIcons =
@ -110,20 +111,21 @@ with lib; {
} }
'' "You can add any custom commands that will be available with `:Noice command`"; '' "You can add any custom commands that will be available with `:Noice command`";
notify = notify = {
helpers.mkCompositeOption '' enabled = helpers.defaultNullOpts.mkBool true ''
Noice can be used as `vim.notify` so you can route any notification like other messages Enable notification handling.
Notification messages have their level and other properties set.
event is always "notify" and kind can be any log level as a string
The default routes will forward notifications to nvim-notify
Benefit of using Noice for this is the routing and consistent history view
'' {
enabled = helpers.defaultNullOpts.mkBool true "enable notification handling";
view = helpers.defaultNullOpts.mkStr "notify" "";
};
lsp = helpers.mkCompositeOption "" { Noice can be used as `vim.notify` so you can route any notification like other messages.
progress = helpers.mkCompositeOption "" { Notification messages have their level and other properties set.
event is always "notify" and kind can be any log level as a string.
The default routes will forward notifications to nvim-notify.
Benefit of using Noice for this is the routing and consistent history view.
'';
view = helpers.defaultNullOpts.mkStr "notify" "";
};
lsp = {
progress = {
enabled = helpers.defaultNullOpts.mkBool true "enable LSP progress"; enabled = helpers.defaultNullOpts.mkBool true "enable LSP progress";
format = format =
@ -150,7 +152,7 @@ with lib; {
} }
'' ""; '' "";
hover = helpers.mkCompositeOption "" { hover = {
enabled = helpers.defaultNullOpts.mkBool true "enable hover UI"; enabled = helpers.defaultNullOpts.mkBool true "enable hover UI";
view = view =
helpers.defaultNullOpts.mkNullable types.str "null" helpers.defaultNullOpts.mkNullable types.str "null"
@ -160,10 +162,10 @@ with lib; {
"merged with defaults from documentation"; "merged with defaults from documentation";
}; };
signature = helpers.mkCompositeOption "" { signature = {
enabled = helpers.defaultNullOpts.mkBool true "enable signature UI"; enabled = helpers.defaultNullOpts.mkBool true "enable signature UI";
autoOpen = helpers.mkCompositeOption "" { autoOpen = {
enabled = helpers.defaultNullOpts.mkBool true ""; enabled = helpers.defaultNullOpts.mkBool true "";
trigger = trigger =
helpers.defaultNullOpts.mkBool true helpers.defaultNullOpts.mkBool true
@ -184,14 +186,14 @@ with lib; {
"merged with defaults from documentation"; "merged with defaults from documentation";
}; };
message = helpers.mkCompositeOption "Messages shown by lsp servers" { message = {
enabled = helpers.defaultNullOpts.mkBool true "enable display of messages"; enabled = helpers.defaultNullOpts.mkBool true "enable display of messages";
view = helpers.defaultNullOpts.mkStr "notify" ""; view = helpers.defaultNullOpts.mkStr "notify" "";
opts = helpers.defaultNullOpts.mkNullable types.anything "{}" ""; opts = helpers.defaultNullOpts.mkNullable types.anything "{}" "";
}; };
documentation = helpers.mkCompositeOption "defaults for hover and signature help" { documentation = {
view = helpers.defaultNullOpts.mkStr "hover" ""; view = helpers.defaultNullOpts.mkStr "hover" "";
opts = helpers.defaultNullOpts.mkNullable types.anything '' opts = helpers.defaultNullOpts.mkNullable types.anything ''
@ -206,7 +208,7 @@ with lib; {
}; };
}; };
markdown = helpers.mkCompositeOption "" { markdown = {
hover = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) '' hover = helpers.defaultNullOpts.mkNullable (types.attrsOf types.str) ''
{ {
"|(%S-)|" = helpers.mkRaw "vim.cmd.help"; // vim help links "|(%S-)|" = helpers.mkRaw "vim.cmd.help"; // vim help links
@ -226,22 +228,23 @@ with lib; {
'' "set highlight groups"; '' "set highlight groups";
}; };
health = helpers.mkCompositeOption "" { health = {
checker = checker =
helpers.defaultNullOpts.mkBool true helpers.defaultNullOpts.mkBool true
"Disable if you don't want health checks to run"; "Disable if you don't want health checks to run";
}; };
smartMove = smartMove = {
helpers.mkCompositeOption enabled = helpers.defaultNullOpts.mkBool true ''
"noice tries to move out of the way of existing floating windows." { Noice tries to move out of the way of existing floating windows.
enabled = helpers.defaultNullOpts.mkBool true "you can disable this behaviour here"; You can disable this behaviour here
excludedFiletypes = '';
helpers.defaultNullOpts.mkNullable (types.listOf types.str) excludedFiletypes =
''[ "cmp_menu" "cmp_docs" "notify"]'' '' helpers.defaultNullOpts.mkNullable (types.listOf types.str)
add any filetypes here, that shouldn't trigger smart move ''[ "cmp_menu" "cmp_docs" "notify"]'' ''
''; add any filetypes here, that shouldn't trigger smart move
}; '';
};
presets = presets =
helpers.defaultNullOpts.mkNullable (types.either types.bool types.anything) '' helpers.defaultNullOpts.mkNullable (types.either types.bool types.anything) ''
@ -272,74 +275,68 @@ with lib; {
cfg = config.plugins.noice; cfg = config.plugins.noice;
setupOptions = { setupOptions = {
inherit (cfg) presets views routes status format; inherit (cfg) presets views routes status format;
cmdline = helpers.ifNonNull' cfg.cmdline { cmdline = {
inherit (cfg.cmdline) enabled view opts format; inherit (cfg.cmdline) enabled view opts format;
}; };
messages = let messages = let
cfgM = cfg.messages; cfgM = cfg.messages;
in in {
helpers.ifNonNull' cfgM { inherit (cfgM) enabled view;
inherit (cfgM) enabled view; view_error = cfgM.viewError;
view_error = cfgM.viewError; view_warn = cfgM.viewWarn;
view_warn = cfgM.viewWarn; view_history = cfgM.viewHistory;
view_history = cfgM.viewHistory; view_search = cfgM.viewSearch;
view_search = cfgM.viewSearch; };
};
popupmenu = let popupmenu = let
cfgP = cfg.popupmenu; cfgP = cfg.popupmenu;
in in {
helpers.ifNonNull' cfgP { inherit (cfgP) enabled backend;
inherit (cfgP) enabled backend; kind_icons = cfgP.kindIcons;
kind_icons = cfgP.kindIcons; };
};
inherit (cfg) redirect commands; inherit (cfg) redirect commands;
notify = helpers.ifNonNull' cfg.notify { notify = {
inherit (cfg.notify) enabled view; inherit (cfg.notify) enabled view;
}; };
lsp = let lsp = let
cfgL = cfg.lsp; cfgL = cfg.lsp;
in in {
helpers.ifNonNull' cfgL { progress = let
progress = let cfgLP = cfgL.progress;
cfgLP = cfgL.progress; in {
in inherit (cfgLP) enabled format throttle view;
helpers.ifNonNull' cfgLP { format_done = cfgLP.formatDone;
inherit (cfgLP) enabled format throttle view; };
format_done = cfgLP.formatDone; inherit (cfgL) override;
}; hover = {
inherit (cfgL) override; inherit (cfgL.hover) enabled view opts;
hover = helpers.ifNonNull' cfgL.hover { };
inherit (cfgL.hover) enabled view opts; signature = let
}; cfgLS = cfgL.signature;
signature = let in {
cfgLS = cfgL.signature; inherit (cfgLS) enabled view opts;
in auto_open = {
helpers.ifNonNull' cfgLS { inherit (cfgLS.autoOpen) enabled trigger luasnip throttle;
inherit (cfgLS) enabled view opts;
auto_open = helpers.ifNonNull' cfgLS.autoOpen {
inherit (cfgLS.autoOpen) enabled trigger luasnip throttle;
};
};
message = helpers.ifNonNull' cfgL.message {
inherit (cfgL.message) enabled view opts;
};
documentation = helpers.ifNonNull' cfgL.documentation {
inherit (cfgL.documentation) view opts;
}; };
}; };
markdown = helpers.ifNonNull' cfg.markdown { message = {
inherit (cfgL.message) enabled view opts;
};
documentation = {
inherit (cfgL.documentation) view opts;
};
};
markdown = {
inherit (cfg.markdown) hover highlights; inherit (cfg.markdown) hover highlights;
}; };
health = helpers.ifNonNull' cfg.health { health = {
inherit (cfg.health) checker; inherit (cfg.health) checker;
}; };
smart_move = let smart_move = let
cfgS = cfg.smartMove; cfgS = cfg.smartMove;
in in {
helpers.ifNonNull' cfgS { inherit (cfgS) enabled;
inherit (cfgS) enabled; excluded_filetypes = cfgS.excludedFiletypes;
excluded_filetypes = cfgS.excludedFiletypes; };
};
}; };
in in
mkIf cfg.enable { mkIf cfg.enable {

View file

@ -79,7 +79,7 @@ in {
``` ```
''; '';
guiStyle = helpers.mkCompositeOption "The gui style for highlight groups." { guiStyle = {
fg = helpers.defaultNullOpts.mkStr "NONE" '' fg = helpers.defaultNullOpts.mkStr "NONE" ''
The gui style to use for the fg highlight group. The gui style to use for the fg highlight group.
''; '';
@ -93,7 +93,7 @@ in {
When true, custom keywords will be merged with the default When true, custom keywords will be merged with the default
''; '';
highlight = helpers.mkCompositeOption "Highlight options." { highlight = {
multiline = helpers.defaultNullOpts.mkBool true '' multiline = helpers.defaultNullOpts.mkBool true ''
Enable multiline todo comments. Enable multiline todo comments.
''; '';
@ -163,7 +163,7 @@ in {
``` ```
''; '';
search = helpers.mkCompositeOption "Search options." { search = {
command = helpers.defaultNullOpts.mkStr "rg" "Command to use for searching for keywords."; command = helpers.defaultNullOpts.mkStr "rg" "Command to use for searching for keywords.";
args = helpers.mkNullOrOption (types.listOf types.str) '' args = helpers.mkNullOrOption (types.listOf types.str) ''
@ -231,7 +231,7 @@ in {
inherit (cfg) keywords; inherit (cfg) keywords;
gui_style = cfg.guiStyle; gui_style = cfg.guiStyle;
merge_keywords = cfg.mergeKeywords; merge_keywords = cfg.mergeKeywords;
highlight = helpers.ifNonNull' cfg.highlight { highlight = {
inherit inherit
(cfg.highlight) (cfg.highlight)
multiline multiline
@ -249,7 +249,7 @@ in {
max_line_len = cfg.highlight.maxLineLen; max_line_len = cfg.highlight.maxLineLen;
}; };
inherit (cfg) colors; inherit (cfg) colors;
search = helpers.ifNonNull' cfg.search { search = {
inherit (cfg.search) command args; inherit (cfg.search) command args;
pattern = pattern =
helpers.ifNonNull' cfg.search.pattern helpers.ifNonNull' cfg.search.pattern