'!' seems not to override the default 'ns' snippet

Bug #1179630 reported by Chip Hogg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UltiSnips
Fix Committed
Undecided
Unassigned

Bug Description

My understanding is that the '!' option instructs UltiSnips to override all previously defined snippets with the same abbreviation. However, when I tried to override the default 'ns' snippet, I got prompted to choose between mine and the default. Instead, I want it to choose mine outright.

The output of :py import sys; print sys.version:
2.7.3 (default, Aug 1 2012, 05:25:23)
[GCC 4.6.3]

Snippet definition that makes problems:
https://github.com/chiphogg/dotfiles/commit/dc56d1

Your input (keystroke for keystroke):
ns<c-j>
(NOTE: <c-j> is my keystroke to expand a snippet.)

The expected output:
I expect my snippet to be expanded immediately.

The actual output:
The following prompt:
1: (ns) "namespace"
2: (ns) "namespace .. (namespace)"
Type number and <Enter> or click with mouse (empty cancels):

NOTE: the first option is my snippet; the second is the default one. I want it to use the first without prompting.

description: updated
Revision history for this message
SirVer (sirver) wrote :

https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt#L333

the default is to traverse your search path from back to front - this is because the order directorys are added are different for vundle than for pathogen and pathogen was more popular back then. Now we are stuck with an odd default, sorry for that.

Changed in ultisnips:
status: New → Invalid
Revision history for this message
Chip Hogg (charles-r-hogg) wrote :

Works like a charm!

Is there an installation guide somewhere? Perhaps the github README.md should have a section for installing with Vundle. As far as I can see, everybody using Vundle would want this setting (i.e., let g:UltiSnipsDontReverseSearchPath=1).

Revision history for this message
SirVer (sirver) wrote :

There is a section about this in the docs:
https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt#L124

Feel free to provide patches, links from the readme or whatever would have helped you to find this. Truth is that most users will not read installation instructions and just default to the routine they know from their plugin manager. Generally speaking it would be better to try to come up with an automatic way to figure out in which direction the runtimepath should be traversed and remove the option. Any ideas? :)

Revision history for this message
Brian Mock (mock-brian) wrote :

@SirVer, do you think it would be reasonable to just sniff for the existence of Vundle and automatically apply this option?

Checking for one of Vundle's global variables, or for a few of its core functions would be sufficient, I think. I don't know much about VimL, but I'd be willing to learn enough to patch this behavior.

Revision history for this message
SirVer (sirver) wrote :

@Brian: I'd much rather have a heuristic that looks al runtimepath and where your home dir appears in it. That would be more general than just 'fixing' this for vundle - there are more plugin managers for vim out there than I like to count and people managing their rtp manually should also benefit from a good solution.

A patch for this would be most welcome - I think you can put that into the python code too - it does not need to be viml.

Revision history for this message
Brian Mock (mock-brian) wrote :

@SirVer, I made a branch to address the automatic detection of search order in UltiSnips and submitted a pull request for review.

https://github.com/SirVer/ultisnips/pull/118

SirVer (sirver)
Changed in ultisnips:
status: Invalid → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.