mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
neo-tree: add hijack netrw
This commit is contained in:
parent
c971673529
commit
62b1e30e49
2 changed files with 31 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
|
|
||||||
cfg = config.vim.filetree.neo-tree;
|
cfg = config.vim.filetree.neo-tree;
|
||||||
in {
|
in {
|
||||||
|
@ -21,7 +22,28 @@ in {
|
||||||
setupModule = "neo-tree";
|
setupModule = "neo-tree";
|
||||||
inherit (cfg) setupOpts;
|
inherit (cfg) setupOpts;
|
||||||
|
|
||||||
|
beforeAll =
|
||||||
|
optionalString (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled")
|
||||||
|
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||||
|
''
|
||||||
|
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,
|
||||||
|
})
|
||||||
|
'';
|
||||||
cmd = ["Neotree"];
|
cmd = ["Neotree"];
|
||||||
|
event = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
visuals.nvimWebDevicons.enable = true;
|
visuals.nvimWebDevicons.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";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue