feat: update nvimtree view

This commit is contained in:
NotAShelf 2023-03-01 16:19:50 +03:00
parent 0a7d4e49ae
commit fcf1318c8b
No known key found for this signature in database
GPG Key ID: 5B5C8895F28445F1
2 changed files with 25 additions and 29 deletions

View File

@ -11,14 +11,19 @@ in {
config = mkIf cfg.enable {
vim.startPlugins = ["nvim-tree-lua"];
vim.nnoremap = {
"<C-n>" = ":NvimTreeToggle<CR>";
"<leader>tr" = ":NvimTreeRefresh<CR>";
"<leader>tg" = ":NvimTreeFindFile<CR>";
"<leader>tf" = ":NvimTreeFocus<CR>";
};
# vim.nnoremap = {
# "<C-n>" = ":NvimTreeToggle<CR>";
# "<leader>tr" = ":NvimTreeRefresh<CR>";
# "<leader>tg" = ":NvimTreeFindFile<CR>";
# "<leader>tf" = ":NvimTreeFocus<CR>";
# };
vim.luaConfigRC.nvimtreelua = nvim.dag.entryAnywhere ''
vim.api.nvim_set_keymap("n", "<C-n>", ":NvimTreeToggle<cr>" ,{silent = true, noremap = true, nowait = true})
vim.api.nvim_set_keymap("n", "<leader>tr", ":NvimTreeRefresh<cr>" ,{silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "<leader>tg", ":NvimTreeFindFile<cr>" ,{silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "<leader>tf", ":NvimTreeFocus<cr>" ,{silent = true, noremap = true})
local function open_nvim_tree(data)
local IGNORED_FT = {
"markdown",
@ -46,7 +51,6 @@ in {
-- open the tree but don't focus it
require("nvim-tree.api").tree.toggle({ focus = false })
end
-- Open on startup has been deprecated
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup
-- use a nix eval to dynamically insert the open on startup function
@ -87,6 +91,9 @@ in {
},
actions = {
change_dir = {
global = ${boolToString cfg.actions.changeDir.global},
},
open_file = {
quit_on_open = ${boolToString cfg.actions.openFile.quitOnOpen},
resize_window = ${boolToString cfg.actions.openFile.resizeWindow},

View File

@ -21,30 +21,12 @@ in {
type = types.enum ["name" "extension" "modification_time" "case_sensitive"];
};
treeSide = mkOption {
default = "left";
description = "Side the tree will appear on left or right";
type = types.enum ["left" "right"];
};
treeWidth = mkOption {
default = 25;
description = "Width of the tree in charecters";
type = types.int;
};
hideFiles = mkOption {
default = [".git" "node_modules" ".cache"];
default = ["node_modules" ".cache"];
description = "Files to hide in the file view by default.";
type = with types; listOf str;
};
hideIgnoredGitFiles = mkOption {
default = false;
description = "Hide files ignored by git";
type = types.bool;
};
openOnSetup = mkOption {
default = true;
description = "Open when vim is started on a directory";
@ -82,7 +64,7 @@ in {
};
openTreeOnNewTab = mkOption {
default = false;
default = true;
description = "Opens the tree view when opening a new tab";
type = types.bool;
};
@ -182,7 +164,7 @@ in {
};
hideRootFolder = mkOption {
default = false;
default = true;
description = "Hide the root folder";
type = types.bool;
};
@ -191,7 +173,7 @@ in {
git = {
enable = mkEnableOption "Git integration";
ignore = mkOption {
default = true;
default = false;
description = "Ignore files in git";
type = types.bool;
};
@ -206,6 +188,13 @@ in {
};
actions = {
changeDir = {
global = mkOption {
default = true;
description = "Change directory when changing nvim's directory (DirChanged event).";
type = types.bool;
};
};
openFile = {
resizeWindow = mkOption {
default = true;