Open monoira opened 2 months ago
@monoira The readme of nvim-scissors has an intro into how to use vscode snippets which you might find helpful: https://github.com/chrisgrieser/nvim-scissors?tab=readme-ov-file#example-for-the-vscode-style-snippet-format
I do need to spend some time adding/improving documentation. I'll try to find some time this weekend to start working on this.
not worked according README setting
@monoira and @Mr-LLLLL , you could take a look into my config, especially the snippet expansion and the config for nvim-snippets to make it works.
It should be pretty straightforward, even if I’m using a personal fork of friendly-snippets
.
The expansion should be this or equivalent with Lazy.nvim
{
"hrsh7th/nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" },
opts = function(_, o)
o.snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
}
-- other opts
}
and the config for nvim-snippets
similar to
{
"garymjr/nvim-snippets",
event = "InsertEnter",
-- this is for a custom fork of friendly-snippets located in `dev` folder (check Lazy.nvim for docs)
dependencies = { "kevinm6/snippets", dev = true },
opts = function(_, o)
o.extended_filetypes = {
typescript = { "javascript", "tsdoc” },
javascript = { "jsdoc” },
html = { "css", "javascript” },
lua = { "luadoc” },
python = { "python-docstring” },
java = { "javadoc", "java-testing” },
sh = { "shelldoc” },
php = { "phpdoc” },
ruby = { "rdoc” },
quarto = { "markdown” },
rmarkdown = { "markdown” },
}
-- location used to find `package.json` or snippets with valid file/folder structure
o.search_paths = { vim.env.HOME .. "/dev/snippets" }
-- other opts
}
@kevinm6 you can press Y on github to get a permanent link. Yours are 404 already after 14 hours :c
@kevinm6 you can press Y on github to get a permanent link. Yours are 404 already after 14 hours :c
I did, but I was on mobile and I pasted the wrong link..! Try now
Here is an usage example with fzf-lua (without nvim-cmp):
<c-x><c-e>
to trigger the picker:
https://github.com/garymjr/nvim-snippets/assets/8279858/f612dd95-5efc-403f-b36a-4612319d94cd
@monoira and @Mr-LLLLL , you could take a look into my config, especially the snippet expansion and the config for nvim-snippets to make it works.
It should be pretty straightforward, even if I’m using a personal fork of
friendly-snippets
.The expansion should be this or equivalent with
Lazy.nvim
{ "hrsh7th/nvim-cmp”, event = { "InsertEnter", "CmdlineEnter” }, opts = function(_, o) o.snippet = { expand = function(args) vim.snippet.expand(args.body) end, } -- other opts }
and the config for
nvim-snippets
similar to{ "garymjr/nvim-snippets”, event = “InsertEnter”, -- this is for a custom fork of friendly-snippets located in `dev` folder (check Lazy.nvim for docs) dependencies = { "kevinm6/snippets", dev = true }, opts = function(_, o) o.extended_filetypes = { typescript = { "javascript", "tsdoc” }, javascript = { "jsdoc” }, html = { "css", "javascript” }, lua = { "luadoc” }, python = { "python-docstring” }, java = { "javadoc", "java-testing” }, sh = { "shelldoc” }, php = { "phpdoc” }, ruby = { "rdoc” }, quarto = { "markdown” }, rmarkdown = { "markdown” }, } -- location used to find `package.json` or snippets with valid file/folder structure o.search_paths = { vim.env.HOME .. "/dev/snippets” } -- location used to find `package.json` or snippets with valid file/folder structure -- other opts }
thank you very much. it worked.
Does someone has an exemple on how to use this plugin with user defined snippets for Typescript ? Thank you.
setting up this plugin with custom vscode snippets is way too hard for me. documentation is way too small and not noobie-friendly.
I have to go back to luasnip until documentation becomes better.