- Merged.

This commit is contained in:
Shougo Matsushita 2012-10-26 10:48:41 +09:00
commit e24b6baeb9
4 changed files with 21 additions and 8 deletions

View File

@ -549,6 +549,11 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
\ '<|\1|>', 'g') \ '<|\1|>', 'g')
" Insert snippets. " Insert snippets.
if has('folding')
let foldmethod = &l:foldmethod
let &l:foldmethod = 'manual'
endif
let next_line = getline('.')[a:col-1 :] let next_line = getline('.')[a:col-1 :]
let snippet_lines = split(snip_word, '\n', 1) let snippet_lines = split(snip_word, '\n', 1)
if empty(snippet_lines) if empty(snippet_lines)
@ -581,16 +586,17 @@ function! neosnippet#expand(cur_text, col, trigger_name)"{{{
\ 'holder_cnt' : 1, \ 'holder_cnt' : 1,
\ }) \ })
if has('folding') && foldclosed(line('.'))
" Open fold.
silent! normal! zO
endif
if next_col < col('$') if next_col < col('$')
startinsert startinsert
else else
startinsert! startinsert!
endif endif
if has('folding')
let &l:foldmethod = foldmethod
silent execute begin_line . ',' . end_line . 'foldopen!'
endif
if snip_word =~ s:get_placeholder_marker_pattern() if snip_word =~ s:get_placeholder_marker_pattern()
call s:snippets_jump(a:cur_text, a:col) call s:snippets_jump(a:cur_text, a:col)
endif endif

View File

@ -6,7 +6,7 @@ options head
snippet function snippet function
alias func alias func
options word options head
function ${1:function_name}(${2:argument}) { function ${1:function_name}(${2:argument}) {
${0:// body...} ${0:// body...}
} }
@ -19,7 +19,7 @@ options head
snippet f snippet f
options head options word
function(${1}) { ${0:$TM_SELECTED_TEXT} }; function(${1}) { ${0:$TM_SELECTED_TEXT} };
snippet if snippet if

View File

@ -1,27 +1,32 @@
# lua's indent plugin doesn't work well partly with markers. Use hard-tab for some of this snippet. # lua's indent plugin doesn't work well partly with markers. Use hard-tab for some of this snippet.
snippet func snippet func
alias function alias function name(args)...end
options word
function ${1:function_name}(${2:argument}) function ${1:function_name}(${2:argument})
${0:// body...} ${0:// body...}
end end
snippet if snippet if
options head
if (${1:true}) then if (${1:true}) then
${0:$TM_SELECTED_TEXT} ${0:$TM_SELECTED_TEXT}
end end
snippet for snippet for
options head
for ${2:i} = 0, ${1:Things} do for ${2:i} = 0, ${1:Things} do
${0} ${0}
end end
snippet forin snippet forin
options head
for ${2:k}, ${3:v} in ${1:ipairs(xs)} do for ${2:k}, ${3:v} in ${1:ipairs(xs)} do
${0} ${0}
end end
snippet print_table snippet print_table
options head
abbr for k, v in ipairs(table) do abbr for k, v in ipairs(table) do
for (k, v) in ipairs(${1:table}) do for k, v in ipairs(${1:table}) do
print(k, v) print(k, v)
end end

View File

@ -4,6 +4,7 @@ abbr vital#of('...')
snippet vital_of snippet vital_of
abbr let s:V = vital#of('...') abbr let s:V = vital#of('...')
options head
let ${1:s:V} = vital#of('${2:vital}') let ${1:s:V} = vital#of('${2:vital}')
snippet vital_import_without_let snippet vital_import_without_let
@ -21,6 +22,7 @@ abbr s:V.load('...')
snippet vital_load snippet vital_load
abbr call s:V.load('...') abbr call s:V.load('...')
options head
call ${1:s:V}.load('${2:Module}') call ${1:s:V}.load('${2:Module}')
# FAQ # FAQ