Compare commits

..

5 commits

Author SHA1 Message Date
Ching Pei Yang
b2eafaf8d6 nvim-tree: load nvim-tree if openOnSetup 2024-08-03 16:59:41 +02:00
Ching Pei Yang
dfd9172371 lib: add lznKeySpec example 2024-08-03 16:39:16 +02:00
Ching Pei Yang
f29664626b nvim-tree: move to lz.n keymaps 2024-08-03 16:39:16 +02:00
Ching Pei Yang
085d5d304a lz.n: process key maps 2024-08-03 14:45:48 +02:00
Ching Pei Yang
4efc5d89d0 remove unused 2024-08-03 14:45:29 +02:00
3 changed files with 11 additions and 4 deletions

View file

@ -186,7 +186,12 @@
keys = mkOption {
description = "Lazy-load on key mapping";
default = null;
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]); # TODO: support lz.n.KeysSpec
type = nullOr (oneOf [str (listOf lznKeysSpec) (listOf str)]);
example = ''
keys = [
{lhs = "<leader>s"; rhs = ":NvimTreeToggle<cr>"; desc = "Toggle NvimTree"}
]
'';
};
# TODO: enabled, beforeAll, colorscheme, priority, load

View file

@ -4,6 +4,7 @@
pkgs,
...
}: let
inherit (builtins) filter;
inherit (lib.strings) optionalString;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) mkBinding;
@ -32,7 +33,7 @@ in {
inherit (cfg) setupOpts;
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
keys = [
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)
@ -53,6 +54,7 @@ in {
${
optionalString cfg.openOnSetup ''
require('lz.n').trigger_load("nvim-tree-lua")
-- autostart behaviour
-- Open on startup has been deprecated
-- see https://github.com/nvim-tree/nvim-tree.lua/wiki/Open-At-Startup

View file

@ -9,7 +9,7 @@
inherit (lib.generators) mkLuaInline;
inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.dag) entryBefore;
cfg = config.vim.lazy;
toLuzLznKeySpec = {
@ -49,7 +49,7 @@ in {
optPlugins = mapAttrsToList (_: plugin: plugin.package) cfg.plugins;
luaConfigRC.lzn-load = entryAnywhere ''
luaConfigRC.lzn-load = entryBefore ["pluginConfigs"] ''
require('lz.n').load(${toLuaObject lznSpecs})
'';
};