From d305dde1ccb1d97d53147522df7c2935432d0008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Sun, 28 Oct 2012 01:25:52 -0400 Subject: [PATCH] - Merged. --- autoload/neosnippet.vim | 10 ++++++++++ autoload/neosnippet/snippets/ruby.snip | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index 0c4834e..e968c16 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -344,8 +344,18 @@ function! s:load_snippets(snippet, snippets_file)"{{{ \ 'options' : { 'head' : 0, 'word' : 0 } } endif + " Try using the name without the description (abbr). let snippet_pattern.name = matchstr(line, '^snippet\s\+\zs\S\+') + " Fall back to using the name and description (abbr) combined. + " SnipMate snippets may have duplicate names, but different + " descriptions (abbrs). + if has_key(dup_check, snippet_pattern.name) + let snippet_pattern.name = + \ substitute(matchstr(line, '^snippet\s\+\zs.*$'), + \ '\s\+', '_', 'g') + endif + " Collect the description (abbr) of the snippet, if set on snippet line. " This is for compatibility with SnipMate-style snippets. let snippet_pattern.abbr = matchstr(line, '^snippet\s\+\S\+\s\+\zs.*$') diff --git a/autoload/neosnippet/snippets/ruby.snip b/autoload/neosnippet/snippets/ruby.snip index b4fac89..6fca0f9 100644 --- a/autoload/neosnippet/snippets/ruby.snip +++ b/autoload/neosnippet/snippets/ruby.snip @@ -10,8 +10,17 @@ abbr def end ${2} end +snippet defrescue +alias defr +abbr def ... rescue ... end + def ${1:method_name} + ${2} + rescue ${3:StandardError} => ${4:error} + ${5} + end + snippet do -abbr do end +abbr do ... end do ${1} end