- Added vim snippets.

This commit is contained in:
Shougo Matsushita 2013-02-01 11:47:59 +09:00
parent 27274a32a4
commit d8605ea946
2 changed files with 59 additions and 15 deletions

View File

@ -2,7 +2,7 @@ snippet if
abbr if endif abbr if endif
options head options head
if ${1:#:condition} if ${1:#:condition}
${0:TARGET} ${0:TARGET}
endif endif
snippet elseif snippet elseif
@ -14,23 +14,23 @@ snippet ifelse
abbr if else endif abbr if else endif
options head options head
if ${1:#:condition} if ${1:#:condition}
${2:TARGET} ${2:TARGET}
else else
${3} ${3}
endif endif
snippet for snippet for
abbr for in endfor abbr for in endfor
options head options head
for ${1:#:var} in ${2:#:list} for ${1:#:var} in ${2:#:list}
${0:TARGET} ${0:TARGET}
endfor endfor
snippet while snippet while
abbr while endwhile abbr while endwhile
options head options head
while ${1:#:condition} while ${1:#:condition}
${0:TARGET} ${0:TARGET}
endwhile endwhile
snippet function snippet function
@ -38,16 +38,16 @@ abbr func endfunc
alias func alias func
options head options head
function! ${1:#:func_name}(${2}) function! ${1:#:func_name}(${2})
${0:TARGET} ${0:TARGET}
endfunction endfunction
snippet try snippet try
abbr try endtry abbr try endtry
options head options head
try try
${1:TARGET} ${1:TARGET}
catch /${2:#:pattern}/ catch /${2:#:pattern}/
${3} ${3}
endtry endtry
snippet tryfinally snippet tryfinally
@ -55,9 +55,9 @@ abbr try ... finally ... endtry
alias tryf alias tryf
options head options head
try try
${1:TARGET} ${1:TARGET}
finally finally
${2} ${2}
endtry endtry
snippet catch snippet catch
@ -78,15 +78,15 @@ snippet customlist
abbr customlist complete function abbr customlist complete function
options head options head
function! ${1:#:func_name}(arglead, cmdline, cursorpos) function! ${1:#:func_name}(arglead, cmdline, cursorpos)
return filter(${2:#:list}, 'stridx(v:val, a:arglead) == 0') return filter(${2:#:list}, 'stridx(v:val, a:arglead) == 0')
endfunction endfunction
snippet augroup snippet augroup
abbr augroup with autocmds abbr augroup with autocmds
options head options head
augroup ${1:#:augroup_name} augroup ${1:#:augroup_name}
autocmd! autocmd!
autocmd ${2:#:event} autocmd ${2:#:event}
augroup END augroup END
snippet redir snippet redir
@ -111,8 +111,49 @@ abbr NeoBundleLazy ''
snippet autoload snippet autoload
abbr autoload func endfunc abbr autoload func endfunc
alias afunction afunc alias afunction afunc
prev_word '^' options head
function! `substitute(matchstr(neosnippet#util#expand('%:p:r'), '/autoload/\zs.*$'), '/', '#', 'g')`#${1:#:func_name}(${2:#:args}) function! `substitute(matchstr(neosnippet#util#expand('%:p:r'), '/autoload/\zs.*$'), '/', '#', 'g')`#${1:#:func_name}(${2:#:args})
${0} ${0}
endfunction endfunction
snippet save_cpoptions
abbr let s:save_cpo = &cpo | set cpo&vim
alias s:save_cpo cpoptions
options head
let s:save_cpo = &cpo
set cpo&vim
${0}
let &cpo = s:save_cpo
unlet s:save_cpo
snippet g:loaded
abbr if exists('g:loaded_{plugin-name}')
alias loaded
options head
if exists('g:loaded_${1}')
finish
endif
${0}
let g:loaded_$1 = 1
snippet modeline
abbr " vim: {modeline}
" vim: ${0:foldmethod=marker}
snippet undo_ftplugin
abbr if !exists('b:undo_ftplugin')
alias b:undo_ftplugin
if !exists('b:undo_ftplugin')
let b:undo_ftplugin = ''
endif
${1}
let b:undo_ftplugin .= '
\ | setlocal ${2:#:option_name1< option_name2<...}
\'

View File

@ -718,6 +718,9 @@ A: Please try below settings. It defines snipMate function.
============================================================================== ==============================================================================
CHANGELOG *neosnippet-changelog* CHANGELOG *neosnippet-changelog*
2013-02-01
- Added vim snippets.
2013-01-30 2013-01-30
- Added autoload snippet in Vim snip. - Added autoload snippet in Vim snip.