-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve documentation with examples. #7
Comments
@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, It should be pretty straightforward, even if I’m using a personal fork of The expansion should be this or equivalent with {
"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 {
"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 |
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):
lsp-expand.mov |
thank you very much. it worked. |
Does someone has an exemple on how to use this plugin with user defined snippets for Typescript ? |
Documentation is still not good enough for this plugin to count as drop-in-replacement for luasnip for me. |
none-ls users can add such source: local none = require('null-ls')
local nvimSnippets = {
name = 'nvim_snippets',
method = none.methods.COMPLETION,
filetypes = {},
generator = {
fn = function (params, done)
local items = {}
local snips = require('snippets').get_loaded_snippets()
local targets = vim.tbl_filter(function (item)
return string.match(item.prefix, '^' .. params.word_to_complete)
end, snips)
for _, item in ipairs(targets) do
table.insert(items, {
label = item.prefix,
kind = vim.lsp.protocol.CompletionItemKind.Snippet,
insertTextFormat = vim.lsp.protocol.InsertTextFormat.Snippet,
detail = item.description,
insertText = (type(item.body) == 'table') and table.concat(item.body, '\n') or item.body,
insertTextMode = 2,
})
end
done({{items = items, isIncomplete = #items == 0}})
end,
async = true,
},
}
none.register(nvimSnippets) (based on vsnip source distributed with the plugin). |
I converted it into completion source nvimtools/none-ls.nvim#201 |
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.
The text was updated successfully, but these errors were encountered: