spacevim/bundle/neosnippet-snippets/neosnippets/vim.snip
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

225 lines
4.2 KiB
Plaintext

snippet if
abbr if endif
options head
if ${1:#:condition}
${0:TARGET}
endif
snippet elseif
options head
elseif ${1:#:condition}
${0:TARGET}
snippet ifelse
abbr if else endif
options head
if ${1:#:condition}
${2:TARGET}
else
${3}
endif
snippet for
abbr for in endfor
options head
for ${1:#:var} in ${2:#:list}
${0:TARGET}
endfor
snippet while
abbr while endwhile
options head
while ${1:#:condition}
${0:TARGET}
endwhile
snippet function
abbr func endfunc
alias func
options head
function! ${1:#:func_name}(${2}) abort
${0:TARGET}
endfunction
snippet try
abbr try endtry
options head
try
${1:TARGET}
catch /${2:#:pattern}/
${3}
endtry
snippet tryfinally
abbr try ... finally ... endtry
alias tryf
options head
try
${1:TARGET}
finally
${2}
endtry
snippet catch
abbr catch /pattern/
options head
catch ${1:/${2:#:pattern: empty, E484, Vim(cmdname):{errmsg\\}\}/}
snippet echomsg
alias log
options head
echomsg string(${1:TARGET})
snippet command
abbr command call function
options head
command! ${1:#:command_name} call ${2:#:func_name}
snippet customlist
abbr customlist complete function
options head
function! ${1:#:func_name}(arglead, cmdline, cursorpos) abort
return filter(${2:#:list}, 'stridx(v:val, a:arglead) == 0')
endfunction
snippet augroup
abbr augroup with autocmds
options head
augroup ${1:#:augroup_name}
autocmd!
autocmd ${2:#:event}
augroup END
snippet redir
abbr redir => var
options head
redir => ${1:#:var}
${2::TARGET}
redir END
snippet NeoBundle
alias neobundle
abbr NeoBundle ''
NeoBundle '`getreg('+')=='' ? '<\`0\`>' : getreg('+')`'${0}
snippet NeoBundleLazy
alias neobundlelazy
abbr NeoBundleLazy ''
NeoBundleLazy '`getreg('+')=='' ? '<\`0\`>' : getreg('+')`', {
\ ${0}
\ }
snippet bundle_hooks
abbr neobundle hooks
let s:hooks = neobundle#get_hooks('${1}')
function! s:hooks.on_source(bundle) abort
${0}
endfunction
unlet s:hooks
snippet autoload
abbr autoload func endfunc
alias afunction afunc
options head
function! `substitute(matchstr(neosnippet#util#expand('%:p:r'), '/autoload/\zs.*$'), '/', '#', 'g')`#${1:#:func_name}(${2:#:args}) abort
${0}
endfunction
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<...}
\'
snippet python
alias py
options head
abbr python <<EOF | EOF
python << EOF
${0}
EOF
snippet python3
alias py3
options head
abbr python3 <<EOF | EOF
python3 << EOF
${0}
EOF
snippet lua
options head
abbr lua <<EOF | EOF
lua << EOF
${0}
EOF
snippet save_pos
options head
abbr use pos save
let pos_save = getpos('.')
try
${0}
finally
call setpos('.', pos_save)
endtry
snippet save_register
options head
abbr use register save
let save_reg_$1 = getreg('${1}')
let save_regtype_$1 = getregtype('$1')
try
${0}
finally
call setreg('$1', save_reg_$1, save_regtype_$1)
endtry
snippet save_option
options head
abbr use option save
let $1_save = &${1}
let &$1 = ${2}
try
${0}
finally
let &$1 = $1_save
endtry
snippet p
abbr debug-echomsg
options head
echomsg string([${0:TARGET}])
snippet version
abbr vim-version-check
v:version > ${1} || (v:version == $1 && has('patch${2}'))
snippet version_new
abbr vim-version-check-new
has('patch-${1}')