mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-13 10:44:34 +02:00
plugins/misc: adapt to new maps options
This commit is contained in:
parent
574fb73258
commit
dd6a114e52
18 changed files with 262 additions and 193 deletions
|
@ -187,22 +187,20 @@ in {
|
|||
require('harpoon').setup(${helpers.toLuaObject options})
|
||||
'';
|
||||
|
||||
maps.normal = let
|
||||
silent = cfg.keymapsSilent;
|
||||
keymaps = let
|
||||
km = cfg.keymaps;
|
||||
|
||||
simpleMappings = mkMerge (
|
||||
simpleMappings = flatten (
|
||||
mapAttrsToList
|
||||
(
|
||||
optionName: luaFunc: let
|
||||
key = km.${optionName};
|
||||
in
|
||||
mkIf (key != null) {
|
||||
${key} = {
|
||||
action = luaFunc;
|
||||
lua = true;
|
||||
inherit silent;
|
||||
};
|
||||
optional
|
||||
(key != null)
|
||||
{
|
||||
inherit key;
|
||||
action = luaFunc;
|
||||
}
|
||||
)
|
||||
{
|
||||
|
@ -217,38 +215,44 @@ in {
|
|||
mkNavMappings = name: genLuaFunc: let
|
||||
mappingsAttrs = km.${name};
|
||||
in
|
||||
mkIf
|
||||
(mappingsAttrs != null)
|
||||
flatten
|
||||
(
|
||||
mapAttrs'
|
||||
(id: key: {
|
||||
name = key;
|
||||
value = {
|
||||
optionals
|
||||
(mappingsAttrs != null)
|
||||
(
|
||||
mapAttrsToList
|
||||
(id: key: {
|
||||
inherit key;
|
||||
action = genLuaFunc id;
|
||||
lua = true;
|
||||
inherit silent;
|
||||
};
|
||||
})
|
||||
mappingsAttrs
|
||||
})
|
||||
mappingsAttrs
|
||||
)
|
||||
);
|
||||
in
|
||||
mkMerge [
|
||||
|
||||
allMappings =
|
||||
simpleMappings
|
||||
(
|
||||
++ (
|
||||
mkNavMappings
|
||||
"navFile"
|
||||
(id: "function() require('harpoon.ui').nav_file(${id}) end")
|
||||
)
|
||||
(
|
||||
++ (
|
||||
mkNavMappings
|
||||
"gotoTerminal"
|
||||
(id: "function() require('harpoon.term').gotoTerminal(${id}) end")
|
||||
)
|
||||
(
|
||||
++ (
|
||||
mkNavMappings
|
||||
"tmuxGotoTerminal"
|
||||
(id: "function() require('harpoon.tmux').gotoTerminal(${id}) end")
|
||||
)
|
||||
];
|
||||
);
|
||||
in
|
||||
helpers.mkKeymaps
|
||||
{
|
||||
mode = "n";
|
||||
lua = true;
|
||||
options.silent = cfg.keymapsSilent;
|
||||
}
|
||||
allMappings;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue