garbas/vim-snipmate — pull request #77 by jasonsydes (2012-01-07 22:05:27+00:00)
Title: Added better docs on setting scope_aliases.

This pull request updates the documentation on g:scope_aliases.

It turns out it's really easy to be able to add the ruby.snippets and ruby-rails.snippets for any file with filetype='ruby'. However, the snipMate documentation on that is not at all clear, and in fact is very misleading.

I spent an embarrassing amount of time trying to figure out how to accomplish this simple chore. I nearly did something like the following:

```vim
let g:snipMateSources['ruby'] = funcref#Function('jasonSnipMate#doubleRuby')

fun! jasonSnipMate#doubleRuby(scopes, trigger, result)
new_scopes = ['ruby', 'ruby-rails']
snipMate#DefaultPool(new_scopes, a:trigger, a:result)
endf
```

which I believe would've worked. Obviously, to those who wrote snipMate, there is a much easier way.

In this pull request, I've updated the snipMate docs to indicate that the easy and proper way of adding multiple snippets files for a single filetype should be done via g:scope_aliases.

It seems that using the dotted filetype approach for adding multiple snippets files causes problems. For me, some (not all) of the syntax highlighting disappeared when I set filetype='ruby.ruby-rails'. Perhaps this is an issue with the rails.vim plugin I'm using. I don't know. Others have also reported weird syntax highlighting issues when using the filetype technique (see [1] and [2] below).

The old way of adding multiple snippets (i.e. calling ExtractSnipsFile()) appears to have been removed from the garbas forked version of snipMate (but still appears in the original msanders snipMate I believe) (see [3] below).

Other people are apparently having problems trying to work with scope_aliases as well. See Issue #74.

The ability to add multiple snippet scopes for a single filetype seems to me to be a critical functionality of snipMate. It should be well documented.

Thanks for writing and maintaining snipMate!!

[1] http://stackoverflow.com/a/4488907/825457
[2] http://stackoverflow.com/a/5343833/825457
[3] http://stackoverflow.com/a/6917150/825457