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

Custom snippets overwritten by default from vim-snippets #828

Closed
0x62ash opened this issue Feb 24, 2017 · 13 comments
Closed

Custom snippets overwritten by default from vim-snippets #828

0x62ash opened this issue Feb 24, 2017 · 13 comments

Comments

@0x62ash
Copy link

0x62ash commented Feb 24, 2017

Hello,
I have several personal snippets located at ~.vim/after/snippets/perl.snippets, but not all of them available for expand. Some of them is overwritten by /Users/bash/.vim/bundle/vim-snippets/UltiSnips/perl.snippets. This looks wrong according to: For example, all shipped snippets have a priority < 0, so that user defined snippets always overwrite shipped snippets.

@polyzen
Copy link

polyzen commented Feb 24, 2017

@0x62ash
Copy link
Author

0x62ash commented Feb 24, 2017

Im not really understand how it is relevant.
My snippets is loaded and some of them (with unique names) is working without problem.
This is means that my snippet file under search path.

@polyzen
Copy link

polyzen commented Feb 25, 2017

snippets/ is used for SnipMate snippet files. UltiSnips snippets go in UltiSnips/.

Edit:
Sorry, I meant to add that if you're using an UltiSnips file, placing it in g:UltiSnipsSnippetDirectories/.vim/UltiSnips/ should be the way to override the vendored Ultisnips snippets.

UltiSnips uses the snippets under snippets/ as well, but are overriden by those in UltiSnips/.

It's explained in the help file, though I could be muddying the details as I'm new to UltiSnips. ^^

@0x62ash
Copy link
Author

0x62ash commented Feb 26, 2017

Im new too. Could you point me exactly where documentations says that UltiSnips will overwrite snippets under snippets/ directory?

Im using vim locally and on remote servers, where vim without python. So having universal config that will work with snipMate and UltiSnips is preferable.

@polyzen
Copy link

polyzen commented Feb 27, 2017

I don't see it mentioned in UltiSnips.txt, but it's described in the vim-snippets readme (at the bottom of this section and the linked discussion).

Suppose you'll have to use unique names for the rest of the SnipMate snippets you don't want overridden.

(Referencing honza/vim-snippets/issues/363)

@0x62ash
Copy link
Author

0x62ash commented Feb 27, 2017

Thank you. Didn't expect that this behaviour is defined in snippets collection bundle.

rubdos pushed a commit to rubdos/ultisnips that referenced this issue Oct 21, 2017
Doxygen subroutine documentation snippet for fortran.
@pazz
Copy link

pazz commented Jan 21, 2022

Guys, could you tell me how you resolved the issue to overwrite individual snippets locally?
I have re-defined the snippet I don't like in a file under ~.vim/UltiSnips/ and have also tried giving it a new name:

snippet im "MY Inline Math" w
$${1}$
endsnippet

I have also tried putting this file into ~/.vim/after/UltiSnips but still get the original behaviour (defined in .vim/bundle/vim-snippets/UltiSnips/tex.snippets). Any insights? Thanks!
honza/vim-snippets#1396 (comment)

@hl037
Copy link
Contributor

hl037 commented Jan 21, 2022

priority (see doc) does not work ?

@pazz
Copy link

pazz commented Jan 21, 2022

I wasn't aware, thanks. But I still see the same behaviour after adding this line to the top of my personal snippet file:

priority 1

@hl037
Copy link
Contributor

hl037 commented Jan 21, 2022

I have re-defined the snippet I don't like in a file under ~.vim/UltiSnips/
I have also tried putting this file into ~/.vim/after/UltiSnips

For Ultisnips to find your file, you need to have the parent inside runtime path, and the directory name listed inside g:UltiSnipsSnippetDirectories, you may check that.

You may also define a new template to first check UltiSnips find your file.

If it is found, you can try to increase the priority to 10 instead of 1... but since the repo you are referencing does not seem to override the priority, it's unlikely to help. In this case, it could be a bug, you can then define a snippet with a break point to inspect if the snippet has been loaded : https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips-advanced.txt

As last resort, there is also the clearsnippets <trigger> that can be used

(...Note that I can't find a snippet im inside https://github.com/honza/vim-snippets/blob/master/UltiSnips/tex.snippets )

@hl037
Copy link
Contributor

hl037 commented Jan 21, 2022

Oh, actually, it's not redefinition, since it's another trigger...

Then it's much more likely your file is not found by ultisnips. Check your runtimepath

@pazz
Copy link

pazz commented Jan 21, 2022

It seems that g:UltiSnipsSnippetDirectories is set to ['UltiSnips']. So I suspect that this is relative to my vim dir
and so expect the file ~/.vim/UltiSnips/tex.snippets to be loaded.

Changing the priority to 10 does not change anything for me.

I don't quite understand how to use clearsnippet. Would that not have to be placed in a snippet file, and so not help in my case if my file is not read?

The snippet in line 216 used to be snippet im..

@hl037
Copy link
Contributor

hl037 commented Jan 21, 2022

check your runtimepath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants