mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
Merge c7edc3b645
into b6785f8218
This commit is contained in:
commit
397dd4d134
5 changed files with 62 additions and 3 deletions
|
@ -112,7 +112,7 @@ isMaximal: {
|
||||||
snippets.luasnip.enable = true;
|
snippets.luasnip.enable = true;
|
||||||
|
|
||||||
filetree = {
|
filetree = {
|
||||||
nvimTree = {
|
neo-tree = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
|
||||||
cfg = config.vim.filetree.neo-tree;
|
cfg = config.vim.filetree.neo-tree;
|
||||||
in {
|
in {
|
||||||
|
@ -22,6 +23,28 @@ in {
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
cmd = ["Neotree"];
|
cmd = ["Neotree"];
|
||||||
|
event = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
pluginRC = mkIf (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled" && config.vim.lazy.enable) {
|
||||||
|
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||||
|
neo-tree = entryAnywhere ''
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
||||||
|
desc = "Loads neo-tree when openning 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,
|
||||||
|
})
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals.nvim-web-devicons.enable = true;
|
visuals.nvim-web-devicons.enable = true;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{lib, ...}: let
|
{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.options) mkOption mkEnableOption literalExpression;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
@ -150,6 +150,14 @@ in {
|
||||||
A list of filetypes that should not be replaced when opening a file
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ in {
|
||||||
package = "nvim-tree-lua";
|
package = "nvim-tree-lua";
|
||||||
setupModule = "nvim-tree";
|
setupModule = "nvim-tree";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||||
keys = [
|
keys = [
|
||||||
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
(mkLznBinding ["n"] cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||||
|
@ -33,7 +34,7 @@ in {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginRC.nvimtreelua = entryAnywhere ''
|
pluginRC.nvim-tree = entryAnywhere ''
|
||||||
${
|
${
|
||||||
optionalString cfg.setupOpts.disable_netrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
-- disable netrew completely
|
-- 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 openning 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 cfg.openOnSetup ''
|
||||||
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
${optionalString config.vim.lazy.enable ''require('lz.n').trigger_load("nvim-tree-lua")''}
|
||||||
|
|
|
@ -25,6 +25,15 @@
|
||||||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||||
// {
|
// {
|
||||||
"@1" = name;
|
"@1" = name;
|
||||||
|
beforeAll =
|
||||||
|
if spec.beforeAll != null
|
||||||
|
then
|
||||||
|
mkLuaInline ''
|
||||||
|
function()
|
||||||
|
${spec.beforeAll}
|
||||||
|
end
|
||||||
|
''
|
||||||
|
else null;
|
||||||
before =
|
before =
|
||||||
if spec.before != null
|
if spec.before != null
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in a new issue