15

I use rails.vim but would like to override one or two snippets with my own using ultisnips.

I've created the snippets but since they're already defined by rails.vim a menu now appears when triggered. I'd like my snippets to override the existing one to avoid the menu.

Zubin
  • 9,422
  • 7
  • 48
  • 52
  • Are you sure those snippets are defined by rails.vim? The only mention of snippets I see in the code is [this line](https://github.com/tpope/vim-rails/blob/master/autoload/rails.vim#L4611) which enables every "rails" snippet UltiSnips will find. Maybe you should remove the default rails snippets from Honza's library? – romainl Oct 03 '14 at 07:00
  • @romainl You're right - they're defined in `~/.vim/bundle/snippets.vim/snippets/ruby.snippets`. I'd like to selectively disable ones I override. Do you know of an easy way to achieve this? (I'd rather avoid editing/forking snippets.vim if I can help it). – Zubin Oct 07 '14 at 11:25
  • No, I have no experience with UltiSnips or even the forked SnipMate but what is the point of a personal configuration is you refuse to personalize it? – romainl Oct 07 '14 at 12:24
  • @romainl You're misunderstanding me: I've added my own custom snippets. The problem is when I go to use some of them I'm getting a menu to choose between mine and some others with the same tab trigger. I want to override this behaviour so mine are used by default (ie no menu). I'd rather not edit or fork snippets.vim because I'd like to pull updates without added maintenance. I appreciate your input, but I suspect someone with ultisnips knowledge will be better placed to answer my question. – Zubin Oct 07 '14 at 21:38
  • Yeah, or someone who read the documentation, as always. – romainl Oct 08 '14 at 06:35

1 Answers1

19

The solution is to use priority directive. All snippets default to a priority of 0. Therefore, adding this to the top of my custom snippets solved the issue:

# top of custom snippets file
priority 1
Zubin
  • 9,422
  • 7
  • 48
  • 52