Skip to content
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

Priority for snippets #4

Closed
pbogut opened this issue Sep 12, 2021 · 2 comments · Fixed by #57
Closed

Priority for snippets #4

pbogut opened this issue Sep 12, 2021 · 2 comments · Fixed by #57
Labels
enhancement New feature or request question Further information is requested

Comments

@pbogut
Copy link
Contributor

pbogut commented Sep 12, 2021

Is there a way to provide priority for shippets?

What I'm looking for is some way to override one (or more) snippet with my own while using honza/vim-snippets. In ultisnip you could set priority in the fist line of snippet file like this:

priority -50

snippet blah "blah"
...

Then snippets in file with lower priority would be expanded in case of name conflict. Is there a way to achieve that in snippy?

@dcampos
Copy link
Owner

dcampos commented Sep 13, 2021

@pbogut Thanks for trying out Snippy!

The feature you're looking for isn't currently available, but there is a workaround. If you put your custom snippets in after/snippets/, they should override any snippets provided by honza/vim-snippets in case of name conflict. That happens because Snippy follows the runtimepath order when loading snippets, which means snippets defined in folders coming later in the list will always override those loaded before.

@dcampos dcampos added enhancement New feature or request question Further information is requested labels Oct 20, 2021
@mg979 mg979 mentioned this issue Feb 6, 2022
@dcampos
Copy link
Owner

dcampos commented Apr 8, 2022

Snippet priority has been added to Snippy. The syntax is the same as in UltiSnips. Snippets with higher priority override those with lower priority (default is 0). Because snippets from honza/vim-snippets don't have a priority set, it's necessary to use a priority higher than 0 for your own snippets to override them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants