UltiSnipsEdit opens the wrong snippet file for 'javascript' filetype

Asked by Austin York

First of all, I love UltiSnips. It is my go-to snippet system in Vim, and I greatly appreciate the attention-to-detail that has gone into its design and architecture.

That being said, I'm currently having an issue with the 'javascript' filetype in which the UltiSnipsEdit command takes me to ~/.vim/bundle/ultisnips/UltiSnips/javascript_jasmine.snippets file rather than the more sensible ~/.vim/UltiSnips/javascript.snippets file.

I actually haven't created any javascript snippets yet, so I found this somewhat surprising. (FWIW, I'm using the latest version of UltiSnips as of 10/31/2013).

I've attempted to remedy the situation via the command 'UltiSnipsAddFiletypes javascript' to no avail.

What is the best way to remedy this situation?

Question information

Language:
English Edit question
Status:
Solved
For:
UltiSnips Edit question
Assignee:
No assignee Edit question
Solved by:
Austin York
Solved:
Last query:
Last reply:
Revision history for this message
SirVer (sirver) said :
#1
Revision history for this message
Austin York (ayork123123) said :
#2

Thanks for your prompt reply. I just tried setting this option, but UltiSnipsEdit still takes me to ~/.vim/bundle/ultisnips/UltiSnips/javascript_jasmine.snippets

Revision history for this message
SirVer (sirver) said :
#3

Okay, can you try to

 $ touch ~/.vim/UltiSnips/javascript.snippets

and see if the command opens the correct file now? There is some heuristics in the code that prefers existing files over non existing ones and maybe this bites us here.

Revision history for this message
Austin York (ayork123123) said :
#4

Hmm... Tried it, but still same result :-/

Revision history for this message
Austin York (ayork123123) said :
#5

Just tried :let b:UltiSnipsSnippetDirectories=["~/.vim/UltiSnips/", "~/.vim/bundle/ultisnips/UltiSnips"], which appears to work.

I thought this was the default behavior anyway?

Revision history for this message
SirVer (sirver) said :
#6

apparently not :). Glad you found a solution that works for you.

Revision history for this message
Austin York (ayork123123) said :
#7

Oddly though, when I add

let g:UltiSnipsSnippetDirectories=["~/.vim/UltiSnips/", "~/.vim/bundle/ultisnips/UltiSnips"]

...to my .vimrc, it throws the following error:

Error detected while processing function UltiSnipsEdit:
line 6:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "~/.vim/bundle/ultisnips/plugin/UltiSnips/__init__.py", line 1025, in file_to_edit
os.mkdir(path)
OSError: [Errno 2] No such file or directory: '~/.vim/~/.vim/bundle/ultisnips/UltiSnips'
line 16:
E121: Undefined variable: file
E15: Invalid expression: ':'.mode.' '.file

And

let g:UltiSnipsSnippetDirectories=["UltiSnips/", "bundle/ultisnips/UltiSnips/"]

...neither throws an error nor changes the unexpected behavior.

My band-aid for now is to simply add :let b:UltiSnipsSnippetDirectories=["~/.vim/UltiSnips/", "~/.vim/bundle/ultisnips/UltiSnips"] to my keybinding for UltiSnipsEdit, which does the trick.