fix keymaps, lazy load pass trying to reduce startup time, shaved ~35ms

This commit is contained in:
Martin Larsson 2026-04-12 02:31:00 +02:00
parent 8b38a13192
commit f5efed19c7
11 changed files with 295 additions and 218 deletions

View file

@ -1,21 +1,26 @@
vim.schedule(function()
vim.pack.add({
"https://github.com/rmagatti/logger.nvim",
"https://github.com/rmagatti/goto-preview",
})
local function gh(repo)
return "https://github.com/" .. repo
end
require("goto-preview").setup({
border = { "", "", "", "", "", "", "", "" },
focus_on_open = true,
stack_floating_preview_windows = false,
preview_window_title = { enable = true, position = "left" },
vim_ui_input = false,
})
vim.api.nvim_create_autocmd("LspAttach", {
once = true,
callback = function()
vim.pack.add({
gh("https://github.com/rmagatti/goto-preview"),
gh("rmagatti/logger.nvim")
})
require("goto-preview").setup({
border = { "", "", "", "", "", "", "", "" },
focus_on_open = true,
stack_floating_preview_windows = false,
preview_window_title = { enable = true, position = "left" },
vim_ui_input = false,
})
local utils = require("utils")
utils.set_keymap_list({
{ "gp", function() require("goto-preview").goto_preview_definition() end },
{ "gy", function() require("goto-preview").goto_preview_type_definition() end },
{ "<Leader>q", function() require("goto-preview").close_all_win() end },
})
end)
require("utils").set_keymap_list({
{ "gp", function() require("goto-preview").goto_preview_definition() end },
{ "gy", function() require("goto-preview").goto_preview_type_definition() end },
{ "<Leader>q", function() require("goto-preview").close_all_win() end },
})
end,
})