mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 22:55:58 +01:00
Compare commits
3 commits
74496972c4
...
32fe0ff5a7
Author | SHA1 | Date | |
---|---|---|---|
|
32fe0ff5a7 | ||
|
1bc185c168 | ||
|
a4ad8654a6 |
3 changed files with 30 additions and 17 deletions
|
@ -57,13 +57,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
lznKeysSpec = submodule {
|
lznKeysSpec = submodule {
|
||||||
apply = x:
|
|
||||||
x
|
|
||||||
// {
|
|
||||||
"@1" = x.lhs;
|
|
||||||
"@2" = x.rhs;
|
|
||||||
};
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
desc = mkOption {
|
desc = mkOption {
|
||||||
description = "Description of the key map";
|
description = "Description of the key map";
|
||||||
|
@ -109,7 +102,7 @@
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
description = "Modes to bind in";
|
description = "Modes to bind in";
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["n"];
|
default = ["n" "x" "s" "o"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -193,7 +186,7 @@
|
||||||
keys = mkOption {
|
keys = mkOption {
|
||||||
description = "Lazy-load on key mapping";
|
description = "Lazy-load on key mapping";
|
||||||
default = null;
|
default = null;
|
||||||
type = nullOr (oneOf [str (listOf str) lznKeysSpec]); # TODO: support lz.n.KeysSpec
|
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]); # TODO: support lz.n.KeysSpec
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: enabled, beforeAll, colorscheme, priority, load
|
# TODO: enabled, beforeAll, colorscheme, priority, load
|
||||||
|
|
|
@ -13,16 +13,13 @@
|
||||||
|
|
||||||
cfg = config.vim.filetree.nvimTree;
|
cfg = config.vim.filetree.nvimTree;
|
||||||
self = import ./nvimtree.nix {inherit pkgs lib;};
|
self = import ./nvimtree.nix {inherit pkgs lib;};
|
||||||
|
mkNormalBinding = lhs: rhs: desc: {
|
||||||
|
inherit lhs rhs desc;
|
||||||
|
mode = ["n"];
|
||||||
|
};
|
||||||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
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 {
|
vim.binds.whichKey.register = pushDownDefault {
|
||||||
"<leader>t" = "+NvimTree";
|
"<leader>t" = "+NvimTree";
|
||||||
};
|
};
|
||||||
|
@ -34,6 +31,13 @@ in {
|
||||||
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 = [
|
||||||
|
(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)
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,8 +12,23 @@
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
cfg = config.vim.lazy;
|
cfg = config.vim.lazy;
|
||||||
|
|
||||||
|
toLuzLznKeySpec = {
|
||||||
|
desc,
|
||||||
|
noremap,
|
||||||
|
expr,
|
||||||
|
nowait,
|
||||||
|
ft,
|
||||||
|
lhs,
|
||||||
|
rhs,
|
||||||
|
mode,
|
||||||
|
}: {
|
||||||
|
"@1" = lhs;
|
||||||
|
"@2" = rhs;
|
||||||
|
inherit desc noremap expr nowait ft mode;
|
||||||
|
};
|
||||||
|
|
||||||
toLuaLznSpec = name: spec:
|
toLuaLznSpec = name: spec:
|
||||||
(removeAttrs spec ["package" "setupModule" "setupOpts"])
|
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||||
// {
|
// {
|
||||||
"@1" = name;
|
"@1" = name;
|
||||||
after = mkLuaInline ''
|
after = mkLuaInline ''
|
||||||
|
@ -25,6 +40,7 @@
|
||||||
${optionalString (spec.after != null) spec.after}
|
${optionalString (spec.after != null) spec.after}
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
keys = map toLuzLznKeySpec spec.keys;
|
||||||
};
|
};
|
||||||
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||||
in {
|
in {
|
||||||
|
|
Loading…
Reference in a new issue