🐛 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 {
|
return {
|
||||||
"aznhe21/actions-preview.nvim",
|
{
|
||||||
init = function()
|
"neovim/nvim-lspconfig",
|
||||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
opts = function()
|
||||||
|
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||||
|
|
||||||
keys[#keys + 1] = { "<leader>ca", false }
|
keys[#keys + 1] = {
|
||||||
end,
|
"<leader>ca",
|
||||||
event = "LspAttach",
|
function()
|
||||||
opts = {
|
require("actions-preview").code_actions()
|
||||||
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,
|
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 {
|
return {
|
||||||
"dnlhc/glance.nvim",
|
{
|
||||||
init = function()
|
"neovim/nvim-lspconfig",
|
||||||
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
opts = function()
|
||||||
|
local keys = require("lazyvim.plugins.lsp.keymaps").get()
|
||||||
|
|
||||||
keys[#keys + 1] = { "gd", false }
|
keys[#keys + 1] = { "gd", "<cmd>Glance definitions<cr>", desc = "Goto Definitions" }
|
||||||
keys[#keys + 1] = { "gr", false }
|
keys[#keys + 1] = { "gr", "<cmd>Glance references<cr>", desc = "Goto References" }
|
||||||
keys[#keys + 1] = { "gy", false }
|
keys[#keys + 1] = { "gy", "<cmd>Glance type_definitions<cr>", desc = "Goto T[y]pe Definitions" }
|
||||||
keys[#keys + 1] = { "gI", false }
|
keys[#keys + 1] = { "gI", "<cmd>Glance implementations<cr>", desc = "Goto Implementations" }
|
||||||
end,
|
end,
|
||||||
cmd = { "Glance" },
|
},
|
||||||
opts = {
|
{
|
||||||
border = {
|
"dnlhc/glance.nvim",
|
||||||
enable = true,
|
cmd = { "Glance" },
|
||||||
},
|
event = "LspAttach",
|
||||||
use_trouble_qf = true,
|
opts = {
|
||||||
hooks = {
|
border = {
|
||||||
before_open = function(results, open, jump, method)
|
enable = true,
|
||||||
local uri = vim.uri_from_bufnr(0)
|
},
|
||||||
if #results == 1 then
|
use_trouble_qf = true,
|
||||||
local target_uri = results[1].uri or results[1].targetUri
|
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
|
if target_uri == uri then
|
||||||
jump(results[1])
|
jump(results[1])
|
||||||
|
else
|
||||||
|
open(results)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
open(results)
|
open(results)
|
||||||
end
|
end
|
||||||
else
|
end,
|
||||||
open(results)
|
},
|
||||||
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