优化 动作

This commit is contained in:
chuyanlong 2025-10-18 21:20:58 +08:00
parent b8b572c5dc
commit a8740e1da2
2 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,55 @@
return {
{
"dnlhc/glance.nvim",
cmd = "Glance",
opts = {
winbar = {
enable = false,
},
use_trouble_qf = true,
folds = {
fold_closed = "",
fold_open = "",
folded = true, -- Automatically fold list on startup
},
indent_lines = {
enable = true, -- Show indent guidelines
icon = "",
},
},
config = function(_, opts)
local glance = require("glance")
local actions = glance.actions
require("glance").setup(vim.tbl_extend("force", opts, {
mappings = {
list = {
["<C-h>"] = actions.enter_win("preview"), -- Focus preview window
["<C-l>"] = "",
["<C-j>"] = actions.next, -- Next item
["<C-k>"] = actions.previous, -- Previous item
},
preview = {
["q"] = actions.close,
["<C-l>"] = actions.enter_win("list"), -- Focus preview window
["<C-h>"] = "",
["<C-j>"] = actions.preview_scroll_win(5), -- Scroll up the preview window
["<C-k>"] = actions.preview_scroll_win(-5), -- Scroll down the preview window
},
},
}))
end,
},
{
"neovim/nvim-lspconfig",
opts = function()
local Keys = require("lazyvim.plugins.lsp.keymaps").get()
-- stylua: ignore
vim.list_extend(Keys, {
{ "gd","<cmd>glance definitions<cr>", desc = "Goto Definition", has = "definition" },
{ "gr", "<CMD>Glance references<CR>", nowait = true, desc = "References" },
{ "gi", "<CMD>Glance implementations<CR>", desc = "Goto Implementation" },
{ "gy", "<CMD>Glance type_definitions<CR>",desc = "Goto T[y]pe Definition" },
})
end,
},
}

View file

@ -113,7 +113,7 @@ return {
vim.list_extend(Keys, {
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition", has = "definition" },
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
{ "gi", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
})
end,