mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
dev: rewrite view section of nvimtree config
This commit is contained in:
parent
bb6b138027
commit
83a8308ed5
2 changed files with 131 additions and 120 deletions
|
@ -70,95 +70,101 @@ in {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
require'nvim-tree'.setup({
|
require'nvim-tree'.setup({
|
||||||
disable_netrw = ${boolToString cfg.disableNetrw},
|
disable_netrw = ${boolToString cfg.disableNetrw},
|
||||||
hijack_netrw = ${boolToString cfg.hijackNetrw},
|
hijack_netrw = ${boolToString cfg.hijackNetrw},
|
||||||
auto_reload_on_write = ${boolToString cfg.autoreloadOnWrite},
|
auto_reload_on_write = ${boolToString cfg.autoreloadOnWrite},
|
||||||
|
|
||||||
sort = {
|
sort = {
|
||||||
sorter = "${cfg.sort.sorter}",
|
sorter = "${cfg.sort.sorter}",
|
||||||
folders_first = ${boolToString cfg.sort.foldersFirst},
|
folders_first = ${boolToString cfg.sort.foldersFirst},
|
||||||
},
|
},
|
||||||
|
|
||||||
hijack_unnamed_buffer_when_opening = ${boolToString cfg.hijackUnnamedBufferWhenOpening},
|
hijack_unnamed_buffer_when_opening = ${boolToString cfg.hijackUnnamedBufferWhenOpening},
|
||||||
hijack_cursor = ${boolToString cfg.hijackCursor},
|
hijack_cursor = ${boolToString cfg.hijackCursor},
|
||||||
root_dirs = ${nvim.lua.listToLuaTable cfg.rootDirs},
|
root_dirs = ${nvim.lua.listToLuaTable cfg.rootDirs},
|
||||||
prefer_startup_root = ${boolToString cfg.preferStartupRoot},
|
prefer_startup_root = ${boolToString cfg.preferStartupRoot},
|
||||||
sync_root_with_cwd = ${boolToString cfg.syncRootWithCwd},
|
sync_root_with_cwd = ${boolToString cfg.syncRootWithCwd},
|
||||||
reload_on_bufenter = ${boolToString cfg.reloadOnBufEnter},
|
reload_on_bufenter = ${boolToString cfg.reloadOnBufEnter},
|
||||||
respect_buf_cwd = ${boolToString cfg.respectBufCwd},
|
respect_buf_cwd = ${boolToString cfg.respectBufCwd},
|
||||||
|
|
||||||
hijack_directories = {
|
hijack_directories = {
|
||||||
enable = ${boolToString cfg.hijackDirectories.enable},
|
enable = ${boolToString cfg.hijackDirectories.enable},
|
||||||
auto_open = ${boolToString cfg.hijackDirectories.autoOpen},
|
auto_open = ${boolToString cfg.hijackDirectories.autoOpen},
|
||||||
|
},
|
||||||
|
|
||||||
|
update_focused_file = {
|
||||||
|
enable = ${boolToString cfg.updateFocusedFile.enable},
|
||||||
|
update_root = ${boolToString cfg.updateFocusedFile.updateRoot},
|
||||||
|
ignore_list = ${nvim.lua.listToLuaTable cfg.updateFocusedFile.ignoreList},
|
||||||
|
},
|
||||||
|
|
||||||
|
system_open = {
|
||||||
|
cmd = "${cfg.systemOpen.cmd}",
|
||||||
|
args = ${nvim.lua.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}",
|
||||||
},
|
},
|
||||||
|
|
||||||
update_focused_file = {
|
severity = {
|
||||||
enable = ${boolToString cfg.updateFocusedFile.enable},
|
min = "vim.diagnostic.severity.${cfg.diagnostics.severity.min}",
|
||||||
update_root = ${boolToString cfg.updateFocusedFile.updateRoot},
|
max = "vim.diagnostic.severity.${cfg.diagnostics.severity.max}",
|
||||||
ignore_list = ${nvim.lua.listToLuaTable cfg.updateFocusedFile.ignoreList},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
system_open = {
|
git = {
|
||||||
cmd = "${cfg.systemOpen.cmd}",
|
enable = ${boolToString cfg.git.enable},
|
||||||
args = ${nvim.lua.listToLuaTable cfg.systemOpen.args},
|
show_on_dirs = ${boolToString cfg.git.showOnDirs},
|
||||||
},
|
show_on_open_dirs = ${boolToString cfg.git.showOnOpenDirs},
|
||||||
|
disable_for_dirs = ${nvim.lua.listToLuaTable cfg.git.disableForDirs},
|
||||||
|
timeout = ${toString cfg.git.timeOut},
|
||||||
|
},
|
||||||
|
|
||||||
diagnostics = {
|
modified = {
|
||||||
enable = ${boolToString cfg.diagnostics.enable},
|
enable = ${boolToString cfg.modified.enable},
|
||||||
icons = {
|
show_on_dirs = ${boolToString cfg.modified.showOnDirs},
|
||||||
hint = "${cfg.diagnostics.icons.hint}",
|
show_on_open_dirs = ${boolToString cfg.modified.showOnOpenDirs},
|
||||||
info = "${cfg.diagnostics.icons.info}",
|
},
|
||||||
warning = "${cfg.diagnostics.icons.warning}",
|
|
||||||
error = "${cfg.diagnostics.icons.error}",
|
|
||||||
},
|
|
||||||
|
|
||||||
severity = {
|
filesystem_watchers = {
|
||||||
min = "vim.diagnostic.severity.${cfg.diagnostics.severity.min}",
|
enable = ${boolToString cfg.filesystemWatchers.enable},
|
||||||
max = "vim.diagnostic.severity.${cfg.diagnostics.severity.max}",
|
debounce_delay = ${toString cfg.filesystemWatchers.debounceDelay},
|
||||||
|
ignore_dirs = ${nvim.lua.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 = ${nvim.lua.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},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
git = {
|
|
||||||
enable = ${boolToString cfg.git.enable},
|
|
||||||
show_on_dirs = ${boolToString cfg.git.showOnDirs},
|
|
||||||
show_on_open_dirs = ${boolToString cfg.git.showOnOpenDirs},
|
|
||||||
disable_for_dirs = ${nvim.lua.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 = ${nvim.lua.listToLuaTable cfg.filesystemWatchers.ignoreDirs},
|
|
||||||
},
|
|
||||||
|
|
||||||
select_prompts = ${boolToString cfg.selectPrompts},
|
|
||||||
|
|
||||||
view = {
|
|
||||||
width = ${nvim.lua.expToLua cfg.view.width},
|
|
||||||
centralize_selection = ${boolToString cfg.view.centralizeSelection},
|
|
||||||
cursorline = ${boolToString cfg.view.cursorline},
|
|
||||||
debounce_delay = ${toString cfg.view.debounceDelay},
|
|
||||||
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 = ${nvim.lua.expToLua cfg.view.float.openWinConfig},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
renderer = {
|
renderer = {
|
||||||
add_trailing = ${boolToString cfg.renderer.addTrailing},
|
add_trailing = ${boolToString cfg.renderer.addTrailing},
|
||||||
group_empty = ${boolToString cfg.renderer.groupEmpty},
|
group_empty = ${boolToString cfg.renderer.groupEmpty},
|
||||||
|
@ -173,6 +179,9 @@ in {
|
||||||
inline_arrows = ${boolToString cfg.renderer.indentMarkers.inlineArrows},
|
inline_arrows = ${boolToString cfg.renderer.indentMarkers.inlineArrows},
|
||||||
icons = ${nvim.lua.expToLua cfg.renderer.indentMarkers.icons},
|
icons = ${nvim.lua.expToLua cfg.renderer.indentMarkers.icons},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
special_files = ${nvim.lua.listToLuaTable cfg.renderer.specialFiles},
|
||||||
|
symlink_destination = ${boolToString cfg.renderer.symlinkDestination},
|
||||||
|
|
||||||
icons = {
|
icons = {
|
||||||
webdev_colors = ${boolToString cfg.renderer.icons.webdevColors},
|
webdev_colors = ${boolToString cfg.renderer.icons.webdevColors},
|
||||||
|
@ -216,9 +225,8 @@ in {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
special_files = ${nvim.lua.listToLuaTable cfg.renderer.specialFiles},
|
|
||||||
symlink_destination = ${boolToString cfg.renderer.symlinkDestination},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
git_ignored = ${boolToString cfg.filters.gitIgnored},
|
git_ignored = ${boolToString cfg.filters.gitIgnored},
|
||||||
dotfiles = ${boolToString cfg.filters.dotfiles},
|
dotfiles = ${boolToString cfg.filters.dotfiles},
|
||||||
|
@ -226,9 +234,11 @@ in {
|
||||||
no_buffer = ${boolToString cfg.filters.noBuffer},
|
no_buffer = ${boolToString cfg.filters.noBuffer},
|
||||||
exclude = ${nvim.lua.listToLuaTable cfg.filters.exclude},
|
exclude = ${nvim.lua.listToLuaTable cfg.filters.exclude},
|
||||||
},
|
},
|
||||||
|
|
||||||
trash = {
|
trash = {
|
||||||
cmd = "${cfg.trash.cmd}",
|
cmd = "${cfg.trash.cmd}",
|
||||||
},
|
},
|
||||||
|
|
||||||
actions = {
|
actions = {
|
||||||
use_system_clipboard = ${boolToString cfg.actions.useSystemClipboard},
|
use_system_clipboard = ${boolToString cfg.actions.useSystemClipboard},
|
||||||
change_dir = {
|
change_dir = {
|
||||||
|
|
|
@ -369,30 +369,38 @@ with builtins; {
|
||||||
|
|
||||||
view = mkOption {
|
view = mkOption {
|
||||||
description = "Window / buffer setup.";
|
description = "Window / buffer setup.";
|
||||||
|
|
||||||
default = {
|
default = {
|
||||||
centralizeSelection = false;
|
centralizeSelection = false;
|
||||||
cursorline = false;
|
cursorline = true;
|
||||||
debounceDelay = 100;
|
debounceDelay = 15;
|
||||||
|
width = 30;
|
||||||
side = "left";
|
side = "left";
|
||||||
preserveWindowProportions = false;
|
preserveWindowProportions = false;
|
||||||
number = false;
|
number = false;
|
||||||
relativeNumber = false;
|
relativenumber = false;
|
||||||
signcolumn = "yes";
|
signcolumn = "yes";
|
||||||
|
float = {
|
||||||
|
enable = false;
|
||||||
|
quitOnFocusLoss = true;
|
||||||
|
openWinConfig = {
|
||||||
|
relative = "editor";
|
||||||
|
border = "rounded";
|
||||||
|
width = 30;
|
||||||
|
height = 30;
|
||||||
|
row = 1;
|
||||||
|
col = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
centralizeSelection = mkOption {
|
centralizeSelection = mkOption {
|
||||||
|
description = "If true, reposition the view so that the current node is initially centralized when entering nvim-tree.";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = ''
|
|
||||||
When entering nvim-tree, reposition the view so that the current node is
|
|
||||||
initially centralized
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
cursorline = mkOption {
|
cursorline = mkOption {
|
||||||
description = "Whether to display the cursor line in NvimTree";
|
description = "Enable cursorline in nvim-tree window.";
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -408,76 +416,69 @@ with builtins; {
|
||||||
description = ''
|
description = ''
|
||||||
Width of the window: can be a `%` string, a number representing columns, a
|
Width of the window: can be a `%` string, a number representing columns, a
|
||||||
function or a table.
|
function or a table.
|
||||||
A table indicates that the view should be dynamically sized based on the
|
|
||||||
longest line (previously `view.adaptive_size`).
|
A table (an attribute set in our case, see example) indicates that the view should be dynamically sized based on the
|
||||||
|
longest line.
|
||||||
'';
|
'';
|
||||||
type = with types; oneOf [int attrs];
|
type = with types; oneOf [int attrs];
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
min = 30;
|
||||||
|
max = -1;
|
||||||
|
padding = 1;
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
side = mkOption {
|
side = mkOption {
|
||||||
|
description = "Side of the tree.";
|
||||||
type = types.enum ["left" "right"];
|
type = types.enum ["left" "right"];
|
||||||
default = "left";
|
|
||||||
description = "Side the tree will appear on left or right";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
preserveWindowProportions = mkOption {
|
preserveWindowProportions = mkOption {
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
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.
|
||||||
'';
|
'';
|
||||||
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
number = mkOption {
|
number = mkOption {
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
description = "Print the line number in front of each line.";
|
description = "Print the line number in front of each line.";
|
||||||
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
relativeNumber = mkOption {
|
relativenumber = mkOption {
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
description = ''
|
description = ''
|
||||||
Show the line number relative to the line with the cursor in front of each line.
|
Show the line number relative to the line with the cursor in front of each line.
|
||||||
If the option `view.number` is also `true`, the number on the cursor line
|
If the option `view.number` is also `true`, the number on the cursor line
|
||||||
will be the line number instead of `0`.
|
will be the line number instead of `0`.
|
||||||
'';
|
'';
|
||||||
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
signcolumn = mkOption {
|
signcolumn = mkOption {
|
||||||
|
description = " Show diagnostic sign column. Value can be `" yes "`, `" auto "`, `" no "`.";
|
||||||
type = types.enum ["yes" "auto" "no"];
|
type = types.enum ["yes" "auto" "no"];
|
||||||
default = "yes";
|
|
||||||
description = "Show diagnostic sign column.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
float = mkOption {
|
float = mkOption {
|
||||||
description = "Configuration options for floating window";
|
description = "Configuration options for floating window.";
|
||||||
|
|
||||||
default = {
|
|
||||||
quitOnFocusLoss = true;
|
|
||||||
openWinConfig = {
|
|
||||||
relative = "editor";
|
|
||||||
border = "single";
|
|
||||||
width = 30;
|
|
||||||
height = 30;
|
|
||||||
row = 1;
|
|
||||||
col = 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "Tree window will be floating.";
|
enable = mkOption {
|
||||||
|
description = "If true, tree window will be floating.";
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
|
||||||
quitOnFocusLoss = mkOption {
|
quitOnFocusLoss = mkOption {
|
||||||
type = types.bool;
|
|
||||||
description = "Close the floating tree window when it loses focus.";
|
description = "Close the floating tree window when it loses focus.";
|
||||||
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
openWinConfig = mkOption {
|
openWinConfig = mkOption {
|
||||||
type = with types; oneOf [str attrs];
|
description = "Floating window config. See `:h nvim_open_win()` for more details.";
|
||||||
description = "Floating window configuration.";
|
type = types.attrs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue