mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 01:08:43 +02:00
parent
c34c941c8f
commit
1ac27edf2e
2 changed files with 699 additions and 378 deletions
|
@ -7,6 +7,7 @@
|
|||
with lib; let
|
||||
cfg = config.plugins.nvim-tree;
|
||||
helpers = import ../helpers.nix {inherit lib;};
|
||||
ifNonNull' = helpers.ifNonNull';
|
||||
optionWarnings = import ../../lib/option-warnings.nix args;
|
||||
basePluginPath = ["plugins" "nvim-tree"];
|
||||
|
||||
|
@ -36,10 +37,6 @@ in {
|
|||
option = basePluginPath ++ ["updateCwd"];
|
||||
newOption = basePluginPath ++ ["syncRootWithCwd"];
|
||||
})
|
||||
(optionWarnings.mkRenamedOption {
|
||||
option = basePluginPath ++ ["updateFocusedFile" "updateCwd"];
|
||||
newOption = basePluginPath ++ ["updateFocusedFile" "updateRoot"];
|
||||
})
|
||||
(optionWarnings.mkRenamedOption {
|
||||
option = basePluginPath ++ ["openOnTab"];
|
||||
newOption = basePluginPath ++ ["tab" "sync" "open"];
|
||||
|
@ -48,6 +45,10 @@ in {
|
|||
option = basePluginPath ++ ["updateToBufDir"];
|
||||
newOption = basePluginPath ++ ["hijackDirectories"];
|
||||
})
|
||||
(optionWarnings.mkDeprecatedOption {
|
||||
option = basePluginPath ++ ["removeKeymaps"];
|
||||
alternative = basePluginPath ++ ["onAttach"];
|
||||
})
|
||||
];
|
||||
|
||||
options.plugins.nvim-tree =
|
||||
|
@ -172,9 +173,12 @@ in {
|
|||
Will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
|
||||
'';
|
||||
|
||||
hijackDirectories = {
|
||||
hijackDirectories =
|
||||
helpers.mkCompositeOption
|
||||
"Hijacks new directory buffers when they are opened (`:e dir`)."
|
||||
{
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Hijacks new directory buffers when they are opened (`:e dir`).
|
||||
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.
|
||||
'';
|
||||
|
@ -184,11 +188,14 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
updateFocusedFile = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
updateFocusedFile =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Update the focused file on `BufEnter`, un-collapses the folders recursively until it finds
|
||||
the file.
|
||||
'';
|
||||
''
|
||||
{
|
||||
enable = helpers.defaultNullOpts.mkBool false "Enable this feature.";
|
||||
|
||||
updateRoot = helpers.defaultNullOpts.mkBool false ''
|
||||
Update the root directory of the tree if the file is not under current root directory.
|
||||
|
@ -198,15 +205,19 @@ in {
|
|||
'';
|
||||
|
||||
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 file
|
||||
isn't found under the current root directory.
|
||||
Only relevant when `updateFocusedFile.updateRoot` and `updateFocusedFile.enable` are `true`.
|
||||
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.
|
||||
Only relevant when `updateFocusedFile.updateRoot` and `updateFocusedFile.enable` are
|
||||
`true`.
|
||||
'';
|
||||
};
|
||||
|
||||
systemOpen = {
|
||||
systemOpen =
|
||||
helpers.mkCompositeOption
|
||||
"Open a file or directory in your preferred application."
|
||||
{
|
||||
cmd = helpers.defaultNullOpts.mkStr "" ''
|
||||
A custom command to open files or directory with.
|
||||
The open command itself.
|
||||
|
||||
Leave empty for OS specific default:
|
||||
UNIX: `"xdg-open"`
|
||||
|
@ -222,8 +233,9 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
diagnostics = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
diagnostics =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
Show LSP and COC diagnostics in the signcolumn
|
||||
Note that the modified sign will take precedence over the diagnostics signs.
|
||||
|
||||
|
@ -233,7 +245,9 @@ in {
|
|||
- `NvimTreeLspDiagnosticsWarning`
|
||||
- `NvimTreeLspDiagnosticsInformation`
|
||||
- `NvimTreeLspDiagnosticsHint`
|
||||
'';
|
||||
''
|
||||
{
|
||||
enable = helpers.defaultNullOpts.mkBool false "Enable/disable the feature.";
|
||||
|
||||
debounceDelay = helpers.defaultNullOpts.mkInt 50 ''
|
||||
Idle milliseconds between diagnostic event and update.
|
||||
|
@ -248,8 +262,7 @@ in {
|
|||
Only relevant when `diagnostics.showOnDirs` is `true
|
||||
'';
|
||||
|
||||
# Icons for diagnostic severity.
|
||||
icons = {
|
||||
icons = helpers.mkCompositeOption "Icons for diagnostic severity." {
|
||||
hint = helpers.defaultNullOpts.mkStr "" "";
|
||||
info = helpers.defaultNullOpts.mkStr "" "";
|
||||
warning = helpers.defaultNullOpts.mkStr "" "";
|
||||
|
@ -258,14 +271,20 @@ in {
|
|||
|
||||
severity = let
|
||||
severityEnum = ["error" "warn" "info" "hint"];
|
||||
in {
|
||||
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 = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Git integration with icons and colors.";
|
||||
git = helpers.mkCompositeOption "Git integration with icons and colors." {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Enable / disable the feature.";
|
||||
|
||||
ignore = helpers.defaultNullOpts.mkBool true ''
|
||||
Ignore files based on `.gitignore`. Requires `git.enable` to be `true`.
|
||||
|
@ -286,10 +305,8 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
modified = {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Indicate which file have unsaved modification.
|
||||
'';
|
||||
modified = helpers.mkCompositeOption "Indicate which file have unsaved modification." {
|
||||
enable = helpers.defaultNullOpts.mkBool false "Enable / disable the feature.";
|
||||
|
||||
showOnDirs = helpers.defaultNullOpts.mkBool true ''
|
||||
Show modified indication on directory whose children are modified.
|
||||
|
@ -301,14 +318,17 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
filesystemWatchers = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
filesystemWatchers =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
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
|
||||
update the whole tree.
|
||||
With this feature, the tree will be updated only for the appropriate folder change,
|
||||
resulting in better performance.
|
||||
'';
|
||||
''
|
||||
{
|
||||
enable = helpers.defaultNullOpts.mkBool true "Enable / disable the feature.";
|
||||
|
||||
debounceDelay = helpers.defaultNullOpts.mkInt 50 ''
|
||||
Idle milliseconds between filesystem change and action.
|
||||
|
@ -344,6 +364,8 @@ in {
|
|||
eg. {"<C-o>", "<CR>", "o", "<Tab>"}
|
||||
- Remove all default mappings by passing `true`
|
||||
- Ignore by passing `false`
|
||||
|
||||
Deprecated: See https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach
|
||||
'';
|
||||
|
||||
selectPrompts = helpers.defaultNullOpts.mkBool false ''
|
||||
|
@ -351,8 +373,7 @@ in {
|
|||
Necessary when using a UI prompt decorator such as dressing.nvim or telescope-ui-select.nvim.
|
||||
'';
|
||||
|
||||
# Window / buffer setup
|
||||
view = {
|
||||
view = helpers.mkCompositeOption "Window / buffer setup." {
|
||||
centralizeSelection = helpers.defaultNullOpts.mkBool false ''
|
||||
When entering nvim-tree, reposition the view so that the current node is
|
||||
initially centralized, see |zz|.
|
||||
|
@ -377,14 +398,15 @@ in {
|
|||
types.str
|
||||
types.int
|
||||
(types.submodule {
|
||||
options = {
|
||||
min = helpers.defaultNullOpts.mkNullable (types.either types.str types.int) "30" ''
|
||||
Minimum dynamic width.
|
||||
'';
|
||||
max = helpers.defaultNullOpts.mkNullable (types.either types.str types.int) "-1" ''
|
||||
options = let
|
||||
strOrInt = types.either types.str types.int;
|
||||
in {
|
||||
min = helpers.defaultNullOpts.mkNullable strOrInt "30" "Minimum dynamic width.";
|
||||
|
||||
max = helpers.defaultNullOpts.mkNullable strOrInt "-1" ''
|
||||
Maximum dynamic width, -1 for unbounded.
|
||||
'';
|
||||
padding = helpers.defaultNullOpts.mkNullable (types.either types.str types.int) "1" ''
|
||||
padding = helpers.defaultNullOpts.mkNullable strOrInt "1" ''
|
||||
Extra padding to the right.
|
||||
'';
|
||||
};
|
||||
|
@ -419,7 +441,7 @@ in {
|
|||
Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`.
|
||||
'';
|
||||
|
||||
mappings = {
|
||||
mappings = helpers.mkCompositeOption "Deprecated: please see |nvim-tree-mappings-legacy|." {
|
||||
customOnly = helpers.defaultNullOpts.mkBool false ''
|
||||
Will use only the provided user mappings and not the default otherwise,
|
||||
extends the default mappings with the provided user mappings.
|
||||
|
@ -476,7 +498,7 @@ in {
|
|||
key = "p";
|
||||
action = "print_the_node_path";
|
||||
action_cb = \'\'
|
||||
function print_node_path(node)
|
||||
function(node)
|
||||
print(node.absolute_path)
|
||||
end
|
||||
\'\';
|
||||
|
@ -486,7 +508,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
float = {
|
||||
float = helpers.mkCompositeOption "Configuration options for floating window." {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Tree window will be floating.
|
||||
'';
|
||||
|
@ -499,8 +521,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
# UI rendering setup
|
||||
renderer = {
|
||||
renderer = helpers.mkCompositeOption "UI rendering setup" {
|
||||
addTrailing = helpers.defaultNullOpts.mkBool false ''
|
||||
Appends a trailing slash to folder names.
|
||||
'';
|
||||
|
@ -565,8 +586,7 @@ in {
|
|||
Number of spaces for an each tree nesting level. Minimum 1.
|
||||
'';
|
||||
|
||||
# Configuration options for tree indent markers.
|
||||
indentMarkers = {
|
||||
indentMarkers = helpers.mkCompositeOption "Configuration options for tree indent markers." {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Display indent markers when folders are open
|
||||
'';
|
||||
|
@ -576,8 +596,7 @@ in {
|
|||
|renderer.icons.show.folder_arrow|.
|
||||
'';
|
||||
|
||||
# Icons shown before the file/directory. Length 1.
|
||||
icons = {
|
||||
icons = helpers.mkCompositeOption "Icons shown before the file/directory. Length 1." {
|
||||
corner = helpers.defaultNullOpts.mkStr "└" "";
|
||||
edge = helpers.defaultNullOpts.mkStr "│" "";
|
||||
item = helpers.defaultNullOpts.mkStr "│" "";
|
||||
|
@ -586,8 +605,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
# Configuration options for icons.
|
||||
icons = {
|
||||
icons = helpers.mkCompositeOption "Configuration options for icons." {
|
||||
webdevColors = helpers.defaultNullOpts.mkBool true ''
|
||||
Use the webdev icon colors, otherwise `NvimTreeFileIcon`.
|
||||
'';
|
||||
|
@ -622,8 +640,7 @@ in {
|
|||
Used as a separator between symlinks' source and target.
|
||||
'';
|
||||
|
||||
# Configuration options for showing icon types.
|
||||
show = {
|
||||
show = helpers.mkCompositeOption "Configuration options for showing icon types." {
|
||||
file = helpers.defaultNullOpts.mkBool true ''
|
||||
Show an icon before the file name. `nvim-web-devicons` will be used if available.
|
||||
'';
|
||||
|
@ -648,8 +665,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Configuration options for icon glyphs.
|
||||
glyphs = {
|
||||
glyphs = helpers.mkCompositeOption "Configuration options for icon glyphs." {
|
||||
default = helpers.defaultNullOpts.mkStr "" ''
|
||||
Glyph for files. Will be overridden by `nvim-web-devicons` if available.
|
||||
'';
|
||||
|
@ -662,8 +678,7 @@ in {
|
|||
Icon to display for modified files.
|
||||
'';
|
||||
|
||||
# Glyphs for directories.
|
||||
folder = {
|
||||
folder = helpers.mkCompositeOption "Glyphs for directories." {
|
||||
arrowClosed = helpers.defaultNullOpts.mkStr "" ''
|
||||
Arrow glyphs for closed directories.
|
||||
'';
|
||||
|
@ -690,8 +705,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Glyphs for git status.
|
||||
git = {
|
||||
git = helpers.mkCompositeOption "Glyphs for git status." {
|
||||
unstaged = helpers.defaultNullOpts.mkStr "✗" ''
|
||||
Glyph for unstaged nodes.
|
||||
'';
|
||||
|
@ -728,8 +742,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Filtering options
|
||||
filters = {
|
||||
filters = helpers.mkCompositeOption "Filtering options." {
|
||||
dotfiles = helpers.defaultNullOpts.mkBool false ''
|
||||
Do not show dotfiles: files starting with a `.`
|
||||
Toggle via the `toggle_dotfiles` action, default mapping `H`.
|
||||
|
@ -760,17 +773,16 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Configuration options for trashing
|
||||
trash.cmd = helpers.defaultNullOpts.mkStr "gio trash" ''
|
||||
trash = helpers.mkCompositeOption "Configuration options for trashing." {
|
||||
cmd = helpers.defaultNullOpts.mkStr "gio trash" ''
|
||||
The command used to trash items (must be installed on your system).
|
||||
The default is shipped with glib2 which is a common linux package.
|
||||
Only available for UNIX.
|
||||
'';
|
||||
};
|
||||
|
||||
# Configuration for various actions
|
||||
actions = {
|
||||
# vim |current-directory| behaviour
|
||||
changeDir = {
|
||||
actions = helpers.mkCompositeOption "Configuration for various actions." {
|
||||
changeDir = helpers.mkCompositeOption "vim |current-directory| behaviour." {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Change the working directory when changing directories in the tree.
|
||||
'';
|
||||
|
@ -785,8 +797,7 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Configuration for expand_all behaviour
|
||||
expandAll = {
|
||||
expandAll = helpers.mkCompositeOption "Configuration for expand_all behaviour." {
|
||||
maxFolderDiscovery = helpers.defaultNullOpts.mkInt 300 ''
|
||||
Limit the number of folders being explored when expanding every folders.
|
||||
Avoids hanging neovim when running this action on very large folders.
|
||||
|
@ -798,11 +809,14 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Configuration for file_popup behaviour
|
||||
filePopup.openWinConfig = openWinConfigOption;
|
||||
filePopup = helpers.mkCompositeOption "Configuration for file_popup behaviour." {
|
||||
openWinConfig = openWinConfigOption;
|
||||
};
|
||||
|
||||
# Configuration options for opening a file from nvim-tree
|
||||
openFile = {
|
||||
openFile =
|
||||
helpers.mkCompositeOption
|
||||
"Configuration options for opening a file from nvim-tree."
|
||||
{
|
||||
quitOnOpen = helpers.defaultNullOpts.mkBool false ''
|
||||
Closes the explorer when opening a file.
|
||||
It will also disable preventing a buffer overriding the tree.
|
||||
|
@ -811,9 +825,9 @@ in {
|
|||
resizeWindow = helpers.defaultNullOpts.mkBool true ''
|
||||
Resizes the tree when opening a file.
|
||||
'';
|
||||
};
|
||||
|
||||
# Window picker configuration
|
||||
windowPicker = {
|
||||
windowPicker = helpers.mkCompositeOption "Window picker configuration." {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable the feature. If the feature is not enabled, files will open in window from
|
||||
which you last opened the tree.
|
||||
|
@ -849,11 +863,12 @@ in {
|
|||
the picker that the buffer's window should not be selectable.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
removeFile.closeWindow = helpers.defaultNullOpts.mkBool true ''
|
||||
removeFile = helpers.mkCompositeOption "" {
|
||||
closeWindow = helpers.defaultNullOpts.mkBool true ''
|
||||
Close any window displaying a file when removing the file from the tree.
|
||||
'';
|
||||
};
|
||||
|
||||
useSystemClipboard = helpers.defaultNullOpts.mkBool true ''
|
||||
A boolean value that toggle the use of system clipboard when copy/paste function are
|
||||
|
@ -863,12 +878,16 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# 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.
|
||||
liveFilter = {
|
||||
liveFilter =
|
||||
helpers.mkCompositeOption
|
||||
''
|
||||
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.
|
||||
'';
|
||||
|
@ -878,10 +897,8 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
# Configuration for tab behaviour
|
||||
tab = {
|
||||
# Configuration for syncing nvim-tree across tabs
|
||||
sync = {
|
||||
tab = helpers.mkCompositeOption "Configuration for tab behaviour." {
|
||||
sync = helpers.mkCompositeOption "Configuration for syncing nvim-tree across tabs." {
|
||||
open = helpers.defaultNullOpts.mkBool false ''
|
||||
Opens the tree automatically when switching tabpage or opening a new tabpage if the tree
|
||||
was previously open.
|
||||
|
@ -898,8 +915,8 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
# Configuration for notification
|
||||
notify.threshold = helpers.defaultNullOpts.mkEnum ["error" "warning" "info" "debug"] "info" ''
|
||||
notify = helpers.mkCompositeOption "Configuration for notification." {
|
||||
threshold = helpers.defaultNullOpts.mkEnum ["error" "warning" "info" "debug"] "info" ''
|
||||
Specify minimum notification level, uses the values from |vim.log.levels|
|
||||
|
||||
- `error`: hard errors e.g. failure to read from the file system.
|
||||
|
@ -907,11 +924,10 @@ in {
|
|||
- `info:` information only e.g. file copy path confirmation.
|
||||
- `debug:` not used.
|
||||
'';
|
||||
};
|
||||
|
||||
# General UI configuration
|
||||
ui = {
|
||||
# Confirmation prompts
|
||||
confirm = {
|
||||
ui = helpers.mkCompositeOption "General UI configuration." {
|
||||
confirm = helpers.mkCompositeOption "Confirmation prompts." {
|
||||
remove = helpers.defaultNullOpts.mkBool true ''
|
||||
Prompt before removing.
|
||||
'';
|
||||
|
@ -922,8 +938,7 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
# Configuration for diagnostic logging
|
||||
log = {
|
||||
log = helpers.mkCompositeOption "Configuration for diagnostic logging." {
|
||||
enable = helpers.defaultNullOpts.mkBool false ''
|
||||
Enable logging to a file `$XDG_CACHE_HOME/nvim/nvim-tree.log`
|
||||
'';
|
||||
|
@ -932,8 +947,7 @@ in {
|
|||
Remove existing log file at startup.
|
||||
'';
|
||||
|
||||
# Specify which information to log
|
||||
types = {
|
||||
types = helpers.mkCompositeOption "Specify which information to log." {
|
||||
all = helpers.defaultNullOpts.mkBool false "Everything.";
|
||||
|
||||
profile = helpers.defaultNullOpts.mkBool false "Timing of some operations.";
|
||||
|
@ -971,46 +985,50 @@ in {
|
|||
sync_root_with_cwd = syncRootWithCwd;
|
||||
reload_on_bufenter = reloadOnBufenter;
|
||||
respect_buf_cwd = respectBufCwd;
|
||||
hijack_directories = with hijackDirectories; {
|
||||
hijack_directories = with hijackDirectories;
|
||||
ifNonNull' cfg.hijackDirectories {
|
||||
inherit enable;
|
||||
auto_open = autoOpen;
|
||||
auto_open = autoOpenEnabled;
|
||||
};
|
||||
update_focused_file = with updateFocusedFile; {
|
||||
update_focused_file = with updateFocusedFile;
|
||||
ifNonNull' cfg.updateFocusedFile {
|
||||
inherit enable;
|
||||
update_root = updateRoot;
|
||||
ignore_list = ignoreList;
|
||||
};
|
||||
system_open = {
|
||||
inherit (systemOpen) cmd args;
|
||||
};
|
||||
diagnostics = with diagnostics; {
|
||||
system_open = helpers.ifNonNull systemOpen;
|
||||
diagnostics = with diagnostics;
|
||||
ifNonNull' cfg.diagnostics {
|
||||
inherit enable;
|
||||
debounce_delay = debounceDelay;
|
||||
show_on_dirs = showOnDirs;
|
||||
show_on_open_dirs = showOnOpenDirs;
|
||||
inherit icons;
|
||||
severity =
|
||||
severity = ifNonNull' cfg.diagnostics.severity (
|
||||
mapAttrs (
|
||||
name: value:
|
||||
if value == null
|
||||
then null
|
||||
else helpers.mkRaw "vim.diagnostic.severity.${strings.toUpper value}"
|
||||
ifNonNull' value
|
||||
(helpers.mkRaw "vim.diagnostic.severity.${strings.toUpper value}")
|
||||
)
|
||||
severity;
|
||||
severity
|
||||
);
|
||||
};
|
||||
git = with git; {
|
||||
git = with git;
|
||||
ifNonNull' cfg.git {
|
||||
inherit enable;
|
||||
inherit ignore;
|
||||
show_on_dirs = showOnDirs;
|
||||
show_on_open_dirs = showOnOpenDirs;
|
||||
inherit timeout;
|
||||
};
|
||||
modified = with modified; {
|
||||
modified = with modified;
|
||||
ifNonNull' cfg.modified {
|
||||
inherit enable;
|
||||
show_on_dirs = showOnDirs;
|
||||
show_on_open_dirs = showOnOpenDirs;
|
||||
};
|
||||
filesystem_watchers = with filesystemWatchers; {
|
||||
filesystem_watchers = with filesystemWatchers;
|
||||
ifNonNull' cfg.filesystemWatchers {
|
||||
inherit enable;
|
||||
debounce_delay = debounceDelay;
|
||||
ignore_dirs = ignoreDirs;
|
||||
|
@ -1018,7 +1036,8 @@ in {
|
|||
on_attach = onAttach;
|
||||
remove_keymaps = removeKeymaps;
|
||||
select_prompts = selectPrompts;
|
||||
view = with view; {
|
||||
view = with view;
|
||||
ifNonNull' cfg.view {
|
||||
centralize_selection = centralizeSelection;
|
||||
inherit cursorline;
|
||||
debounce_delay = debounceDelay;
|
||||
|
@ -1029,7 +1048,8 @@ in {
|
|||
inherit number;
|
||||
inherit relativenumber;
|
||||
inherit signcolumn;
|
||||
mappings = with mappings; {
|
||||
mappings = with mappings;
|
||||
ifNonNull' cfg.view.mappings {
|
||||
custom_only = customOnly;
|
||||
list =
|
||||
if list == null
|
||||
|
@ -1046,13 +1066,15 @@ in {
|
|||
)
|
||||
list;
|
||||
};
|
||||
float = with float; {
|
||||
float = with float;
|
||||
ifNonNull' cfg.view.float {
|
||||
inherit enable;
|
||||
quit_on_focus_loss = quitOnFocusLoss;
|
||||
open_win_config = openWinConfig;
|
||||
};
|
||||
};
|
||||
renderer = with renderer; {
|
||||
renderer = with renderer;
|
||||
ifNonNull' cfg.renderer {
|
||||
add_trailing = addTrailing;
|
||||
group_empty = groupEmpty;
|
||||
full_name = fullName;
|
||||
|
@ -1061,21 +1083,25 @@ in {
|
|||
highlight_modified = highlightModified;
|
||||
root_folder_label = rootFolderLabel;
|
||||
indent_width = indentWidth;
|
||||
indent_markers = with indentMarkers; {
|
||||
indent_markers = with indentMarkers;
|
||||
ifNonNull' cfg.renderer.indentMarkers {
|
||||
inherit enable icons;
|
||||
inline_arrows = inlineArrows;
|
||||
};
|
||||
icons = with icons; {
|
||||
icons = with icons;
|
||||
ifNonNull' cfg.renderer.icons {
|
||||
webdev_colors = webdevColors;
|
||||
git_placement = gitPlacement;
|
||||
modified_placement = modifiedPlacement;
|
||||
inherit padding;
|
||||
symlink_arrow = symlinkArrow;
|
||||
show = with show; {
|
||||
show = with show;
|
||||
ifNonNull' cfg.renderer.icons.show {
|
||||
inherit file folder git modified;
|
||||
folder_arrow = folderArrow;
|
||||
};
|
||||
glyphs = with glyphs; {
|
||||
glyphs = with glyphs;
|
||||
ifNonNull' cfg.renderer.icons.glyphs {
|
||||
inherit default symlink modified git;
|
||||
folder = with folder; {
|
||||
arrow_closed = arrowClosed;
|
||||
|
@ -1089,51 +1115,70 @@ in {
|
|||
special_files = specialFiles;
|
||||
symlink_destination = symlinkDestination;
|
||||
};
|
||||
filters = with filters; {
|
||||
filters = with filters;
|
||||
ifNonNull' cfg.filters {
|
||||
inherit dotfiles custom exclude;
|
||||
git_clean = gitClean;
|
||||
no_buffer = noBuffer;
|
||||
};
|
||||
trash.cmd = trash.cmd;
|
||||
actions = with actions; {
|
||||
change_dir = with changeDir; {
|
||||
inherit trash;
|
||||
actions = with actions;
|
||||
ifNonNull' cfg.actions {
|
||||
change_dir = with changeDir;
|
||||
ifNonNull' cfg.actions.changeDir {
|
||||
inherit enable global;
|
||||
restrict_above_cwd = restrictAboveCwd;
|
||||
};
|
||||
expand_all = with expandAll; {
|
||||
expand_all = with expandAll;
|
||||
ifNonNull' cfg.actions.expandAll {
|
||||
max_folder_discovery = maxFolderDiscovery;
|
||||
inherit exclude;
|
||||
};
|
||||
file_popup.open_win_config = filePopup.openWinConfig;
|
||||
open_file = with openFile; {
|
||||
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.close_window = removeFile.closeWindow;
|
||||
remove_file = with removeFile;
|
||||
ifNonNull' cfg.actions.removeFile {
|
||||
close_window = removeFile.closeWindow;
|
||||
};
|
||||
use_system_clipboard = useSystemClipboard;
|
||||
};
|
||||
live_filter = with liveFilter; {
|
||||
live_filter = with liveFilter;
|
||||
ifNonNull' cfg.liveFilter {
|
||||
inherit prefix;
|
||||
always_show_folders = alwaysShowFolders;
|
||||
};
|
||||
inherit tab;
|
||||
notify.threshold =
|
||||
if notify.threshold == null
|
||||
then null
|
||||
else helpers.mkRaw "vim.log.levels.${strings.toUpper notify.threshold}";
|
||||
notify = with notify;
|
||||
ifNonNull' cfg.notify {
|
||||
threshold =
|
||||
ifNonNull' cfg.notify.threshold
|
||||
(helpers.mkRaw "vim.log.levels.${strings.toUpper notify.threshold}");
|
||||
};
|
||||
inherit ui;
|
||||
log = with log; {
|
||||
log = with log;
|
||||
ifNonNull' cfg.log {
|
||||
inherit enable truncate;
|
||||
types = with log.types; {
|
||||
types = ifNonNull' log.types (
|
||||
with log.types; {
|
||||
inherit all profile dev diagnostics git watcher;
|
||||
inherit (log.types) config;
|
||||
copy_paste = copyPaste;
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
|
||||
autoOpenEnabled = cfg.openOnSetup or cfg.openOnSetupFile;
|
||||
|
||||
openNvimTreeFunction = ''
|
||||
local function open_nvim_tree(data)
|
||||
|
||||
|
@ -1202,7 +1247,7 @@ in {
|
|||
|
||||
autoCmd =
|
||||
[]
|
||||
++ (optional (cfg.openOnSetup or cfg.openOnSetupFile) {
|
||||
++ (optional autoOpenEnabled {
|
||||
event = "VimEnter";
|
||||
callback = helpers.mkRaw "open_nvim_tree";
|
||||
})
|
||||
|
@ -1212,8 +1257,9 @@ in {
|
|||
nested = true;
|
||||
});
|
||||
|
||||
extraConfigLua = ''
|
||||
${openNvimTreeFunction}
|
||||
extraConfigLua =
|
||||
(optionalString autoOpenEnabled openNvimTreeFunction)
|
||||
+ ''
|
||||
|
||||
require('nvim-tree').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
|
|
275
tests/plugins/nvim-tree.nix
Normal file
275
tests/plugins/nvim-tree.nix
Normal file
|
@ -0,0 +1,275 @@
|
|||
{
|
||||
# Empty configuration
|
||||
empty = {
|
||||
plugins.nvim-tree.enable = true;
|
||||
};
|
||||
|
||||
# All the upstream default options of nvim-tree
|
||||
defaults = {
|
||||
plugins.nvim-tree = {
|
||||
enable = true;
|
||||
|
||||
disableNetrw = true;
|
||||
hijackNetrw = false;
|
||||
|
||||
openOnSetup = true;
|
||||
openOnSetupFile = true;
|
||||
ignoreBufferOnSetup = true;
|
||||
ignoreFtOnSetup = ["tex"];
|
||||
autoClose = true;
|
||||
|
||||
autoReloadOnWrite = true;
|
||||
sortBy = "name";
|
||||
hijackUnnamedBufferWhenOpening = false;
|
||||
hijackCursor = false;
|
||||
rootDirs = [];
|
||||
preferStartupRoot = false;
|
||||
syncRootWithCwd = false;
|
||||
reloadOnBufenter = false;
|
||||
respectBufCwd = false;
|
||||
hijackDirectories = {
|
||||
enable = true;
|
||||
autoOpen = true;
|
||||
};
|
||||
updateFocusedFile = {
|
||||
enable = false;
|
||||
updateRoot = false;
|
||||
ignoreList = [];
|
||||
};
|
||||
systemOpen = {
|
||||
cmd = "";
|
||||
args = [];
|
||||
};
|
||||
diagnostics = {
|
||||
enable = false;
|
||||
debounceDelay = 50;
|
||||
showOnDirs = false;
|
||||
showOnOpenDirs = true;
|
||||
icons = {
|
||||
hint = "";
|
||||
info = "";
|
||||
warning = "";
|
||||
error = "";
|
||||
};
|
||||
severity = {
|
||||
min = "hint";
|
||||
max = "error";
|
||||
};
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
ignore = true;
|
||||
showOnDirs = true;
|
||||
showOnOpenDirs = true;
|
||||
timeout = 400;
|
||||
};
|
||||
modified = {
|
||||
enable = false;
|
||||
showOnDirs = true;
|
||||
showOnOpenDirs = true;
|
||||
};
|
||||
filesystemWatchers = {
|
||||
enable = true;
|
||||
debounceDelay = 50;
|
||||
ignoreDirs = [];
|
||||
};
|
||||
onAttach = "default";
|
||||
removeKeymaps = false;
|
||||
selectPrompts = false;
|
||||
view = {
|
||||
centralizeSelection = false;
|
||||
cursorline = true;
|
||||
debounceDelay = 15;
|
||||
hideRootFolder = false;
|
||||
width = {
|
||||
min = 30;
|
||||
max = -1;
|
||||
padding = 1;
|
||||
};
|
||||
side = "left";
|
||||
preserveWindowProportions = false;
|
||||
number = false;
|
||||
relativenumber = false;
|
||||
signcolumn = "yes";
|
||||
mappings = {
|
||||
customOnly = false;
|
||||
list = [
|
||||
# remove a default mapping for cd
|
||||
{
|
||||
key = "<2-RightMouse>";
|
||||
action = "";
|
||||
}
|
||||
|
||||
# add multiple normal mode mappings for edit
|
||||
{
|
||||
key = ["<CR>" "o"];
|
||||
action = "edit";
|
||||
mode = "n";
|
||||
}
|
||||
|
||||
# custom action
|
||||
{
|
||||
key = "p";
|
||||
action = "print_the_node_path";
|
||||
action_cb = ''
|
||||
function(node)
|
||||
print(node.absolute_path)
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
float = {
|
||||
enable = false;
|
||||
quitOnFocusLoss = true;
|
||||
openWinConfig = {
|
||||
col = 1;
|
||||
row = 1;
|
||||
relative = "cursor";
|
||||
border = "shadow";
|
||||
style = "minimal";
|
||||
};
|
||||
};
|
||||
};
|
||||
renderer = {
|
||||
addTrailing = false;
|
||||
groupEmpty = false;
|
||||
fullName = false;
|
||||
highlightGit = false;
|
||||
highlightOpenedFiles = "none";
|
||||
highlightModified = "none";
|
||||
rootFolderLabel = ":~:s?$?/..?";
|
||||
indentWidth = 2;
|
||||
indentMarkers = {
|
||||
enable = false;
|
||||
inlineArrows = true;
|
||||
icons = {
|
||||
corner = "└";
|
||||
edge = "│";
|
||||
item = "│";
|
||||
bottom = "─";
|
||||
none = " ";
|
||||
};
|
||||
};
|
||||
icons = {
|
||||
webdevColors = true;
|
||||
gitPlacement = "before";
|
||||
modifiedPlacement = "after";
|
||||
padding = " ";
|
||||
symlinkArrow = " ➛ ";
|
||||
show = {
|
||||
file = true;
|
||||
folder = true;
|
||||
folderArrow = true;
|
||||
git = true;
|
||||
modified = true;
|
||||
};
|
||||
glyphs = {
|
||||
default = "";
|
||||
symlink = "";
|
||||
modified = "●";
|
||||
folder = {
|
||||
arrowClosed = "";
|
||||
arrowOpen = "";
|
||||
default = "";
|
||||
open = "";
|
||||
empty = "";
|
||||
emptyOpen = "";
|
||||
symlink = "";
|
||||
symlinkOpen = "";
|
||||
};
|
||||
git = {
|
||||
unstaged = "✗";
|
||||
staged = "✓";
|
||||
unmerged = "";
|
||||
renamed = "➜";
|
||||
untracked = "★";
|
||||
deleted = "";
|
||||
ignored = "◌";
|
||||
};
|
||||
};
|
||||
};
|
||||
specialFiles = ["Cargo.toml" "Makefile" "README.md" "readme.md"];
|
||||
symlinkDestination = true;
|
||||
};
|
||||
filters = {
|
||||
dotfiles = false;
|
||||
gitClean = false;
|
||||
noBuffer = false;
|
||||
custom = [];
|
||||
exclude = [];
|
||||
};
|
||||
actions = {
|
||||
changeDir = {
|
||||
enable = true;
|
||||
global = false;
|
||||
restrictAboveCwd = false;
|
||||
};
|
||||
expandAll = {
|
||||
maxFolderDiscovery = 300;
|
||||
exclude = [];
|
||||
};
|
||||
filePopup = {
|
||||
openWinConfig = {
|
||||
col = 1;
|
||||
row = 1;
|
||||
relative = "cursor";
|
||||
border = "shadow";
|
||||
style = "minimal";
|
||||
};
|
||||
};
|
||||
openFile = {
|
||||
quitOnOpen = false;
|
||||
resizeWindow = true;
|
||||
};
|
||||
windowPicker = {
|
||||
enable = true;
|
||||
picker = "default";
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
exclude = {
|
||||
filetype = ["notify" "packer" "qf" "diff" "fugitive" "fugitiveblame"];
|
||||
buftype = ["nofile" "terminal" "help"];
|
||||
};
|
||||
};
|
||||
removeFile = {
|
||||
closeWindow = true;
|
||||
};
|
||||
useSystemClipboard = true;
|
||||
};
|
||||
liveFilter = {
|
||||
prefix = "[FILTER]: ";
|
||||
alwaysShowFolders = true;
|
||||
};
|
||||
tab = {
|
||||
sync = {
|
||||
open = false;
|
||||
close = false;
|
||||
ignore = [];
|
||||
};
|
||||
};
|
||||
notify = {
|
||||
threshold = "info";
|
||||
};
|
||||
ui = {
|
||||
confirm = {
|
||||
remove = true;
|
||||
trash = true;
|
||||
};
|
||||
};
|
||||
log = {
|
||||
enable = false;
|
||||
truncate = false;
|
||||
types = {
|
||||
all = false;
|
||||
profile = false;
|
||||
config = false;
|
||||
copyPaste = false;
|
||||
dev = false;
|
||||
diagnostics = false;
|
||||
git = false;
|
||||
watcher = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue