feat(nvim): improve/add keybinds
parent
d1159b1ea9
commit
66652a650c
|
@ -175,8 +175,6 @@ local on_attach_def = function(_, bufnr)
|
||||||
l = {
|
l = {
|
||||||
name = "lsp",
|
name = "lsp",
|
||||||
d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" },
|
d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" },
|
||||||
n = { "<cmd>Lspsaga diagnostic_jump_next<CR>", "next error" },
|
|
||||||
p = { "<cmd>Lspsaga diagnostic_jump_prev<CR>", "prev error" },
|
|
||||||
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" },
|
||||||
i = { "<cmd>Lspsaga hover_doc ++keep<cr>", "show info (sticky)" },
|
i = { "<cmd>Lspsaga hover_doc ++keep<cr>", "show info (sticky)" },
|
||||||
|
@ -188,17 +186,6 @@ local on_attach_def = function(_, bufnr)
|
||||||
mode = { "n", "v" },
|
mode = { "n", "v" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
w = {
|
|
||||||
name = "workspace",
|
|
||||||
a = { vim.lsp.buf.add_workspace_folder, "add workspace folder" },
|
|
||||||
r = { vim.lsp.buf.remove_workspace_folder, "remove workspace folder" },
|
|
||||||
l = {
|
|
||||||
function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end,
|
|
||||||
"list workspace folders",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
t = {
|
t = {
|
||||||
name = "toggle",
|
name = "toggle",
|
||||||
l = { lsp_lines.toggle, "lsp lines" },
|
l = { lsp_lines.toggle, "lsp lines" },
|
||||||
|
@ -206,9 +193,18 @@ local on_attach_def = function(_, bufnr)
|
||||||
},
|
},
|
||||||
g = {
|
g = {
|
||||||
name = "goto",
|
name = "goto",
|
||||||
d = { "<cmd>Lspsaga peek_definition<cr>", "definition" },
|
d = { "<cmd>Lspsaga peek_definition<cr>", "Goto definition" },
|
||||||
t = { "<cmd>Lspsaga peek_type_definition<cr>", "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" },
|
||||||
|
r = { "<cmd>Telescope lsp_references<cr>", "Goto reference" },
|
||||||
|
D = { vim.lsp.buf.declaration, "Goto declaration" },
|
||||||
|
I = { "<cmd>Telescope lsp_implementations<cr>", "Goto implementation" },
|
||||||
|
},
|
||||||
|
["["] = {
|
||||||
|
d = { "<cmd>Lspsaga diagnostic_jump_prev<cr>", "Previous diagnostic" },
|
||||||
|
},
|
||||||
|
["]"] = {
|
||||||
|
d = { "<cmd>Lspsaga diagnostic_jump_next<cr>", "Next diagnostic" },
|
||||||
},
|
},
|
||||||
}, { buffer = bufnr, silent = true })
|
}, { buffer = bufnr, silent = true })
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-- buffers
|
-- buffer
|
||||||
require("which-key").register({
|
require("which-key").register({
|
||||||
b = {
|
b = {
|
||||||
name = "buffers",
|
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" },
|
n = { "<cmd>bnext<cr>", "Next buffer" },
|
||||||
|
@ -9,6 +9,52 @@ require("which-key").register({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- window
|
||||||
|
require("which-key").register({
|
||||||
|
w = {
|
||||||
|
name = "window",
|
||||||
|
["|"] = { "<C-w>v", "Split window horizontally" },
|
||||||
|
["-"] = { "<C-w>s", "Split window vertically" },
|
||||||
|
w = { "<C-w>w", "Switch window" },
|
||||||
|
d = { "<C-w>c", "Delete window" },
|
||||||
|
},
|
||||||
|
}, { prefix = "<leader>" })
|
||||||
|
|
||||||
|
-- fast window move
|
||||||
|
require("which-key").register({
|
||||||
|
["<C-h>"] = { "<C-w>h", "Move window left" },
|
||||||
|
["<C-j>"] = { "<C-w>j", "Move window down" },
|
||||||
|
["<C-k>"] = { "<C-w>k", "Move window up" },
|
||||||
|
["<C-l>"] = { "<C-w>l", "Move window right" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- tab
|
||||||
|
require("which-key").register({
|
||||||
|
["<tab>"] = {
|
||||||
|
name = "tab",
|
||||||
|
["<tab>"] = { "<cmd>tabnew<cr>", "New tab" },
|
||||||
|
n = { "<cmd>tabnext<cr>", "Next tab" },
|
||||||
|
p = { "<cmd>tabprevious<cr>", "Previous tab" },
|
||||||
|
d = { "<cmd>tabclose<cr>", "Close tab" },
|
||||||
|
},
|
||||||
|
}, { prefix = "<leader>" })
|
||||||
|
|
||||||
|
-- file
|
||||||
|
require("which-key").register({
|
||||||
|
f = {
|
||||||
|
name = "file/find",
|
||||||
|
n = { "<cmd>enew<cr>", "New file" },
|
||||||
|
},
|
||||||
|
}, { prefix = "<leader>" })
|
||||||
|
|
||||||
|
-- better descriptions for navigation
|
||||||
|
require("which-key").register({
|
||||||
|
["["] = { name = "prev" },
|
||||||
|
["]"] = { name = "next" },
|
||||||
|
o = { name = "org" },
|
||||||
|
x = { name = "diagnostics/quickfix" },
|
||||||
|
})
|
||||||
|
|
||||||
-- Clear search with <esc>
|
-- Clear search with <esc>
|
||||||
require("which-key").register({
|
require("which-key").register({
|
||||||
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
|
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
require("which-key").register({
|
require("which-key").register({
|
||||||
f = {
|
f = {
|
||||||
name = "find",
|
name = "file/find",
|
||||||
f = { "<cmd>Telescope find_files<cr>", "find file" },
|
f = { "<cmd>Telescope find_files<cr>", "Find files" },
|
||||||
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "find line" },
|
b = { "<cmd>Telescope buffers<cr>", "Find buffers" },
|
||||||
g = { "<cmd>Telescope live_grep<cr>", "live grep" },
|
r = { "<cmd>Telescope oldfiles<cr>", "Find recent files" },
|
||||||
b = { "<cmd>Telescope buffers<cr>", "find buffer" },
|
},
|
||||||
|
s = {
|
||||||
|
name = "search",
|
||||||
|
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Search lines" },
|
||||||
|
g = { "<cmd>Telescope live_grep<cr>", "Live grep" },
|
||||||
|
c = { "<cmd>Telescope command_history<cr>", "Command history" },
|
||||||
|
C = { "<cmd>Telescope commands<cr>", "Commands" },
|
||||||
|
d = { "<cmd>Telescope diagnostics<cr>", "Diagnostics" },
|
||||||
|
h = { "<cmd>Telescope help_tags<cr>", "Help tags" },
|
||||||
|
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
|
||||||
|
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Symbols (Document)" },
|
||||||
|
S = { "<cmd>Telescope lsp_workspace_symbols<cr>", "Symbols (Workspace)" },
|
||||||
},
|
},
|
||||||
}, { prefix = "<leader>" })
|
}, { prefix = "<leader>" })
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require("telescope").load_extension("zoxide")
|
require("telescope").load_extension("zoxide")
|
||||||
require("which-key").register({
|
require("which-key").register({
|
||||||
f = {
|
f = {
|
||||||
name = "find",
|
name = "file/find",
|
||||||
z = { "<cmd>Telescope zoxide list<cr>", "find location" },
|
z = { "<cmd>Telescope zoxide list<cr>", "Find location (Zoxide)" },
|
||||||
},
|
},
|
||||||
}, { prefix = "<leader>" })
|
}, { prefix = "<leader>" })
|
||||||
|
|
Loading…
Reference in New Issue