From a8740e1da220dc4d172df59fa7391d5b7d236943 Mon Sep 17 00:00:00 2001 From: chuyanlong Date: Sat, 18 Oct 2025 21:20:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/lazyvim/plugins/extras/editor/glance.lua | 55 +++++++++++++++++++ .../plugins/extras/editor/snacks_picker.lua | 2 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 lua/lazyvim/plugins/extras/editor/glance.lua diff --git a/lua/lazyvim/plugins/extras/editor/glance.lua b/lua/lazyvim/plugins/extras/editor/glance.lua new file mode 100644 index 00000000..98b24afd --- /dev/null +++ b/lua/lazyvim/plugins/extras/editor/glance.lua @@ -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 = { + [""] = actions.enter_win("preview"), -- Focus preview window + [""] = "", + [""] = actions.next, -- Next item + [""] = actions.previous, -- Previous item + }, + preview = { + ["q"] = actions.close, + [""] = actions.enter_win("list"), -- Focus preview window + [""] = "", + [""] = actions.preview_scroll_win(5), -- Scroll up the preview window + [""] = 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","glance definitions", desc = "Goto Definition", has = "definition" }, + { "gr", "Glance references", nowait = true, desc = "References" }, + { "gi", "Glance implementations", desc = "Goto Implementation" }, + { "gy", "Glance type_definitions",desc = "Goto T[y]pe Definition" }, + }) + end, + }, +} diff --git a/lua/lazyvim/plugins/extras/editor/snacks_picker.lua b/lua/lazyvim/plugins/extras/editor/snacks_picker.lua index b0b7b95b..72fd73fc 100644 --- a/lua/lazyvim/plugins/extras/editor/snacks_picker.lua +++ b/lua/lazyvim/plugins/extras/editor/snacks_picker.lua @@ -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,