Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added better docs on setting scope_aliases. #77

Merged
merged 2 commits into from Jan 7, 2012

Conversation

Projects
None yet
3 participants

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:

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

MarcWeber added a commit that referenced this pull request Jan 7, 2012

Merge pull request #77 from jasonsydes/doc_scope_aliases
Added better docs on setting scope_aliases.

@MarcWeber MarcWeber merged commit db244df into garbas:master Jan 7, 2012

Thanks Marc!!

jasonsydes, MarcWeber thank you both :) you really help me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment