feat(nvim): improve/add keybindings

This commit is contained in:
Moritz Böhme 2023-04-10 15:14:04 +02:00
parent 5fc963c537
commit 2af3432410
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
4 changed files with 24 additions and 14 deletions

View file

@ -145,7 +145,6 @@ local on_attach_def = function(_, bufnr)
K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" }, K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" },
["<leader>"] = { ["<leader>"] = {
l = { l = {
name = "lsp",
d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" }, d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" },
c = { "<cmd>Lspsaga code_action<cr>", "code action" }, c = { "<cmd>Lspsaga code_action<cr>", "code action" },
r = { "<cmd>Lspsaga rename<cr>", "rename" }, r = { "<cmd>Lspsaga rename<cr>", "rename" },
@ -159,12 +158,10 @@ local on_attach_def = function(_, bufnr)
}, },
}, },
t = { t = {
name = "toggle",
l = { lsp_lines.toggle, "lsp lines" }, l = { lsp_lines.toggle, "lsp lines" },
}, },
}, },
g = { g = {
name = "goto",
d = { "<cmd>Lspsaga peek_definition<cr>", "Goto definition" }, d = { "<cmd>Lspsaga peek_definition<cr>", "Goto definition" },
t = { "<cmd>Lspsaga peek_type_definition<cr>", "Goto type defininition" }, t = { "<cmd>Lspsaga peek_type_definition<cr>", "Goto type defininition" },
h = { "<cmd>Lspsaga lsp_finder<CR>", "Lsp finder" }, h = { "<cmd>Lspsaga lsp_finder<CR>", "Lsp finder" },

View file

@ -4,8 +4,6 @@ require("which-key").register({
name = "buffer", name = "buffer",
b = { "<cmd>Telescope buffers<cr>", "List buffers" }, b = { "<cmd>Telescope buffers<cr>", "List buffers" },
d = { "<cmd>bd<cr>", "Delete buffer" }, d = { "<cmd>bd<cr>", "Delete buffer" },
n = { "<cmd>bnext<cr>", "Next buffer" },
p = { "<cmd>bprevious<cr>", "Previous buffer" },
}, },
}) })
@ -19,6 +17,14 @@ require("which-key").register({
d = { "<C-w>c", "Delete window" }, d = { "<C-w>c", "Delete window" },
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
require("which-key").register({
["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" },
},
["]"] = {
b = { "<cmd>bnext<cr>", "Next buffer" },
},
})
-- fast window move -- fast window move
require("which-key").register({ require("which-key").register({
@ -49,10 +55,18 @@ require("which-key").register({
-- better descriptions for navigation -- better descriptions for navigation
require("which-key").register({ require("which-key").register({
["<leader>"] = {
f = { name = "file/find" },
g = { name = "git" },
l = { name = "lsp" },
o = { name = "org" },
s = { name = "search" },
t = { name = "toggle" },
x = { name = "diagnostics/quickfix" },
},
["["] = { name = "prev" }, ["["] = { name = "prev" },
["]"] = { name = "next" }, ["]"] = { name = "next" },
o = { name = "org" }, g = { name = "goto" },
x = { name = "diagnostics/quickfix" },
}) })
-- Clear search with <esc> -- Clear search with <esc>

View file

@ -1,12 +1,10 @@
require("which-key").register({ require("which-key").register({
f = { f = {
name = "file/find",
f = { "<cmd>Telescope find_files<cr>", "Find files" }, f = { "<cmd>Telescope find_files<cr>", "Find files" },
b = { "<cmd>Telescope buffers<cr>", "Find buffers" }, b = { "<cmd>Telescope buffers<cr>", "Find buffers" },
r = { "<cmd>Telescope oldfiles<cr>", "Find recent files" }, r = { "<cmd>Telescope oldfiles<cr>", "Find recent files" },
}, },
s = { s = {
name = "search",
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Search lines" }, l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Search lines" },
g = { "<cmd>Telescope live_grep<cr>", "Live grep" }, g = { "<cmd>Telescope live_grep<cr>", "Live grep" },
c = { "<cmd>Telescope command_history<cr>", "Command history" }, c = { "<cmd>Telescope command_history<cr>", "Command history" },
@ -17,4 +15,8 @@ require("which-key").register({
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Symbols (Document)" }, s = { "<cmd>Telescope lsp_document_symbols<cr>", "Symbols (Document)" },
S = { "<cmd>Telescope lsp_workspace_symbols<cr>", "Symbols (Workspace)" }, S = { "<cmd>Telescope lsp_workspace_symbols<cr>", "Symbols (Workspace)" },
}, },
g = {
c = { "<cmd>Telescope git_commits<cr>", "Commits" },
s = { "<cmd>Telescope git_status<cr>", "Status" },
},
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })

View file

@ -1,7 +1,4 @@
require("telescope").load_extension("zoxide") require("telescope").load_extension("zoxide")
require("which-key").register({ require("which-key").register({
f = { z = { "<cmd>Telescope zoxide list<cr>", "Find location (Zoxide)" },
name = "file/find", }, { prefix = "<leader>f" })
z = { "<cmd>Telescope zoxide list<cr>", "Find location (Zoxide)" },
},
}, { prefix = "<leader>" })