nvim: Extend snippet capability

Enabled snippet completion from the first letter (allowing single letter
snippet prefixes).
Extended the luasnip usage and added a telescope extension to show all
enabled snippets for the current buffer.
This commit is contained in:
Marty Oehme 2024-06-17 13:15:15 +02:00
parent a7aca62a15
commit 8dbfa2dd13
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
4 changed files with 206 additions and 5 deletions

View file

@ -3,6 +3,7 @@ return {
{
"hrsh7th/nvim-cmp",
branch = "main",
version = false,
dependencies = {
"andersevenrud/cmp-tmux",
"cbarrete/completion-vcard",
@ -19,11 +20,30 @@ return {
"kdheepak/cmp-latex-symbols",
"lukas-reineke/cmp-rg",
"crispgm/cmp-beancount",
"ray-x/cmp-treesitter",
"saadparwaiz1/cmp_luasnip",
{ "ray-x/cmp-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter" } },
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
"saadparwaiz1/cmp_luasnip",
dependencies = {
{
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
{
"benfowler/telescope-luasnip.nvim",
dependencies = { { "nvim-telescope/telescope.nvim", optional = true } },
config = function()
require("telescope").load_extension("luasnip")
end,
},
},
build = "make install_jsregexp",
config = function()
require("luasnip.loaders.from_vscode").lazy_load({ exclude = { "markdown", "quarto" } })
require("luasnip.loaders.from_snipmate").lazy_load()
end,
},
},
},
},
config = function()
@ -83,7 +103,7 @@ return {
{ name = "otter" },
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip", keyword_length = 2 },
{ name = "luasnip", keyword_length = 1 },
{ name = "pandoc_references" },
{ name = "calc" },
{ name = "path" },