feat(nvimtree): add custom setup options

This commit is contained in:
Ching Pei Yang 2024-01-03 00:55:03 +01:00
parent 42016d8e04
commit 4001943a7b
2 changed files with 951 additions and 1188 deletions

View file

@ -6,10 +6,9 @@
}: let }: let
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.binds) mkBinding; inherit (lib.nvim.binds) mkBinding;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) listToLuaTable expToLua; inherit (lib.nvim.lua) toLuaObject;
# TODO: move this to its own module # TODO: move this to its own module
inherit (lib) pushDownDefault; inherit (lib) pushDownDefault;
@ -40,237 +39,7 @@ in {
'' ''
} }
require'nvim-tree'.setup({ require'nvim-tree'.setup(${toLuaObject cfg.setupOpts})
disable_netrw = ${boolToString cfg.disableNetrw},
hijack_netrw = ${boolToString cfg.hijackNetrw},
auto_reload_on_write = ${boolToString cfg.autoreloadOnWrite},
sort = {
sorter = "${cfg.sort.sorter}",
folders_first = ${boolToString cfg.sort.foldersFirst},
},
hijack_unnamed_buffer_when_opening = ${boolToString cfg.hijackUnnamedBufferWhenOpening},
hijack_cursor = ${boolToString cfg.hijackCursor},
root_dirs = ${listToLuaTable cfg.rootDirs},
prefer_startup_root = ${boolToString cfg.preferStartupRoot},
sync_root_with_cwd = ${boolToString cfg.syncRootWithCwd},
reload_on_bufenter = ${boolToString cfg.reloadOnBufEnter},
respect_buf_cwd = ${boolToString cfg.respectBufCwd},
hijack_directories = {
enable = ${boolToString cfg.hijackDirectories.enable},
auto_open = ${boolToString cfg.hijackDirectories.autoOpen},
},
update_focused_file = {
enable = ${boolToString cfg.updateFocusedFile.enable},
update_root = ${boolToString cfg.updateFocusedFile.updateRoot},
ignore_list = ${listToLuaTable cfg.updateFocusedFile.ignoreList},
},
system_open = {
cmd = "${cfg.systemOpen.cmd}",
args = ${listToLuaTable cfg.systemOpen.args},
},
diagnostics = {
enable = ${boolToString cfg.diagnostics.enable},
icons = {
hint = "${cfg.diagnostics.icons.hint}",
info = "${cfg.diagnostics.icons.info}",
warning = "${cfg.diagnostics.icons.warning}",
error = "${cfg.diagnostics.icons.error}",
},
severity = {
min = vim.diagnostic.severity.${cfg.diagnostics.severity.min},
max = vim.diagnostic.severity.${cfg.diagnostics.severity.max},
},
},
git = {
enable = ${boolToString cfg.git.enable},
show_on_dirs = ${boolToString cfg.git.showOnDirs},
show_on_open_dirs = ${boolToString cfg.git.showOnOpenDirs},
disable_for_dirs = ${listToLuaTable cfg.git.disableForDirs},
timeout = ${toString cfg.git.timeout},
},
modified = {
enable = ${boolToString cfg.modified.enable},
show_on_dirs = ${boolToString cfg.modified.showOnDirs},
show_on_open_dirs = ${boolToString cfg.modified.showOnOpenDirs},
},
filesystem_watchers = {
enable = ${boolToString cfg.filesystemWatchers.enable},
debounce_delay = ${toString cfg.filesystemWatchers.debounceDelay},
ignore_dirs = ${listToLuaTable cfg.filesystemWatchers.ignoreDirs},
},
select_prompts = ${boolToString cfg.selectPrompts},
view = {
centralize_selection = ${boolToString cfg.view.centralizeSelection},
cursorline = ${boolToString cfg.view.cursorline},
debounce_delay = ${toString cfg.view.debounceDelay},
width = ${expToLua cfg.view.width},
side = "${cfg.view.side}",
preserve_window_proportions = ${boolToString cfg.view.preserveWindowProportions},
number = ${boolToString cfg.view.number},
relativenumber = ${boolToString cfg.view.relativenumber},
signcolumn = "${cfg.view.signcolumn}",
float = {
enable = ${boolToString cfg.view.float.enable},
quit_on_focus_loss = ${boolToString cfg.view.float.quitOnFocusLoss},
open_win_config = {
relative = "${cfg.view.float.openWinConfig.relative}",
border = "${cfg.view.float.openWinConfig.border}",
width = ${toString cfg.view.float.openWinConfig.width},
height = ${toString cfg.view.float.openWinConfig.height},
row = ${toString cfg.view.float.openWinConfig.row},
col = ${toString cfg.view.float.openWinConfig.col},
},
},
},
renderer = {
add_trailing = ${boolToString cfg.renderer.addTrailing},
group_empty = ${boolToString cfg.renderer.groupEmpty},
full_name = ${boolToString cfg.renderer.fullName},
highlight_git = ${boolToString cfg.renderer.highlightGit},
highlight_opened_files = ${cfg.renderer.highlightOpenedFiles},
highlight_modified = ${cfg.renderer.highlightModified},
root_folder_label = ${expToLua cfg.renderer.rootFolderLabel},
indent_width = ${toString cfg.renderer.indentWidth},
indent_markers = {
enable = ${boolToString cfg.renderer.indentMarkers.enable},
inline_arrows = ${boolToString cfg.renderer.indentMarkers.inlineArrows},
icons = ${expToLua cfg.renderer.indentMarkers.icons},
},
special_files = ${listToLuaTable cfg.renderer.specialFiles},
symlink_destination = ${boolToString cfg.renderer.symlinkDestination},
icons = {
webdev_colors = ${boolToString cfg.renderer.icons.webdevColors},
git_placement = "${cfg.renderer.icons.gitPlacement}",
modified_placement = "${cfg.renderer.icons.modifiedPlacement}",
padding = "${cfg.renderer.icons.padding}",
symlink_arrow = "${cfg.renderer.icons.symlinkArrow}",
show = {
git = ${boolToString cfg.renderer.icons.show.git},
folder = ${boolToString cfg.renderer.icons.show.folder},
folder_arrow = ${boolToString cfg.renderer.icons.show.folderArrow},
file = ${boolToString cfg.renderer.icons.show.file},
modified = ${boolToString cfg.renderer.icons.show.modified},
},
glyphs = {
default = "${cfg.renderer.icons.glyphs.default}",
symlink = "${cfg.renderer.icons.glyphs.symlink}",
modified = "${cfg.renderer.icons.glyphs.modified}",
folder = {
default = "${cfg.renderer.icons.glyphs.folder.default}",
open = "${cfg.renderer.icons.glyphs.folder.open}",
arrow_open = "${cfg.renderer.icons.glyphs.folder.arrowOpen}",
arrow_closed = "${cfg.renderer.icons.glyphs.folder.arrowClosed}",
empty = "${cfg.renderer.icons.glyphs.folder.empty}",
empty_open = "${cfg.renderer.icons.glyphs.folder.emptyOpen}",
symlink = "${cfg.renderer.icons.glyphs.folder.symlink}",
symlink_open = "${cfg.renderer.icons.glyphs.folder.symlinkOpen}",
},
git = {
unstaged = "${cfg.renderer.icons.glyphs.git.unstaged}",
staged = "${cfg.renderer.icons.glyphs.git.staged}",
unmerged = "${cfg.renderer.icons.glyphs.git.unmerged}",
renamed = "${cfg.renderer.icons.glyphs.git.renamed}",
untracked = "${cfg.renderer.icons.glyphs.git.untracked}",
deleted = "${cfg.renderer.icons.glyphs.git.deleted}",
ignored = "${cfg.renderer.icons.glyphs.git.ignored}",
},
},
},
},
filters = {
git_ignored = ${boolToString cfg.filters.gitIgnored},
dotfiles = ${boolToString cfg.filters.dotfiles},
git_clean = ${boolToString cfg.filters.gitClean},
no_buffer = ${boolToString cfg.filters.noBuffer},
exclude = ${listToLuaTable cfg.filters.exclude},
},
trash = {
cmd = "${cfg.trash.cmd}",
},
actions = {
use_system_clipboard = ${boolToString cfg.actions.useSystemClipboard},
change_dir = {
enable = ${boolToString cfg.actions.changeDir.enable},
global = ${boolToString cfg.actions.changeDir.global},
restrict_above_cwd = ${boolToString cfg.actions.changeDir.restrictAboveCwd},
},
expand_all = {
max_folder_discovery = ${toString cfg.actions.expandAll.maxFolderDiscovery},
exclude = ${listToLuaTable cfg.actions.expandAll.exclude},
},
file_popup = {
open_win_config = ${expToLua cfg.actions.filePopup.openWinConfig},
},
open_file = {
quit_on_open = ${boolToString cfg.actions.openFile.quitOnOpen},
eject = ${boolToString cfg.actions.openFile.eject},
resize_window = ${boolToString cfg.actions.openFile.resizeWindow},
window_picker = {
enable = ${boolToString cfg.actions.openFile.windowPicker.enable},
picker = "${cfg.actions.openFile.windowPicker.picker}",
chars = "${cfg.actions.openFile.windowPicker.chars}",
exclude = {
filetype = ${listToLuaTable cfg.actions.openFile.windowPicker.exclude.filetype},
buftype = ${listToLuaTable cfg.actions.openFile.windowPicker.exclude.buftype},
},
},
},
remove_file = {
close_window = ${boolToString cfg.actions.removeFile.closeWindow},
},
},
live_filter = {
prefix = "${cfg.liveFilter.prefix}",
always_show_folders = ${boolToString cfg.liveFilter.alwaysShowFolders},
},
tab = {
sync = {
open = ${boolToString cfg.tab.sync.open},
close = ${boolToString cfg.tab.sync.close},
ignore = ${listToLuaTable cfg.tab.sync.ignore},
},
},
notify = {
threshold = vim.log.levels.${cfg.notify.threshold},
absolute_path = ${boolToString cfg.notify.absolutePath},
},
ui = {
confirm = {
remove = ${boolToString cfg.ui.confirm.remove},
trash = ${boolToString cfg.ui.confirm.trash},
},
},
})
${ ${
optionalString cfg.openOnSetup '' optionalString cfg.openOnSetup ''

View file

@ -4,7 +4,8 @@
... ...
}: let }: let
inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.types) nullOr str bool int listOf enum attrs oneOf addCheck submodule; inherit (lib.types) nullOr str bool int submodule listOf enum oneOf attrs addCheck;
inherit (lib.nvim.types) mkPluginSetupOption;
in { in {
options.vim.filetree.nvimTree = { options.vim.filetree.nvimTree = {
enable = mkEnableOption "filetree via nvim-tree.lua"; enable = mkEnableOption "filetree via nvim-tree.lua";
@ -38,19 +39,20 @@ in {
type = bool; type = bool;
}; };
hijackNetrw = mkOption { setupOpts = mkPluginSetupOption "Nvim Tree" {
hijack_netrw = mkOption {
default = true; default = true;
description = "Prevents netrw from automatically opening when opening directories"; description = "Prevents netrw from automatically opening when opening directories";
type = bool; type = bool;
}; };
autoreloadOnWrite = mkOption { autoreload_on_write = mkOption {
default = true; default = true;
description = "Auto reload tree on write"; description = "Auto reload tree on write";
type = bool; type = bool;
}; };
updateFocusedFile = mkOption { update_focused_file = mkOption {
description = '' description = ''
Update the focused file on `BufEnter`, un-collapses the folders recursively Update the focused file on `BufEnter`, un-collapses the folders recursively
until it finds the file. until it finds the file.
@ -64,7 +66,7 @@ in {
description = "update focused file"; description = "update focused file";
}; };
updateRoot = mkOption { update_root = mkOption {
type = bool; type = bool;
default = false; default = false;
description = '' description = ''
@ -75,7 +77,7 @@ in {
''; '';
}; };
ignoreList = mkOption { ignore_list = mkOption {
type = listOf str; type = listOf str;
default = []; default = [];
description = '' description = ''
@ -97,26 +99,26 @@ in {
type = enum ["name" "extension" "modification_time" "case_sensitive" "suffix" "filetype"]; type = enum ["name" "extension" "modification_time" "case_sensitive" "suffix" "filetype"];
}; };
foldersFirst = mkOption { folders_first = mkOption {
default = true; default = true;
description = "Sort folders before files. Has no effect when `sort.sorter` is a function."; description = "Sort folders before files. Has no effect when `sort.sorter` is a function.";
type = bool; type = bool;
}; };
}; };
hijackCursor = mkOption { hijack_cursor = mkOption {
default = false; default = false;
description = "Hijack the cursor in the tree to put it at the start of the filename"; description = "Hijack the cursor in the tree to put it at the start of the filename";
type = bool; type = bool;
}; };
hijackUnnamedBufferWhenOpening = mkOption { hijack_unnamed_buffer_when_opening = mkOption {
default = false; default = false;
description = "Open nvimtree in place of the unnamed buffer if it's empty."; description = "Open nvimtree in place of the unnamed buffer if it's empty.";
type = bool; type = bool;
}; };
rootDirs = mkOption { root_dirs = mkOption {
default = []; default = [];
description = '' description = ''
Preferred root directories. Only relevant when `updateFocusedFile.updateRoot` is `true` Preferred root directories. Only relevant when `updateFocusedFile.updateRoot` is `true`
@ -124,7 +126,7 @@ in {
type = listOf str; type = listOf str;
}; };
preferStartupRoot = mkOption { prefer_startup_root = mkOption {
default = false; default = false;
description = '' description = ''
Prefer startup root directory when updating root directory of the tree. Prefer startup root directory when updating root directory of the tree.
@ -133,7 +135,7 @@ in {
type = bool; type = bool;
}; };
syncRootWithCwd = mkOption { sync_root_with_cwd = mkOption {
type = bool; type = bool;
default = false; default = false;
description = '' description = ''
@ -144,47 +146,38 @@ in {
''; '';
}; };
reloadOnBufEnter = mkOption { reload_on_buf_enter = mkOption {
default = false; default = false;
type = bool; type = bool;
description = "Automatically reloads the tree on `BufEnter` nvim-tree."; description = "Automatically reloads the tree on `BufEnter` nvim-tree.";
}; };
respectBufCwd = mkOption { respect_buf_cwd = mkOption {
default = false; default = false;
type = bool; type = bool;
description = "Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree."; description = "Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.";
}; };
hijackDirectories = mkOption { hijack_directories = {
description = "hijack new directory buffers when they are opened (`:e dir`).";
default = {
enable = true;
autoOpen = false;
};
type = submodule {
options = {
enable = mkOption { enable = mkOption {
type = bool; type = bool;
description = '' description = ''
Enable the `hijack_directories` feature. Disable this option if you use vim-dirvish or dirbuf.nvim. Enable the `hijack_directories` feature. Disable this option if you use vim-dirvish or dirbuf.nvim.
If `hijack_netrw` and `disable_netrw` are `false`, this feature will be disabled. If `hijack_netrw` and `disable_netrw` are `false`, this feature will be disabled.
''; '';
default = true;
}; };
autoOpen = mkOption { auto_open = mkOption {
type = bool; type = bool;
description = '' description = ''
Opens the tree if the tree was previously closed. Opens the tree if the tree was previously closed.
''; '';
}; default = false;
};
}; };
}; };
systemOpen = { system_open = {
args = mkOption { args = mkOption {
default = []; default = [];
description = "Optional argument list."; description = "Optional argument list.";
@ -215,18 +208,18 @@ in {
options = { options = {
enable = mkEnableOption "diagnostics view in the signcolumn."; enable = mkEnableOption "diagnostics view in the signcolumn.";
debounceDelay = mkOption { debounce_delay = mkOption {
description = "Idle milliseconds between diagnostic event and update."; description = "Idle milliseconds between diagnostic event and update.";
type = int; type = int;
default = 50; default = 50;
}; };
showOnDirs = mkOption { show_on_dirs = mkOption {
description = "Show diagnostic icons on parent directories."; description = "Show diagnostic icons on parent directories.";
default = false; default = false;
}; };
showOnOpenDirs = mkOption { show_on_open_dirs = mkOption {
type = bool; type = bool;
default = true; default = true;
description = '' description = ''
@ -290,19 +283,19 @@ in {
git = { git = {
enable = mkEnableOption "Git integration with icons and colors."; enable = mkEnableOption "Git integration with icons and colors.";
showOnDirs = mkOption { show_on_dirs = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Show git icons on parent directories."; description = "Show git icons on parent directories.";
}; };
showOnOpenDirs = mkOption { show_on_open_dirs = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Show git icons on directories that are open."; description = "Show git icons on directories that are open.";
}; };
disableForDirs = mkOption { disable_for_dirs = mkOption {
type = listOf str; type = listOf str;
default = []; default = [];
description = '' description = ''
@ -328,13 +321,13 @@ in {
options = { options = {
enable = mkEnableOption "Modified files with icons and color highlight."; enable = mkEnableOption "Modified files with icons and color highlight.";
showOnDirs = mkOption { show_on_dirs = mkOption {
type = bool; type = bool;
description = "Show modified icons on parent directories."; description = "Show modified icons on parent directories.";
default = true; default = true;
}; };
showOnOpenDirs = mkOption { show_on_open_dirs = mkOption {
type = bool; type = bool;
description = "Show modified icons on directories that are open."; description = "Show modified icons on directories that are open.";
default = true; default = true;
@ -343,7 +336,7 @@ in {
}; };
}; };
filesystemWatchers = mkOption { filesystem_watchers = mkOption {
description = '' description = ''
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 Using this will disable BufEnter / BufWritePost events in nvim-tree which
@ -360,13 +353,13 @@ in {
default = true; default = true;
}; };
debounceDelay = mkOption { debounce_delay = mkOption {
description = "Idle milliseconds between filesystem change and action."; description = "Idle milliseconds between filesystem change and action.";
type = int; type = int;
default = 50; default = 50;
}; };
ignoreDirs = mkOption { ignore_dirs = mkOption {
type = listOf str; type = listOf str;
default = []; default = [];
description = '' description = ''
@ -388,7 +381,7 @@ in {
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
centralizeSelection = mkOption { centralize_selection = mkOption {
description = "If true, reposition the view so that the current node is initially centralized when entering nvim-tree."; description = "If true, reposition the view so that the current node is initially centralized when entering nvim-tree.";
type = bool; type = bool;
default = false; default = false;
@ -400,7 +393,7 @@ in {
default = true; default = true;
}; };
debounceDelay = mkOption { debounce_delay = mkOption {
type = int; type = int;
default = 15; default = 15;
description = '' description = ''
@ -434,7 +427,7 @@ in {
default = "left"; default = "left";
}; };
preserveWindowProportions = mkOption { preserve_window_proportions = mkOption {
description = '' description = ''
Preserves window proportions when opening a file. Preserves window proportions when opening a file.
If `false`, the height and width of windows other than nvim-tree will be equalized. If `false`, the height and width of windows other than nvim-tree will be equalized.
@ -477,13 +470,13 @@ in {
default = false; default = false;
}; };
quitOnFocusLoss = mkOption { quit_on_focus_loss = mkOption {
description = "Close the floating tree window when it loses focus."; description = "Close the floating tree window when it loses focus.";
type = bool; type = bool;
default = true; default = true;
}; };
openWinConfig = mkOption { open_win_config = mkOption {
description = "Floating window config. See `:h nvim_open_win()` for more details."; description = "Floating window config. See `:h nvim_open_win()` for more details.";
type = attrs; type = attrs;
default = { default = {
@ -503,25 +496,25 @@ in {
}; };
renderer = { renderer = {
addTrailing = mkOption { add_trailing = mkOption {
default = false; default = false;
description = "Appends a trailing slash to folder names."; description = "Appends a trailing slash to folder names.";
type = bool; type = bool;
}; };
groupEmpty = mkOption { group_empty = mkOption {
default = false; default = false;
description = "Compact folders that only contain a single folder into one node in the file tree."; description = "Compact folders that only contain a single folder into one node in the file tree.";
type = bool; type = bool;
}; };
fullName = mkOption { full_name = mkOption {
default = false; default = false;
description = "Display node whose name length is wider than the width of nvim-tree window in floating window."; description = "Display node whose name length is wider than the width of nvim-tree window in floating window.";
type = bool; type = bool;
}; };
highlightGit = mkOption { highlight_git = mkOption {
type = bool; type = bool;
default = false; default = false;
description = '' description = ''
@ -531,7 +524,7 @@ in {
''; '';
}; };
highlightOpenedFiles = mkOption { highlight_opened_files = mkOption {
type = enum ["none" "icon" "name" "all"]; type = enum ["none" "icon" "name" "all"];
default = "none"; default = "none";
description = '' description = ''
@ -540,7 +533,7 @@ in {
''; '';
}; };
highlightModified = mkOption { highlight_modified = mkOption {
type = enum ["none" "icon" "name" "all"]; type = enum ["none" "icon" "name" "all"];
default = "none"; default = "none";
description = '' description = ''
@ -549,7 +542,7 @@ in {
''; '';
}; };
rootFolderLabel = mkOption { root_folder_label = mkOption {
type = oneOf [str bool]; type = oneOf [str bool];
default = false; default = false;
example = ''"":~:s?$?/..?"''; example = ''"":~:s?$?/..?"'';
@ -566,19 +559,19 @@ in {
''; '';
}; };
indentWidth = mkOption { indent_width = mkOption {
type = addCheck int (x: x >= 1); type = addCheck int (x: x >= 1);
default = 2; default = 2;
description = "Number of spaces for an each tree nesting level. Minimum 1."; description = "Number of spaces for an each tree nesting level. Minimum 1.";
}; };
indentMarkers = mkOption { indent_markers = mkOption {
description = "Configuration options for tree indent markers."; description = "Configuration options for tree indent markers.";
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
enable = mkEnableOption "Display indent markers when folders are open."; enable = mkEnableOption "Display indent markers when folders are open.";
inlineArrows = mkOption { inline_arrows = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Display folder arrows in the same column as indent marker when using `renderer.icons.show.folder_arrow`"; description = "Display folder arrows in the same column as indent marker when using `renderer.icons.show.folder_arrow`";
@ -599,13 +592,13 @@ in {
}; };
}; };
specialFiles = mkOption { special_files = mkOption {
type = listOf str; type = listOf str;
default = ["Cargo.toml" "README.md" "readme.md" "Makefile" "MAKEFILE" "flake.nix"]; # ;) default = ["Cargo.toml" "README.md" "readme.md" "Makefile" "MAKEFILE" "flake.nix"]; # ;)
description = "A list of filenames that gets highlighted with `NvimTreeSpecialFile"; description = "A list of filenames that gets highlighted with `NvimTreeSpecialFile";
}; };
symlinkDestination = mkOption { symlink_destination = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Whether to show the destination of the symlink."; description = "Whether to show the destination of the symlink.";
@ -616,19 +609,19 @@ in {
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
webdevColors = mkOption { webdev_colors = mkOption {
type = bool; type = bool;
description = " Use the webdev icon colors, otherwise `NvimTreeFileIcon`"; description = " Use the webdev icon colors, otherwise `NvimTreeFileIcon`";
default = true; default = true;
}; };
gitPlacement = mkOption { git_placement = mkOption {
type = enum ["before" "after" "signcolumn"]; type = enum ["before" "after" "signcolumn"];
description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled."; description = "Place where the git icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
default = "before"; default = "before";
}; };
modifiedPlacement = mkOption { modified_placement = mkOption {
type = enum ["before" "after" "signcolumn"]; type = enum ["before" "after" "signcolumn"];
description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled."; description = "Place where the modified icons will be rendered. `signcolumn` requires `view.signcolumn` to be enabled.";
default = "after"; default = "after";
@ -640,7 +633,7 @@ in {
default = " "; default = " ";
}; };
symlinkArrow = mkOption { symlink_arrow = mkOption {
type = str; type = str;
description = "Used as a separator between symlinks' source and target."; description = "Used as a separator between symlinks' source and target.";
default = " "; default = " ";
@ -659,7 +652,7 @@ in {
default = true; default = true;
}; };
folderArrow = mkOption { folder_arrow = mkOption {
type = bool; type = bool;
default = true; default = true;
description = '' description = ''
@ -754,15 +747,15 @@ in {
description = "Filtering options."; description = "Filtering options.";
default = { default = {
gitIgnored = false; git_ignored = false;
dotfiles = false; dotfiles = false;
gitClean = false; git_clean = false;
noBuffer = false; no_buffer = false;
exclude = []; exclude = [];
}; };
type = submodule { type = submodule {
options = { options = {
gitIgnored = mkOption { git_ignored = mkOption {
type = bool; type = bool;
description = "Ignore files based on `.gitignore`. Requires git.enable` to be `true`"; description = "Ignore files based on `.gitignore`. Requires git.enable` to be `true`";
default = false; default = false;
@ -774,7 +767,7 @@ in {
default = false; default = false;
}; };
gitClean = mkOption { git_clean = mkOption {
type = bool; type = bool;
default = false; default = false;
@ -784,7 +777,7 @@ in {
''; '';
}; };
noBuffer = mkOption { no_buffer = mkOption {
type = bool; type = bool;
default = false; default = false;
description = "Do not show files that have no `buflisted()` buffer."; description = "Do not show files that have no `buflisted()` buffer.";
@ -820,7 +813,7 @@ in {
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
useSystemClipboard = mkOption { use_system_clipboard = mkOption {
type = bool; type = bool;
default = true; default = true;
description = '' description = ''
@ -831,7 +824,7 @@ in {
}; };
# change_dir actions # change_dir actions
changeDir = mkOption { change_dir = mkOption {
description = "vim `change-directory` behaviour"; description = "vim `change-directory` behaviour";
default = {}; default = {};
type = submodule { type = submodule {
@ -851,7 +844,7 @@ in {
''; '';
}; };
restrictAboveCwd = mkOption { restrict_above_cwd = mkOption {
type = bool; type = bool;
default = false; default = false;
description = '' description = ''
@ -863,12 +856,12 @@ in {
}; };
# expand_all actions # expand_all actions
expandAll = mkOption { expand_all = mkOption {
description = "Configuration for expand_all behaviour."; description = "Configuration for expand_all behaviour.";
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
maxFolderDiscovery = mkOption { max_folder_discovery = mkOption {
type = int; type = int;
default = 300; default = 300;
description = '' description = ''
@ -886,12 +879,12 @@ in {
}; };
# file_popup actions # file_popup actions
filePopup = mkOption { file_popup = mkOption {
description = "Configuration for file_popup behaviour."; description = "Configuration for file_popup behaviour.";
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
openWinConfig = mkOption { open_win_config = mkOption {
type = attrs; type = attrs;
default = { default = {
col = 1; col = 1;
@ -907,12 +900,12 @@ in {
}; };
# open_file actions # open_file actions
openFile = mkOption { open_file = mkOption {
description = "Configuration options for opening a file from nvim-tree."; description = "Configuration options for opening a file from nvim-tree.";
default = {}; default = {};
type = submodule { type = submodule {
options = { options = {
quitOnOpen = mkOption { quit_on_open = mkOption {
type = bool; type = bool;
description = "Closes the explorer when opening a file."; description = "Closes the explorer when opening a file.";
default = false; default = false;
@ -924,14 +917,14 @@ in {
default = false; default = false;
}; };
resizeWindow = mkOption { resize_window = mkOption {
type = bool; type = bool;
default = false; default = false;
description = "Resizes the tree when opening a file. Previously `view.auto_resize`"; description = "Resizes the tree when opening a file. Previously `view.auto_resize`";
}; };
windowPicker = mkOption { window_picker = mkOption {
description = "window_picker"; description = "window_picker";
default = {}; default = {};
type = submodule { type = submodule {
@ -985,8 +978,8 @@ in {
}; };
}; };
removeFile = { remove_file = {
closeWindow = mkOption { close_window = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Close any window displaying a file when removing the file from the tree"; description = "Close any window displaying a file when removing the file from the tree";
@ -996,7 +989,7 @@ in {
}; };
}; };
liveFilter = mkOption { live_filter = mkOption {
description = '' description = ''
Configurations for the live_filtering feature. Configurations for the live_filtering feature.
The live filter allows you to filter the tree nodes dynamically, based on The live filter allows you to filter the tree nodes dynamically, based on
@ -1013,7 +1006,7 @@ in {
default = "[FILTER]: "; default = "[FILTER]: ";
}; };
alwaysShowFolders = mkOption { always_show_folders = mkOption {
type = bool; type = bool;
description = "Whether to filter folders or not."; description = "Whether to filter folders or not.";
default = true; default = true;
@ -1075,7 +1068,7 @@ in {
default = "INFO"; default = "INFO";
}; };
absolutePath = mkOption { absolute_path = mkOption {
type = bool; type = bool;
description = "Whether to use absolute paths or item names in fs action notifications."; description = "Whether to use absolute paths or item names in fs action notifications.";
default = true; default = true;
@ -1105,6 +1098,7 @@ in {
}; };
}; };
}; };
};
# kept for backwards compatibility # kept for backwards compatibility
openOnSetup = mkOption { openOnSetup = mkOption {