fix: set mode for all keymaps

This commit is contained in:
Nicolas Goudry 2024-06-08 00:25:04 +02:00
parent 53fdfbb8ba
commit ec180d7365
No known key found for this signature in database
GPG key ID: 5FC434D9FFD1DF44
13 changed files with 83 additions and 9 deletions

View file

@ -8,8 +8,8 @@ in
# Standard operations
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L27-L44
{
key = "j";
mode = [ "n" "x" ];
key = "j";
action = "v:count == 0 ? 'gj' : 'j'";
options = {
@ -19,8 +19,8 @@ in
};
}
{
key = "k";
mode = [ "n" "x" ];
key = "k";
action = "v:count == 0 ? 'gk' : 'k'";
options = {
@ -30,51 +30,60 @@ in
};
}
{
mode = "n";
key = "<leader>w";
action = "<cmd>w<cr>";
options.desc = "Save";
}
{
mode = "n";
key = "<leader>q";
action = "<cmd>confirm q<cr>";
options.desc = "Quit window";
}
{
mode = "n";
key = "<leader>Q";
action = "<cmd>confirm qall<cr>";
options.desc = "Exit neovim";
}
{
mode = "n";
key = "<leader>n";
action = "<cmd>enew<cr>";
options.desc = "New file";
}
{
inherit (forceWrite) action options;
mode = "n";
key = "<c-s>";
}
{
inherit (forceWrite) options;
key = "<c-s>";
mode = [ "i" "x" ];
key = "<c-s>";
action = "<esc>" + forceWrite.action;
}
{
mode = "n";
key = "<c-q>";
action = "<cmd>q!<cr>";
options.desc = "Force quit";
}
{
mode = "n";
key = "|";
action = "<cmd>vsplit<cr>";
options.desc = "Vertical split";
}
{
mode = "n";
key = "\\";
action = "<cmd>split<cr>";
options.desc = "Horizontal split";
}
{
mode = "n";
key = "gx";
action.__raw = "require('astrocore').system_open";
options.desc = "Open the file under cursor with system app";
@ -83,14 +92,14 @@ in
# Stay in indent mode
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L117-L118
{
mode = "v";
key = "<S-Tab>";
mode = [ "v" ];
action = "<gv";
options.desc = "Unindent line";
}
{
mode = "v";
key = "<Tab>";
mode = [ "v" ];
action = ">gv";
options.desc = "Indent line";
}