mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-24 12:28:32 +00:00
Compare commits
No commits in common. "8154c3e68f076f78cfa3b60acb1823c29b2e4953" and "74856c203193770f6b71194938e591b75e0f58ab" have entirely different histories.
8154c3e68f
...
74856c2031
2 changed files with 26 additions and 19 deletions
|
@ -1,6 +1,6 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
inherit (lib.types) either str listOf attrsOf nullOr submodule bool;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
mapConfigOptions = {
|
mapConfigOptions = {
|
||||||
|
@ -33,7 +33,9 @@
|
||||||
// {
|
// {
|
||||||
key = mkOption {
|
key = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = "The key that triggers this keybind.";
|
description = ''
|
||||||
|
Key that triggers this keybind.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
mode = mkOption {
|
mode = mkOption {
|
||||||
type = either str (listOf str);
|
type = either str (listOf str);
|
||||||
|
@ -42,17 +44,20 @@
|
||||||
|
|
||||||
See `:help map-modes` for a list of modes.
|
See `:help map-modes` for a list of modes.
|
||||||
'';
|
'';
|
||||||
example = ''`["n" "v" "c"]` for normal, visual and command mode'';
|
example = ''"nvc" for normal, visual and command mode'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
legacyMapOption = mode:
|
# legacy stuff
|
||||||
|
legacyMapOption = submodule {
|
||||||
|
options = mapConfigOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
mapOptions = mode:
|
||||||
mkOption {
|
mkOption {
|
||||||
description = "Mappings for ${mode} mode";
|
description = "Mappings for ${mode} mode";
|
||||||
type = attrsOf (submodule {
|
type = attrsOf legacyMapOption;
|
||||||
options = mapConfigOptions;
|
|
||||||
});
|
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -80,18 +85,18 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
maps = {
|
maps = {
|
||||||
normal = legacyMapOption "normal";
|
normal = mapOptions "normal";
|
||||||
insert = legacyMapOption "insert";
|
insert = mapOptions "insert";
|
||||||
select = legacyMapOption "select";
|
select = mapOptions "select";
|
||||||
visual = legacyMapOption "visual and select";
|
visual = mapOptions "visual and select";
|
||||||
terminal = legacyMapOption "terminal";
|
terminal = mapOptions "terminal";
|
||||||
normalVisualOp = legacyMapOption "normal, visual, select and operator-pending (same as plain 'map')";
|
normalVisualOp = mapOptions "normal, visual, select and operator-pending (same as plain 'map')";
|
||||||
|
|
||||||
visualOnly = legacyMapOption "visual only";
|
visualOnly = mapOptions "visual only";
|
||||||
operator = legacyMapOption "operator-pending";
|
operator = mapOptions "operator-pending";
|
||||||
insertCommand = legacyMapOption "insert and command-line";
|
insertCommand = mapOptions "insert and command-line";
|
||||||
lang = legacyMapOption "insert, command-line and lang-arg";
|
lang = mapOptions "insert, command-line and lang-arg";
|
||||||
command = legacyMapOption "command-line";
|
command = mapOptions "command-line";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,9 @@ in {
|
||||||
|
|
||||||
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
|
toLuaKeymap = bind: "vim.keymap.set(${toLuaObject bind.mode}, ${toLuaObject bind.key}, ${toLuaObject (getAction bind)}, ${toLuaObject (getOpts bind)})";
|
||||||
|
|
||||||
keymaps = concatLines (map toLuaKeymap cfg.keymaps);
|
maps = concatLines (map toLuaKeymap cfg.keymaps);
|
||||||
|
|
||||||
|
keymaps = maps;
|
||||||
in {
|
in {
|
||||||
vim = {
|
vim = {
|
||||||
luaConfigRC = {
|
luaConfigRC = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue