mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 14:45:58 +01:00
nvim-tree: move to lz.n keymaps
This commit is contained in:
parent
085d5d304a
commit
f29664626b
1 changed files with 12 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.binds) mkBinding;
|
||||
|
@ -13,16 +14,13 @@
|
|||
|
||||
cfg = config.vim.filetree.nvimTree;
|
||||
self = import ./nvimtree.nix {inherit pkgs lib;};
|
||||
mkNormalBinding = lhs: rhs: desc: {
|
||||
inherit lhs rhs desc;
|
||||
mode = ["n"];
|
||||
};
|
||||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.maps.normal = mkMerge [
|
||||
(mkBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkBinding cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkBinding cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
|
||||
vim.binds.whichKey.register = pushDownDefault {
|
||||
"<leader>t" = "+NvimTree";
|
||||
};
|
||||
|
@ -34,6 +32,13 @@ in {
|
|||
setupModule = "nvim-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
||||
|
||||
keys = filter ({lhs, ...}: lhs != null) [
|
||||
(mkNormalBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||
(mkNormalBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||
(mkNormalBinding cfg.mappings.findFile ":NvimTreeFindFile<cr>" mappings.findFile.description)
|
||||
(mkNormalBinding cfg.mappings.focus ":NvimTreeFocus<cr>" mappings.focus.description)
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue