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