mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
nixvim: fix bug with submodule maps
This commit is contained in:
parent
e663c69032
commit
aa78a78331
2 changed files with 40 additions and 53 deletions
|
@ -49,6 +49,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
maps.normalVisualOp."ç" = ":";
|
maps.normalVisualOp."ç" = ":";
|
||||||
|
maps.normal."<leader>m" = {
|
||||||
|
silent = true;
|
||||||
|
action = "<cmd>make<CR>";
|
||||||
|
};
|
||||||
|
|
||||||
plugins.lualine = {
|
plugins.lualine = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
23
nixvim.nix
23
nixvim.nix
|
@ -24,6 +24,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
mapOption = types.oneOf [ types.str (types.submodule {
|
mapOption = types.oneOf [ types.str (types.submodule {
|
||||||
|
options = {
|
||||||
silent = mkOption {
|
silent = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
description = "Whether this mapping should be silent. Equivalent to adding <silent> to a map.";
|
||||||
|
@ -64,6 +65,7 @@ let
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The action to execute.";
|
description = "The action to execute.";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}) ];
|
}) ];
|
||||||
|
|
||||||
mapOptions = mode: mkOption {
|
mapOptions = mode: mkOption {
|
||||||
|
@ -221,26 +223,7 @@ in
|
||||||
local __nixvim_options = ${helpers.toLuaObject cfg.options}
|
local __nixvim_options = ${helpers.toLuaObject cfg.options}
|
||||||
|
|
||||||
for k,v in pairs(__nixvim_options) do
|
for k,v in pairs(__nixvim_options) do
|
||||||
-- Here we use the set command because, as of right now, neovim has
|
vim.o[k] = v
|
||||||
-- no equivalent using the lua API. You have to sort through the
|
|
||||||
-- options and know which options are local to what
|
|
||||||
if type(v) == "boolean" then
|
|
||||||
local no
|
|
||||||
if v then no = "" else no = "no" end
|
|
||||||
|
|
||||||
vim.cmd("set " .. no .. k)
|
|
||||||
elseif type(v) == "table" then
|
|
||||||
local val = ""
|
|
||||||
for i,opt in ipairs(v) do
|
|
||||||
val = val .. tostring(opt)
|
|
||||||
if i ~= #v then
|
|
||||||
val = val .. ","
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vim.cmd("set " .. k .. "=" .. val)
|
|
||||||
else
|
|
||||||
vim.cmd("set " .. k .. "=" .. tostring(v))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
'' + optionalString (mappings != []) ''
|
'' + optionalString (mappings != []) ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue