update keymaps

This commit is contained in:
♥ Minnie ♥ 2025-05-16 21:03:22 +08:00
parent a6f234cc57
commit c2227b86a2
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
7 changed files with 85 additions and 25 deletions

View file

@ -17,7 +17,7 @@
{ {
# goto next buffer # goto next buffer
mode = ["n"]; mode = ["n"];
key = "<leader>bn"; key = "]b";
action = ":bnext<cr>"; action = ":bnext<cr>";
options = { options = {
silent = true; silent = true;
@ -27,7 +27,7 @@
{ {
# goto previous buffer # goto previous buffer
mode = ["n"]; mode = ["n"];
key = "<leader>bp"; key = "[b";
action = ":bprevious<cr>"; action = ":bprevious<cr>";
options = { options = {
silent = true; silent = true;

View file

@ -19,25 +19,23 @@
grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars; grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars;
}; };
# Refactor modules for nvim-treesitter
plugins.treesitter-refactor = { plugins.treesitter-refactor = {
enable = true; enable = true;
# Highlights definitions and usages.
highlightDefinitions = { highlightDefinitions = {
enable = true; enable = true;
}; };
# Provides "go to usage"
navigation = { navigation = {
enable = true; enable = true;
keymaps = {
gotoNextUsage = "<leader>n";
gotoPreviousUsage = "<leader>N";
};
};
smartRename = { # Go to the next / previous usage.
enable = true;
keymaps = { keymaps = {
smartRename = "<leader>r"; gotoNextUsage = "]u";
gotoPreviousUsage = "[u";
}; };
}; };
}; };

View file

@ -6,7 +6,7 @@
keymaps = [ keymaps = [
{ {
mode = "n"; mode = "n";
key = "<leader>g<cr>"; key = "<leader>gL";
action = "<cmd>LazyGit<cr>"; action = "<cmd>LazyGit<cr>";
options = { options = {
desc = "Open LazyGit"; desc = "Open LazyGit";
@ -16,7 +16,9 @@
{ {
mode = "n"; mode = "n";
key = "<leader>glr"; key = "<leader>glr";
action = "<cmd>lua require(\"telescope\").extensions.lazygit.lazygit()<cr>"; action = {
__raw = "require('telescope').extensions.lazygit.lazygit";
};
options = { options = {
desc = "List repositories"; desc = "List repositories";
}; };

View file

@ -55,7 +55,7 @@
# Keymaps for conform.nvim # Keymaps for conform.nvim
keymaps = [ keymaps = [
{ {
mode = ""; mode = ["n"];
key = "<leader>F"; key = "<leader>F";
action.__raw = '' action.__raw = ''
function() function()

View file

@ -1,6 +1,7 @@
{...}: { {...}: {
plugins.lsp = { plugins.lsp = {
enable = true; # Enable neovim's built-in LSP. enable = true; # Enable neovim's built-in LSP.
inlayHints = true;
# Configure our language servers # Configure our language servers
servers = { servers = {
@ -53,7 +54,66 @@
gi = "implementation"; # Lists all the implementations¹ gi = "implementation"; # Lists all the implementations¹
gt = "type_definition"; # Jumps to the definition of the type¹ gt = "type_definition"; # Jumps to the definition of the type¹
# ¹ for the symbol under the cursor # ¹ for the symbol under the cursor
# Renames all references to the symbol under the cursor.
"<leader>r" = {
action = "rename";
desc = "Rename";
}; };
}; };
# Extra keymaps to register when an LSP is attached
extra = [
{
mode = ["n"];
key = "<leader>l";
action = "<NOP>";
options = {
silent = true;
desc = "+lsp";
};
}
{
mode = ["n"];
key = "<leader>lc";
action = "<cmd>LspStop<cr>";
options = {
silent = true;
desc = "Stop server";
};
}
{
mode = ["n"];
key = "<leader>ls";
action = "<cmd>LspStart<cr>";
options = {
silent = true;
desc = "Start server";
};
}
{
mode = ["n"];
key = "<leader>lr";
action = "<cmd>LspRestart<cr>";
options = {
desc = "Restart server";
};
}
{
mode = ["n"];
key = "<leader>fd";
action = {
__raw = "require('telescope.builtin').lsp_definitions";
};
options = {
desc = "Find definitions";
};
}
];
};
}; };
} }

View file

@ -26,6 +26,15 @@
}; };
keymaps = [ keymaps = [
{
mode = ["n"];
key = "<leader>n";
action = "<cmd>NvimTreeToggle<cr>";
options = {
desc = "Toggle NvimTree";
};
}
{ {
mode = ["n"]; mode = ["n"];
key = "<leader>e"; key = "<leader>e";

View file

@ -9,16 +9,7 @@
# Prefixes, No operation. # Prefixes, No operation.
keymaps = [ keymaps = [
{ {
mode = "n"; mode = ["n" "v"];
key = "<leader>s";
action = "<Nop>";
options = {
desc = "+search";
};
}
{
mode = "n";
key = "<leader>g"; key = "<leader>g";
action = "<Nop>"; action = "<Nop>";
options = { options = {
@ -27,7 +18,7 @@
} }
{ {
mode = "n"; mode = ["n"];
key = "<leader>gl"; key = "<leader>gl";
action = "<Nop>"; action = "<Nop>";
options = { options = {
@ -36,7 +27,7 @@
} }
{ {
mode = "n"; mode = ["n"];
key = "<leader>gt"; key = "<leader>gt";
action = "<Nop>"; action = "<Nop>";
options = { options = {