diff --git a/gerg/lua/gerg/fzf.lua b/gerg/lua/gerg/fzf.lua index 9268eca..eab692d 100644 --- a/gerg/lua/gerg/fzf.lua +++ b/gerg/lua/gerg/fzf.lua @@ -4,7 +4,7 @@ WK.add({ { "ff", " FzfLua files", desc = "fzf files" }, { "fg", " FzfLua live_grep_native", desc = "fzf ripgrep (native)" }, { "fG", " FzfLua live_grep", desc = "fzf ripgrep" }, - { "fd", " FzfLua lsp_code_actions", desc = "fzf code actions" }, { "fr", " FzfLua resume", desc = "fzf resume" }, { "fb", " FzfLua buffers", desc = "fzf buffers" }, + { "la", " FzfLua lsp_code_actions", desc = "fzf code actions" }, }) diff --git a/gerg/lua/gerg/lsp.lua b/gerg/lua/gerg/lsp.lua index eed4213..b6bb27e 100644 --- a/gerg/lua/gerg/lsp.lua +++ b/gerg/lua/gerg/lsp.lua @@ -1,28 +1,82 @@ -local attach_keymaps = function(_, _) - local opts = { noremap = true, silent = true } - WK.add({ - { "lgD", "lua vim.lsp.buf.declaration()", opts }, - { "lgd", "lua vim.lsp.buf.definition()", opts }, - { "lgt", "lua vim.lsp.buf.type_definition()", opts }, - { "lgn", "lua vim.diagnostic.goto_next()", opts }, - { "lgp", "lua vim.diagnostic.goto_prev()", opts }, - { "lwa", "lua vim.lsp.buf.add_workspace_folder()", opts }, - { "lwr", "lua vim.lsp.buf.remove_workspace_folder()", opts }, - { "lwl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts }, - { "lh", "lua vim.lsp.buf.hover()", opts }, - { "ls", "lua vim.lsp.buf.signature_help()", opts }, - { "ln", "lua vim.lsp.buf.rename()", opts }, - { "la", "lua vim.lsp.buf.code_action()", opts }, - { - "lf", - function() - vim.lsp.buf.format({ async = true }) - end, - opts, - }, - }) -end +local opts = { noremap = true, silent = true } + WK.add({ + { "lg", desc = "Decs/Defs" }, + + { + "lgD", + "lua vim.lsp.buf.declaration()", + desc = "Decleration", + opts, + }, + { + "lgd", + "lua vim.lsp.buf.definition()", + desc = "Definition", + opts, + }, + { + "lgt", + "lua vim.lsp.buf.type_definition()", + desc = "Type definition", + opts, + }, + { + "lgn", + "lua vim.diagnostic.goto_next()", + desc = "Next diagnostic", + opts, + }, + { + "lgp", + "lua vim.diagnostic.goto_prev()", + desc = "Prev diagnostic", + opts, + }, + { "lw", desc = "Workspace" }, + { + "lwa", + "lua vim.lsp.buf.add_workspace_folder()", + desc = "Add workspace folder", + opts, + }, + { + "lwr", + "lua vim.lsp.buf.remove_workspace_folder()", + desc = "Remove workspace folder", + opts, + }, + { + "lwl", + "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", + desc = "List workspace folders", + opts, + }, + { + "lh", + "lua vim.lsp.buf.hover()", + desc = "Hover info", + opts, + }, + { + "ls", + "lua vim.lsp.buf.signature_help()", + desc = "Signature info", + opts, + }, + { + "ln", + "lua vim.lsp.buf.rename()", + desc = "Rename variable", + opts, + }, + { + "lf", + function() + vim.lsp.buf.format({ async = true }) + end, + desc = "Format buffer", + }, { "l", desc = "LSP" }, { "lt", @@ -55,7 +109,6 @@ local format_callback = function(client, bufnr) }) end local default_on_attach = function(client, bufnr) - attach_keymaps(client, bufnr) format_callback(client, bufnr) end --colors @@ -219,14 +272,45 @@ vim.g.rustaceanvim = { }, on_attach = function(client, bufnr) default_on_attach(client, bufnr) - local opts = { noremap = true, silent = true, buffer = bufnr } + local rust_opts = { noremap = true, silent = true, buffer = bufnr } WK.add({ - { "rr", ":RustLsp runnables", opts }, - { "rp", ":RustLsp parentModule", opts }, - { "rm", ":RustLsp expandMacro", opts }, - { "rc", ":RustLsp openCargo", opts }, - { "rg", ":RustLsp crateGraph x11", opts }, - { "rd", ":RustLsp debuggables", opts }, + { "r", desc = "Rust" }, + { + "rr", + ":RustLsp runnables", + desc = "Runnables", + rust_opts, + }, + { + "rp", + ":RustLsp parentModule", + desc = "Parent module", + rust_opts, + }, + { + "rm", + ":RustLsp expandMacro", + desc = "Expand macro", + rust_opts, + }, + { + "rc", + ":RustLsp openCargo", + desc = "Open crate", + rust_opts, + }, + { + "rg", + ":RustLsp crateGraph x11", + desc = "Crate graph", + rust_opts, + }, + { + "rd", + ":RustLsp debuggables", + desc = "Debuggables", + rust_opts, + }, }) end, } diff --git a/gerg/lua/gerg/misc.lua b/gerg/lua/gerg/misc.lua index 56b69e1..e4b6aa2 100644 --- a/gerg/lua/gerg/misc.lua +++ b/gerg/lua/gerg/misc.lua @@ -83,9 +83,9 @@ WK.add({ { { "C-d>", "zz" }, { "C-u>", "zz" }, - { "n", "nzzzv" }, - { "N", "Nzzzv" }, - { "Q", "" }, + { "n", "nzzzv" }, + { "N", "Nzzzv" }, + { "Q", "" }, }, { mode = { "x" },