From bb9947901444ad0d6d269e72743f8406a5a60ec4 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Mon, 25 Nov 2024 18:02:20 +0100 Subject: [PATCH] feat: add lsp definition previewer --- lazy-lock.json | 2 +- lua/plugins.lua | 5 +++++ lua/which-key-config.lua | 9 ++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index a1592c5..43da64a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -12,8 +12,8 @@ "dressing.nvim": { "branch": "master", "commit": "6ef1ca479d37d4ff66f13eed44d08912caff483a" }, "formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" }, "gitsigns.nvim": { "branch": "main", "commit": "4daf7022f1481edf1e8fb9947df13bb07c18e89a" }, + "goto-preview": { "branch": "main", "commit": "8a671ae123532bd7a8393ed2b1475bb40baf968f" }, "incline.nvim": { "branch": "main", "commit": "16fc9c073e3ea4175b66ad94375df6d73fc114c0" }, - "inlay-hint.nvim": { "branch": "main", "commit": "eb5f0579537db271dfedd7f38460cdacb238176f" }, "lazy.nvim": { "branch": "main", "commit": "b1134ab82ee4279e31f7ddf7e34b2a99eb9b7bc9" }, "lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" }, "lsp-zero.nvim": { "branch": "v4.x", "commit": "19a8b90340c6c522219c84f7befe784d657ab28e" }, diff --git a/lua/plugins.lua b/lua/plugins.lua index 9a328a3..852fdfb 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -15,6 +15,11 @@ vim.opt.rtp:prepend(lazypath) require("lazy").setup({ --: Behaviour {{{ + { + "rmagatti/goto-preview", + event = "BufEnter", + config = true, -- necessary as per https://github.com/rmagatti/goto-preview/issues/88 + }, { "folke/lazydev.nvim", ft = "lua", diff --git a/lua/which-key-config.lua b/lua/which-key-config.lua index 6789d19..8844ad4 100644 --- a/lua/which-key-config.lua +++ b/lua/which-key-config.lua @@ -4,6 +4,7 @@ wk.add({ { "bt", "BlameToggle virtual", desc = "Toggle Virtual Blame" }, { "c", desc = "NerdCommenter" }, { "f", desc = "Telescope - Finder" }, + { "fb", "Telescope buffers", desc = "Find Open Buffers" }, { "ff", require("telescope").extensions.file_browser.file_browser, desc = "Find File" }, { "fg", "Telescope live_grep", desc = "Live Grep" }, @@ -11,17 +12,23 @@ wk.add({ { "fi", "Telescope builtin", desc = "Search all Telescope builtins" }, { "ft", "TodoTelescope ", desc = "Open Todo in Telescope" }, { "fu", "UrlView", desc = "Display and open URLs in current buffer" }, + { "n", desc = "Terminal" }, { "nb", "lua _Lazygit_toggle()", desc = "Open Lazygit" }, { "nj", "ToggleTerm", desc = "Open Terminal" }, + { "r", "lua vim.lsp.buf.rename()", desc = "Rename a token" }, { "t1", "BufferGoto 1", desc = "Go to Buffer 1" }, { "td", "BufferClose", desc = "Close Current Buffer" }, + { "x", desc = "Toggle Trouble" }, { "xl", "Trouble loclist toggle", desc = "" }, { "xq", "Trouble quickfix toggle", desc = "" }, { "xr", "Trouble lsp_references toggle", desc = "" }, { "xx", "Trouble diagnostics toggle", desc = "Open Trouble" }, - { "tt", require("telescope").extensions.file_browser.file_browser, desc = "Open the file browser" }, + { "/", require("telescope.builtin").current_buffer_fuzzy_find, desc = "Search for a string in the current buffer" }, + + { "gpd", require("goto-preview").goto_preview_definition, desc = "Open definition preview" }, + { "gpt", require("goto-preview").goto_preview_type_definition, desc = "Open type definition preview" }, })