- Merged.
This commit is contained in:
parent
2fde49493b
commit
d305dde1cc
@ -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.*$')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user