mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-15 18:05:32 +00:00
Merge branch 'NotAShelf:v0.7' into v0.7
This commit is contained in:
commit
234ad31909
101 changed files with 1973 additions and 2115 deletions
|
|
@ -4,6 +4,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.filetree.neo-tree;
|
||||
in {
|
||||
|
|
@ -25,6 +26,26 @@ in {
|
|||
};
|
||||
|
||||
visuals.nvim-web-devicons.enable = true;
|
||||
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||
pluginRC.neo-tree =
|
||||
mkIf (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled" && config.vim.lazy.enable)
|
||||
(entryAnywhere ''
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
||||
desc = "Loads neo-tree when opening a directory",
|
||||
callback = function(args)
|
||||
local stats = vim.uv.fs_stat(args.file)
|
||||
|
||||
if not stats or stats.type ~= "directory" then
|
||||
return
|
||||
end
|
||||
|
||||
require("lz.n").trigger_load("neo-tree-nvim")
|
||||
|
||||
return true
|
||||
end,
|
||||
})
|
||||
'');
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.types) bool str int submodule enum either listOf;
|
||||
inherit (lib.types) bool str enum either listOf;
|
||||
inherit (lib.options) mkOption mkEnableOption literalExpression;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
|
|
@ -150,6 +150,14 @@ in {
|
|||
A list of filetypes that should not be replaced when opening a file
|
||||
'';
|
||||
};
|
||||
|
||||
filesystem = {
|
||||
hijack_netrw_behavior = mkOption {
|
||||
type = enum ["disabled" "open_default" "open_current"];
|
||||
default = "open_default";
|
||||
description = "Hijack Netrw behavior";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
}: let
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.binds) mkLznBinding;
|
||||
inherit (lib.nvim.binds) mkKeymap;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.binds) pushDownDefault;
|
||||
|
||||
|
|
@ -24,16 +24,17 @@ in {
|
|||
package = "nvim-tree-lua";
|
||||
setupModule = "nvim-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||
keys = [
|
||||
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkLznBinding ["n"] cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
(mkKeymap "n" cfg.mappings.toggle ":NvimTreeToggle<cr>" {desc = mappings.toggle.description;})
|
||||
(mkKeymap "n" cfg.mappings.refresh ":NvimTreeRefresh<cr>" {desc = mappings.refresh.description;})
|
||||
(mkKeymap "n" cfg.mappings.findFile ":NvimTreeFindFile<cr>" {desc = mappings.findFile.description;})
|
||||
(mkKeymap "n" cfg.mappings.focus ":NvimTreeFocus<cr>" {desc = mappings.focus.description;})
|
||||
];
|
||||
};
|
||||
|
||||
pluginRC.nvimtreelua = entryAnywhere ''
|
||||
pluginRC.nvim-tree = entryAnywhere ''
|
||||
${
|
||||
optionalString cfg.setupOpts.disable_netrw ''
|
||||
-- disable netrew completely
|
||||
|
|
@ -42,6 +43,24 @@ in {
|
|||
''
|
||||
}
|
||||
|
||||
${optionalString (config.vim.lazy.enable && cfg.setupOpts.hijack_netrw && !cfg.openOnSetup) ''
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("load_nvim_tree", {}),
|
||||
desc = "Loads nvim-tree when opening a directory",
|
||||
callback = function(args)
|
||||
local stats = vim.uv.fs_stat(args.file)
|
||||
|
||||
if not stats or stats.type ~= "directory" then
|
||||
return
|
||||
end
|
||||
|
||||
require("lz.n").trigger_load("nvim-tree-lua")
|
||||
|
||||
return true
|
||||
end,
|
||||
})
|
||||
''}
|
||||
|
||||
${
|
||||
optionalString cfg.openOnSetup ''
|
||||
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue