keybind(lsp): update keybind for lsp and trouble

Signed-off-by: Ryan <ryan@alien.gov>
This commit is contained in:
Ryan 2023-11-30 14:33:05 +08:00
parent 4372d8a2b0
commit b1f6665d59
No known key found for this signature in database
GPG Key ID: DB5B3AC49EEFD2A5
3 changed files with 18 additions and 7 deletions

View File

@ -24,7 +24,7 @@
"none-ls.nvim": { "branch": "main", "commit": "3a4826687da4310af379515086d71faca4d21288" }, "none-ls.nvim": { "branch": "main", "commit": "3a4826687da4310af379515086d71faca4d21288" },
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
"nvim-lspconfig": { "branch": "master", "commit": "39546f730bdff8eccf7cec344cfce694f19ac908" }, "nvim-lspconfig": { "branch": "master", "commit": "fcf153fbbf1facd16a71d46b92be8be495123a9f" },
"nvim-treesitter": { "branch": "master", "commit": "e9acd01a4a1f6e584f76e736987f4c31401aa4b1" }, "nvim-treesitter": { "branch": "master", "commit": "e9acd01a4a1f6e584f76e736987f4c31401aa4b1" },
"nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, "nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" },
"nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" }, "nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" },

View File

@ -171,7 +171,19 @@ local plugins = {
function() require("trouble").toggle("document_diagnostics") end), function() require("trouble").toggle("document_diagnostics") end),
vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end), vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end),
vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end), vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end),
vim.keymap.set("n", "<leader>gr", function() require("trouble").toggle("lsp_references") end) -- lsp
vim.keymap.set("n", "<leader>gr", function()
require("trouble").toggle("lsp_references")
end),
vim.keymap.set('n', '<leader>D', function()
require("trouble").toggle("lsp_type_definitions")
end),
vim.keymap.set('n', 'gd', function ()
require("trouble").toggle("lsp_definitions")
end),
vim.keymap.set('n', '<leader>gi', function()
require("trouble").toggle("lsp_implementations")
end),
}, },
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
}, },
@ -266,7 +278,9 @@ local plugins = {
keys = { keys = {
vim.keymap.set("n", "<leader>ng", ":Neogit<cr>") vim.keymap.set("n", "<leader>ng", ":Neogit<cr>")
}, },
config = true opts = {
disable_hint = true,
},
}, },
} }

View File

@ -15,17 +15,14 @@ vim.api.nvim_create_autocmd('LspAttach', {
-- Buffer local mappings. -- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf } local opts = { buffer = ev.buf }
vim.keymap.set('n', '<leader>gD', vim.lsp.buf.declaration, opts) vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, opts) vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<leader>gi', vim.lsp.buf.implementation, opts)
vim.keymap.set({ 'n', 'i' }, '<C-k>', vim.lsp.buf.signature_help, opts) vim.keymap.set({ 'n', 'i' }, '<C-k>', vim.lsp.buf.signature_help, opts)
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<leader>wl', function() vim.keymap.set('n', '<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts) end, opts)
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts) vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts) vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<leader>fm', function() vim.keymap.set('n', '<leader>fm', function()