How would I wire this up to work in other file types, such as .mustache?
Same question here. I'm not managing to get it to work on filetype=htmldjango with Vim. Any clues? (on plain html works fine)
Ok, copying sparkup.py and sparkup.vim into a new folder ~/.vim/ftplugin/htmldjango worked around the issue. Sorry for the buzz...
Another thing that worked was to set the filetype for *.mustache to mustache.html
to avoid copying files you can create new ftplugin files for each file type like:
or you can add an auto command to your .vimrc file (simpler):
" Remove ALL autocommands of the current group.
" Add sparkup to new filetypes
autocmd FileType mustache,php,htmldjango runtime! ftplugin/html/sparkup.vim
I would fork the project and add the auto command to the sparkup plugin but I think this plugin was abandoned... (since the author isn't replying to any issue)
I tried the lines above but they cause recursive autocmd loops. Here's my solution in .vimrc
au FileType html set ft=htmldjango # sparkup is already loaded here due to the initial html filetype,
# all we need now is the htmldjango (or htmljinja) syntax highlighting
au FileType htmldjango runtime! ftplugin/html/sparkup.vim # load sparkup if vim decides that the file is htmldjango
@kitmonisit by using augroup and clearing the group before adding new commands (autocmd!) it is supposed to run the command only once when FileType matches one of the patterns, usually when you open the file or :set filetype=foo... - see: clearing groups
@millermedeiros Thanks for the resource! I pull my hair around Vim scripting :P
@millermedeiros Tried pasting your snippet in my .vimrc but it causes an error for me:
Error detected while processing /Users/rene/.vimrc:
E216: No such group or event: " Remove ALL autocommands for the current group.
Press ENTER or type command to continue
@rhardih try moving the comment to another line and/or deleting it, that might be the problem. (I just updated the snippet)
@millermedeiros Sweet, it was the comment. Works now.
hello, is it solved? sorry but, i have tried to write the code above at my _vimrc file but it didn't work in my *.tmpl file, anyone can help?
Is it possible for someone to create a PR with this behaviour? I think it would be useful for the general populace.
There's an approach in @MarcWeber's fork, where you have a configuration variable to list the filetypes.
#33 (comment) should work.
Another approach is to create a symlink in the sparkup/ftplugin directory (there are a few already; won't work on Windows).