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,3 +1,55 @@
local function gh(repo)
return "https://github.com/" .. repo
end
vim.api.nvim_create_autocmd("ModeChanged", {
once = true,
callback = function()
vim.pack.add({
gh("rafamadriz/friendly-snippets"),
{ src = gh("L3MON4D3/LuaSnip"), version = vim.version.range("2.x") },
{ src = gh("saghen/blink.cmp"), version = vim.version.range("1.x") },
gh("xzbdmw/colorful-menu.nvim"),
})
require("blink.cmp").setup({
keymap = { preset = "super-tab" },
appearance = {
nerd_font_variant = "mono",
},
completion = {
documentation = {
auto_show = false,
},
menu = {
draw = {
columns = { { "kind_icon" }, { "label", gap = 1 } },
components = {
label = {
text = function(ctx)
return require("colorful-menu").blink_components_text(ctx)
end,
highlight = function(ctx)
return require("colorful-menu").blink_components_highlight(ctx)
end,
},
},
},
},
},
snippets = {
preset = "luasnip",
active = function() return false end,
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
},
fuzzy = { implementation = "prefer_rust_with_warning" },
})
require("colorful-menu").setup({})
end,
})
local ls = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
ls.filetype_extend("typescriptreact", { "html" })
@ -6,38 +58,3 @@ ls.config.set_config({
enable_autosnippets = false,
store_selection_keys = false,
})
require("blink.cmp").setup({
keymap = { preset = "super-tab" },
appearance = {
nerd_font_variant = "mono",
},
completion = {
documentation = {
auto_show = false,
},
menu = {
draw = {
columns = { { "kind_icon" }, { "label", gap = 1 } },
components = {
label = {
text = function(ctx)
return require("colorful-menu").blink_components_text(ctx)
end,
highlight = function(ctx)
return require("colorful-menu").blink_components_highlight(ctx)
end,
},
},
},
},
},
snippets = {
preset = "luasnip",
active = function() return false end,
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
},
fuzzy = { implementation = "prefer_rust_with_warning" },
})