feat: re-add snippets
This commit is contained in:
parent
b3102f091f
commit
a373856ad5
4 changed files with 337 additions and 14 deletions
|
|
@ -1,14 +1,72 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false, -- last release is way too old
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
return {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
format = function(_, item)
|
||||
local icons = require("lazyvim.config").icons.kinds
|
||||
if icons[item.kind] then
|
||||
item.kind = icons[item.kind] .. item.kind
|
||||
end
|
||||
return item
|
||||
end,
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "LspCodeLens",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local format_kinds = opts.formatting.format
|
||||
opts.formatting.format = function(entry, item)
|
||||
format_kinds(entry, item)
|
||||
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
|
||||
end
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })
|
||||
end,
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local format_kinds = opts.formatting.format
|
||||
opts.formatting.format = function(entry, item)
|
||||
format_kinds(entry, item)
|
||||
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue