-
-
Notifications
You must be signed in to change notification settings - Fork 384
conflict with Ultisnips #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is that every snippets plugin insists that file types are the only valid grouping for snippets. This leads to the bizarre creation of a "rails" pseudo-filetype. See #134 for my stance on that. That being said, if someone wants to go to the trouble of working around it in rails.vim, I won't object. Basically, you need to change conditionals like
to be like
Make sure you get all of them though. Start with a search for |
Thx Tim :) |
Tim, I am the author of UltiSnips. I am interested in a better way to group snippets beside filetypes to avoid this clutch. Do you have a suggestion? One could add a Vim Variable (a dictionary maybe) that rails.vim could set or modify and that ultisnips would understand - but this would be a specific hack for UltiSnips. Do you have a better suggestion? |
@SirVer I feel like the ideal solution is just a command that defines a snippet for the current buffer. Much like how abbreviations work. If you wanted to define an abbreviation for all Ruby files, you'd do
Doing it in in Rails projects, then, is a simple switch to a rails.vim autocommand:
I guess the problem here is that snippets tend to be multiple lines, and thus much harder to adapt to a Vim command syntax. Given this constraint, I feel like the best compromise solution is instead some sort of command to load a bundle of snippets into the current buffer independent of file type. That would enable a simple decoupling.
Hell, I'd have no objection to dispatching that from rails.vim automatically. Bonus orthogonal idea: ability to load from an arbitrary path. This would enable project specific snippets. For example:
|
Right, I added a bug report for this idea in the ultisnips bug tracker [1]. I think I prefer a buffer local variable, similar to a vim option - so it will be possible to also associate a priority order with the filetypes. Note that project specific snippets are already supported, but a naming convention must be followed [2]. Thanks for your ideas Tim! I will let you know when I have implemented this in UltiSnips. [1] https://bugs.launchpad.net/ultisnips/+bug/950033 |
Sounds good. I hope you'll consider a wrapper command though. If I do
I'll be potentially clobbering the user's preferences, and if I do
I'll be potentially duplicating |
I will keep this in mind. |
Tim, I just pushed this fix. There is now a new command defined in UltiSnips. I think vim-rails should call it like this :UltiSnipsAddFiletypes rails.ruby for each rails buffer. It will make sure that rails and ruby snippets are considered when expanding and rails snippets will have a higher priority (read: can overwrite) ruby snippets. Also, UltiSnipsEdit will open rails.snippets by default for editing. Would you mind adding this to rails.vim? |
I can give it a go. Surely I can just do Calling them |
|
Done and done. |
Cool, thanks Tim! |
Closes tpope#145.
This is like the UltiSnipsLoad command that came out of <tpope/vim-rails#145>
http://stackoverflow.com/questions/9556230/how-to-set-manualy-color-of-params-and-redirect-to-in-vim#comment12127893_9556230
My
filetype is ruby.rails
and when i cheange it toset filetype=ruby
syntax works.But then my ultisnips dont recognize rails snippets, how to compare this two things??
The text was updated successfully, but these errors were encountered: