What's the canonical way to create xhtml snippets?

Asked by Adam Monsen

When I edit a file that Vim detects to be xhtml, I don't get to use any of the html snippets. To workaround this, I went into my working copy of ultisnips ( $HOME/.vim/ultisnips_rep/UltiSnips ) and symlinked xhtml.snippets to html.snippets.

$ ln -s html.snippets xhtml.snippets

Since I have some html snippet overrides, I made a similar symlink in $HOME/.vim/UltiSnips.

Kinda works, except in certain cases... now, when I edit a file that Vim detects at html (for instance, a blank file called "x.html") every snippet seems to be doubly defined.

Am I doing overriding or xhtml snippets incorrectly? Here's what I want:
* the ability to use all html snippets, plus a few customizations of my own
* to use this same set of snippets when editing files with filetype=xhtml

Question information

Language:
English Edit question
Status:
Solved
For:
UltiSnips Edit question
Assignee:
No assignee Edit question
Solved by:
SirVer
Solved:
Last query:
Last reply:
Revision history for this message
Adam Monsen (meonkeys) said :
#1

I figured out a partial workaround:

1. delete the symlinks (see question)
2. add custom snippets to $HOME/.vim/UltiSnips/html.snippets
3. create $HOME/.vim/UltiSnips/xhtml.snippets with one line: "extends html"

Although, now :UltiSnipsEdit doesn't work... I mean, I'd expect it to open my $HOME/.vim/UltiSnips/html.snippets or $HOME/.vim/UltiSnips/html.snippets, but instead it opens $HOME/.vim/ultisnips_rep/UltiSnips/html.snippets or $HOME/.vim/ultisnips_rep/UltiSnips/xhtml.snippets (the latter doesn't exist, btw).

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

The extends keyword is exactly what you want to use. About the misbehaviour see bug https://bugs.launchpad.net/ultisnips/+bug/748433.

Another alternative is to use vims dotted filetype syntax, so for example if you use
set ft=html.xhtml

ultisnips will load both and also vim will run all ftplugins for html and xhtml.

The extends keyword is cleaner though, imho.

Revision history for this message
Adam Monsen (meonkeys) said :
#3

Thanks SirVer, that solved my question.