Skip to content

Commit

Permalink
terminal/editors/neovim: refactor keymaps
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jun 2, 2024
1 parent aefbca3 commit 477f495
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ in
};

which-key.registrations."<leader>"."g"."W" = mkIf (cfg.enableTelescope && cfg.enable) {
name = "󰙅 Git Worktree";
name = "󰙅 Worktree";
};
};

Expand Down
30 changes: 13 additions & 17 deletions modules/home/programs/terminal/editors/neovim/plugins/gitsigns.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ in
};
};

which-key.registrations."<leader>"."g"."t" = mkIf config.programs.nixvim.plugins.gitsigns.enable {
name = " Gitsigns Toggle";
which-key.registrations."<leader>"."g" = {
"h" = mkIf config.programs.nixvim.plugins.gitsigns.enable { name = " Hunks"; };
"t" = mkIf config.programs.nixvim.plugins.gitsigns.enable { name = " Toggle"; };
};
};

Expand Down Expand Up @@ -99,7 +100,7 @@ in
}
{
mode = "n";
key = "<leader>gp";
key = "<leader>ghp";
action.__raw = ''
function()
if vim.wo.diff then return ${toJSON "<leader>gp"} end
Expand All @@ -116,7 +117,7 @@ in
}
{
mode = "n";
key = "<leader>gn";
key = "<leader>ghn";
action.__raw = ''
function()
if vim.wo.diff then return ${toJSON "<leader>gn"} end
Expand All @@ -136,7 +137,7 @@ in
"n"
"v"
];
key = "<leader>gs";
key = "<leader>ghs";
action = "<cmd>Gitsigns stage_hunk<CR>";
options = {
desc = "Stage hunk";
Expand All @@ -145,7 +146,7 @@ in
}
{
mode = "n";
key = "<leader>gu";
key = "<leader>ghu";
action = "<cmd>Gitsigns undo_stage_hunk<CR>";
options = {
desc = "Undo stage hunk";
Expand All @@ -157,7 +158,7 @@ in
"n"
"v"
];
key = "<leader>gr";
key = "<leader>ghr";
action = "<cmd>Gitsigns reset_hunk<CR>";
options = {
desc = "Reset hunk";
Expand All @@ -166,7 +167,7 @@ in
}
{
mode = "n";
key = "<leader>g<C-p>";
key = "<leader>ghP";
action = "<cmd>Gitsigns preview_hunk<CR>";
options = {
desc = "Preview hunk";
Expand All @@ -175,9 +176,10 @@ in
}
{
mode = "n";
key = "<leader>gP";
key = "<leader>gh<C-p>";
action = "<cmd>Gitsigns preview_hunk_inline<CR>";
options = {
desc = "Preview hunk inline";
silent = true;
};
}
Expand All @@ -186,6 +188,7 @@ in
key = "<leader>gS";
action = "<cmd>Gitsigns stage_buffer<CR>";
options = {
desc = "Stage buffer";
silent = true;
};
}
Expand All @@ -194,14 +197,7 @@ in
key = "<leader>gR";
action = "<cmd>Gitsigns reset_buffer<CR>";
options = {
silent = true;
};
}
{
mode = "n";
key = "<leader>gD";
action = "<cmd>Gitsigns diffthis HEAD<CR>";
options = {
desc = "Reset buffer";
silent = true;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ in
keymaps = [
{
mode = "n";
key = "<leader>pm";
key = "<leader>pg";
action = ":Glow<CR>";
options = {
desc = "Preview Markdown";
desc = "Glow (Markdown)";
silent = true;
};
}
];

plugins.which-key.registrations."<leader>p" = {
mode = "v";
mode = "n";
name = " Preview";
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ _: {
keymaps = [
{
mode = "n";
key = "<leader>m";
key = "<leader>pm";
action = ":MarkdownPreview<cr>";
options.silent = true;
options = {
desc = "Markdown Preview";
silent = true;
};
}
];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ _: {
}
{
mode = "n";
key = "<leader>ug";
key = "<leader>gto";
action.__raw = # lua
"MiniDiff.toggle_overlay";
options = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _: {
key = "<leader>tt";
action = ":ToggleTerm<CR>";
options = {
desc = "Toggle terminal";
desc = "Open Terminal";
silent = true;
};
}
Expand All @@ -30,7 +30,7 @@ _: {
end
'';
options = {
desc = "Toggle lazygit";
desc = "Open Lazygit";
silent = true;
};
}
Expand All @@ -46,7 +46,7 @@ _: {
end
'';
options = {
desc = "Toggle lazygit";
desc = "Open Lazygit";
silent = true;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
key = "<leader>ty";
action = ":Yazi<CR>";
options = {
desc = "Toggle Yazi";
desc = "Open Yazi";
silent = true;
};
}
Expand Down

0 comments on commit 477f495

Please sign in to comment.