diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua index 5688e6b..e754f21 100644 --- a/lua/custom/mappings.lua +++ b/lua/custom/mappings.lua @@ -419,4 +419,52 @@ M.ui = { }, } +M.goto_preview = { + plugin = true, + n = { + ["gpd"] = { + function() + require("goto-preview").goto_preview_definition() + end, + "go to definition preview", + noremap = true, + }, + ["gpD"] = { + function() + require("goto-preview").goto_preview_declaration() + end, + "go to declaration preview", + noremap = true, + }, + ["gpi"] = { + function() + require("goto-preview").goto_preview_implementation() + end, + "go to implementation preview", + noremap = true, + }, + ["gpt"] = { + function() + require("goto-preview").goto_preview_type_definition() + end, + "go to type preview", + noremap = true, + }, + ["gpr"] = { + function() + require("goto-preview").goto_preview_type_references() + end, + "go to references preview", + noremap = true, + }, + ["gpc"] = { + function() + require("goto-preview").close_all_win() + end, + "close previews", + noremap = true, + }, + }, +} + return M diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index 1ce888f..5af406e 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -443,6 +443,21 @@ local plugins = { "Bekaboo/deadcolumn.nvim", event = { "BufReadPre", "BufNewFile" }, }, + { + "rmagatti/goto-preview", + event = "FileType", + config = function() + require("core.utils").load_mappings "goto_preview" + require("goto-preview").setup {} + end, + dependencies = "nvim-telescope/telescope.nvim", + opts = { + width = 78, + height = 15, + default_mappings = false, + opacity = 10, + }, + }, } return plugins