From c514d41a9484b88c1da49500d2e30cdbe797a727 Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Sun, 23 Jun 2024 18:29:46 -0700 Subject: [PATCH] Neovim: Add goto_preview plugin --- nvim/init.lua | 1 + nvim/lua/custom/plugins/goto-preview.lua | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 nvim/lua/custom/plugins/goto-preview.lua diff --git a/nvim/init.lua b/nvim/init.lua index 9ba1af6..abb2599 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -245,6 +245,7 @@ require('lazy').setup({ ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, ['x'] = { name = 'Trouble [X]', _ = 'which_key_ignore' }, + ['p'] = { name = '[P]review', _ = 'which_key_ignore' }, } -- visual mode require('which-key').register({ diff --git a/nvim/lua/custom/plugins/goto-preview.lua b/nvim/lua/custom/plugins/goto-preview.lua new file mode 100644 index 0000000..9773b03 --- /dev/null +++ b/nvim/lua/custom/plugins/goto-preview.lua @@ -0,0 +1,18 @@ +-- A small Neovim plugin for previewing native LSP's goto definition, type definition, +-- implementation, declaration and references calls in floating windows. +-- https://github.com/rmagatti/goto-preview +return { + 'rmagatti/goto-preview', + event = 'VeryLazy', + config = function() + require('goto-preview').setup() + end, + keys = { + { 'pd', 'lua require("goto-preview").goto_preview_definition()', desc = 'Definition' }, + { 'pt', 'lua require("goto-preview").goto_preview_type()', desc = 'Type' }, + { 'pi', 'lua require("goto-preview").goto_preview_implementation()', desc = 'Implementation' }, + { 'pD', 'lua require("goto-preview").goto_preview_declaration()', desc = 'Declaration' }, + { 'pr', 'lua require("goto-preview").goto_preview_references()', desc = 'References' }, + { 'pq', 'lua require("goto-preview").close_all_win()', desc = 'Close all' }, + }, +}