🐛 fix(nvim): replacing lsp keymaps for some extras
This commit is contained in:
parent
2d27e7e8e8
commit
8cdb65f7ea
2 changed files with 63 additions and 58 deletions
|
@ -1,34 +1,39 @@
|
|||
return {
|
||||
"aznhe21/actions-preview.nvim",
|
||||
init = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
|
||||
keys[#keys + 1] = { "<leader>ca", false }
|
||||
end,
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
telescope = {
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "vertical",
|
||||
layout_config = {
|
||||
width = 0.6,
|
||||
height = 0.7,
|
||||
prompt_position = "top",
|
||||
preview_cutoff = 20,
|
||||
preview_height = function(_, _, max_lines)
|
||||
return max_lines - 15
|
||||
keys[#keys + 1] = {
|
||||
"<leader>ca",
|
||||
function()
|
||||
require("actions-preview").code_actions()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Code Action Preview",
|
||||
}
|
||||
keys[#keys + 1] = { "gr", "<cmd>Glance references<cr>", desc = "Goto References" }
|
||||
keys[#keys + 1] = { "gy", "<cmd>Glance type_definitions<cr>", desc = "Goto T[y]pe Definitions" }
|
||||
keys[#keys + 1] = { "gI", "<cmd>Glance implementations<cr>", desc = "Goto Implementations" }
|
||||
end,
|
||||
},
|
||||
{
|
||||
"aznhe21/actions-preview.nvim",
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
telescope = {
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "vertical",
|
||||
layout_config = {
|
||||
width = 0.6,
|
||||
height = 0.7,
|
||||
prompt_position = "top",
|
||||
preview_cutoff = 20,
|
||||
preview_height = function(_, _, max_lines)
|
||||
return max_lines - 15
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>ca",
|
||||
function()
|
||||
require("actions-preview").code_actions()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Code Action Preview",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
return {
|
||||
"dnlhc/glance.nvim",
|
||||
init = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = function()
|
||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||
|
||||
keys[#keys + 1] = { "gd", false }
|
||||
keys[#keys + 1] = { "gr", false }
|
||||
keys[#keys + 1] = { "gy", false }
|
||||
keys[#keys + 1] = { "gI", false }
|
||||
end,
|
||||
cmd = { "Glance" },
|
||||
opts = {
|
||||
border = {
|
||||
enable = true,
|
||||
},
|
||||
use_trouble_qf = true,
|
||||
hooks = {
|
||||
before_open = function(results, open, jump, method)
|
||||
local uri = vim.uri_from_bufnr(0)
|
||||
if #results == 1 then
|
||||
local target_uri = results[1].uri or results[1].targetUri
|
||||
keys[#keys + 1] = { "gd", "<cmd>Glance definitions<cr>", desc = "Goto Definitions" }
|
||||
keys[#keys + 1] = { "gr", "<cmd>Glance references<cr>", desc = "Goto References" }
|
||||
keys[#keys + 1] = { "gy", "<cmd>Glance type_definitions<cr>", desc = "Goto T[y]pe Definitions" }
|
||||
keys[#keys + 1] = { "gI", "<cmd>Glance implementations<cr>", desc = "Goto Implementations" }
|
||||
end,
|
||||
},
|
||||
{
|
||||
"dnlhc/glance.nvim",
|
||||
cmd = { "Glance" },
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
border = {
|
||||
enable = true,
|
||||
},
|
||||
use_trouble_qf = true,
|
||||
hooks = {
|
||||
before_open = function(results, open, jump, method)
|
||||
local uri = vim.uri_from_bufnr(0)
|
||||
if #results == 1 then
|
||||
local target_uri = results[1].uri or results[1].targetUri
|
||||
|
||||
if target_uri == uri then
|
||||
jump(results[1])
|
||||
if target_uri == uri then
|
||||
jump(results[1])
|
||||
else
|
||||
open(results)
|
||||
end
|
||||
else
|
||||
open(results)
|
||||
end
|
||||
else
|
||||
open(results)
|
||||
end
|
||||
end,
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "gd", "<CMD>Glance definitions<CR>", desc = "Goto Definition" },
|
||||
{ "gr", "<CMD>Glance references<CR>", desc = "References" },
|
||||
{ "gy", "<CMD>Glance type_definitions<CR>", desc = "Goto t[y]pe definitions" },
|
||||
{ "gI", "<CMD>Glance implementations<CR>", desc = "Goto implementations" },
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue