- Fixed initialization.

This commit is contained in:
Shougo Matsushita
2012-09-28 00:42:34 +09:00
parent a21c9ef22d
commit 2359481091
29 changed files with 940 additions and 889 deletions

View File

@@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippets_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 27 Sep 2012.
" Last Modified: 28 Sep 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -27,10 +27,6 @@
let s:save_cpo = &cpo
set cpo&vim
if !exists('s:snippets')
let s:snippets = {}
endif
let s:source = {
\ 'name' : 'snippets_complete',
\ 'kind' : 'plugin',
@@ -38,104 +34,8 @@ let s:source = {
function! s:source.initialize()"{{{
" Initialize.
let s:snippets = {}
let s:snippets_expand_stack = []
if !exists('g:neocomplcache_snippets_disable_runtime_snippets')
let g:neocomplcache_snippets_disable_runtime_snippets = 0
endif
call neocomplcache#set_dictionary_helper(
\ g:neocomplcache_source_rank, 'snippets_complete', 8)
let s:snippets_dir = []
let s:runtime_dir = split(globpath(&runtimepath,
\ 'autoload/neocomplcache/sources/snippets_complete'), '\n')
if !g:neocomplcache_snippets_disable_runtime_snippets
" Set snippets dir.
let s:snippets_dir += (exists('g:snippets_dir') ?
\ split(g:snippets_dir, '\s*,\s*')
\ : split(globpath(&runtimepath, 'snippets'), '\n'))
\ + s:runtime_dir
endif
if exists('g:neocomplcache_snippets_dir')
for dir in split(g:neocomplcache_snippets_dir, '\s*,\s*')
let dir = neocomplcache#util#expand(dir)
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
call add(s:snippets_dir, dir)
endfor
endif
call map(s:snippets_dir, 'substitute(v:val, "[\\\\/]$", "", "")')
augroup neocomplcache"{{{
" Set caching event.
autocmd FileType * call s:caching()
" Recaching events
autocmd BufWritePost *.snip,*.snippets call s:caching_snippets(expand('<afile>:t:r'))
augroup END"}}}
if has('conceal')
" Supported conceal features.
augroup neocomplcache
autocmd BufNewFile,BufRead,ColorScheme *
\ syn match neocomplcacheExpandSnippets
\ '<`\d\+:\|`>\|<{\d\+:\|}>' conceal
autocmd BufNewFile,BufRead,ColorScheme *
\ execute 'syn match neocomplcacheExpandSnippets'
\ '''<`\d\+\\\@<!`>\|<{\d\+\\\@<!}>\|'
\ .s:get_mirror_placeholder_marker_pattern()."'"
\ 'conceal cchar=$'
augroup END
else
augroup neocomplcache
autocmd BufNewFile,BufRead,ColorScheme *
\ execute 'syn match neocomplcacheExpandSnippets'
\ "'".s:get_placeholder_marker_pattern(). '\|'
\ .s:get_sync_placeholder_marker_pattern().'\|'
\ .s:get_mirror_placeholder_marker_pattern()."'"
augroup END
endif
hi def link NeoComplCacheExpandSnippets Special
command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
\ NeoComplCacheEditSnippets
\ call s:edit_snippets(<q-args>, 0)
command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
\ NeoComplCacheEditRuntimeSnippets
\ call s:edit_snippets(<q-args>, 1)
command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
\ NeoComplCacheCachingSnippets
\ call s:caching_snippets(<q-args>)
" Select mode mappings.
if !exists('g:neocomplcache_disable_select_mode_mappings')
snoremap <CR> a<BS>
snoremap <BS> a<BS>
snoremap <right> <ESC>a
snoremap <left> <ESC>bi
snoremap ' a<BS>'
snoremap ` a<BS>`
snoremap % a<BS>%
snoremap U a<BS>U
snoremap ^ a<BS>^
snoremap \ a<BS>\
snoremap <C-x> a<BS><c-x>
endif
" Caching _ snippets.
call s:caching_snippets('_')
" Initialize check.
call s:caching()
if neocomplcache#exists_echodoc()
call echodoc#register('snippets_complete', s:doc_dict)
endif
endfunction"}}}
function! s:source.finalize()"{{{
@@ -151,68 +51,26 @@ function! s:source.finalize()"{{{
endfunction"}}}
function! s:source.get_keyword_list(cur_keyword_str)"{{{
if !has_key(s:snippets, '_')
" Caching _ snippets.
call s:caching_snippets('_')
endif
let snippets = values(s:snippets['_'])
let all_snippets = neosnippet#get_snippets()
let filetype = neocomplcache#get_context_filetype()
if !has_key(s:snippets, filetype)
if !has_key(all_snippets, filetype)
" Caching snippets.
call s:caching_snippets(filetype)
endif
for source in neocomplcache#get_sources_list(s:snippets, filetype)
let snippets += values(source)
endfor
return s:keyword_filter(neocomplcache#dup_filter(snippets),
\ a:cur_keyword_str)
endfunction"}}}
function! neocomplcache#sources#snippets_complete#define()"{{{
return s:source
endfunction"}}}
function! s:compare_words(i1, i2)
return a:i1.menu - a:i2.menu
endfunction
" For echodoc."{{{
let s:doc_dict = {
\ 'name' : 'snippets_complete',
\ 'rank' : 100,
\ 'filetypes' : {},
\ }
function! s:doc_dict.search(cur_text)"{{{
if mode() !=# 'i'
return []
call neosnippet#caching_snippets(filetype)
endif
let snippets = neocomplcache#sources#snippets_complete#get_snippets()
let cur_word = s:get_cursor_keyword_snippet(snippets, a:cur_text)
if cur_word == ''
return []
endif
let snip = snippets[cur_word]
let ret = []
call add(ret, { 'text' : snip.word, 'highlight' : 'String' })
call add(ret, { 'text' : ' ' })
call add(ret, { 'text' : snip.menu, 'highlight' : 'Special' })
return ret
return s:keyword_filter(neocomplcache#dup_filter(
\ values(all_snippets)), a:cur_keyword_str)
endfunction"}}}
"}}}
function! s:keyword_filter(list, cur_keyword_str)"{{{
let keyword_escape = neocomplcache#keyword_escape(a:cur_keyword_str)
let prev_word = neocomplcache#get_prev_word(a:cur_keyword_str)
" Keyword filter.
let pattern = printf('v:val.word =~ %s && (!has_key(v:val, "prev_word") || v:val.prev_word == %s)',
\string('^' . keyword_escape), string(prev_word))
let pattern = printf('v:val.word =~ %s &&'.
\ '(!has_key(v:val, "prev_word") || v:val.prev_word == %s)',
\ string('^' . keyword_escape), string(prev_word))
let list = filter(a:list, pattern)
@@ -237,731 +95,32 @@ function! s:keyword_filter(list, cur_keyword_str)"{{{
return list
endfunction"}}}
function! neocomplcache#sources#snippets_complete#define()"{{{
return s:source
endfunction"}}}
function! s:compare_words(i1, i2)
return a:i1.menu - a:i2.menu
endfunction
function! neocomplcache#sources#snippets_complete#expandable()"{{{
let ret = 0
if neocomplcache#sources#snippets_complete#force_expandable()
let ret += 1
endif
if neocomplcache#sources#snippets_complete#jumpable()
let ret += 2
endif
return ret
return neosnippet#expandable()
endfunction"}}}
function! neocomplcache#sources#snippets_complete#force_expandable()"{{{
let snippets = neocomplcache#sources#snippets_complete#get_snippets()
let cur_text = neocomplcache#get_cur_text(1)
" Found snippet trigger.
return s:get_cursor_keyword_snippet(snippets, cur_text) != ''
\ || s:get_cursor_snippet(snippets, cur_text) != ''
return neosnippet#expandable()
endfunction"}}}
function! neocomplcache#sources#snippets_complete#jumpable()"{{{
" Found snippet placeholder.
return search(s:get_placeholder_marker_pattern(). '\|'
\ .s:get_sync_placeholder_marker_pattern(), 'nw') > 0
return neosnippet#jumpable()
endfunction"}}}
function! s:caching()"{{{
for filetype in neocomplcache#get_source_filetypes(
\ neocomplcache#get_context_filetype(1))
if !has_key(s:snippets, filetype)
call s:caching_snippets(filetype)
endif
endfor
endfunction"}}}
function! s:set_snippet_dict(snippet_pattern, snippet_dict, dup_check, snippets_file)"{{{
if !has_key(a:snippet_pattern, 'name')
return
endif
let pattern = s:set_snippet_pattern(a:snippet_pattern)
let action_pattern = '^snippet\s\+' . a:snippet_pattern.name . '$'
let a:snippet_dict[a:snippet_pattern.name] = pattern
let a:dup_check[a:snippet_pattern.name] = 1
for alias in get(a:snippet_pattern, 'alias', [])
let alias_pattern = copy(pattern)
let alias_pattern.word = alias
let abbr = (g:neocomplcache_max_keyword_width >= 0 &&
\ len(alias) > g:neocomplcache_max_keyword_width) ?
\ printf(abbr_pattern, alias, alias[-8:]) : alias
let alias_pattern.abbr = abbr
let alias_pattern.action__path = a:snippets_file
let alias_pattern.action__pattern = action_pattern
let alias_pattern.real_name = a:snippet_pattern.name
let a:snippet_dict[alias] = alias_pattern
let a:dup_check[alias] = 1
endfor
let snippet = a:snippet_dict[a:snippet_pattern.name]
let snippet.action__path = a:snippets_file
let snippet.action__pattern = action_pattern
let snippet.real_name = a:snippet_pattern.name
endfunction"}}}
function! s:set_snippet_pattern(dict)"{{{
let abbr_pattern = printf('%%.%ds..%%s',
\ g:neocomplcache_max_keyword_width-10)
let a:dict.word = substitute(a:dict.word, '\n$', '', '')
let menu_pattern = (a:dict.word =~
\ s:get_placeholder_marker_substitute_pattern()) ?
\ '<Snip> ' : '[Snip] '
let abbr = get(a:dict, 'abbr', substitute(a:dict.word,
\ s:get_placeholder_marker_pattern(). '\|'.
\ s:get_mirror_placeholder_marker_pattern().
\ '\|\s\+\|\n', ' ', 'g'))
let abbr = (g:neocomplcache_max_keyword_width >= 0 &&
\ len(abbr) > g:neocomplcache_max_keyword_width)?
\ printf(abbr_pattern, abbr, abbr[-8:]) : abbr
let dict = {
\ 'word' : a:dict.name,
\ 'snip' : a:dict.word, 'abbr' : a:dict.name,
\ 'description' : a:dict.word,
\ 'menu' : menu_pattern . abbr, 'dup' : 1
\}
if has_key(a:dict, 'prev_word')
let dict.prev_word = a:dict.prev_word
endif
return dict
endfunction"}}}
function! s:edit_snippets(filetype, isruntime)"{{{
if a:filetype == ''
let filetype = neocomplcache#get_context_filetype(1)
else
let filetype = a:filetype
endif
" Edit snippet file.
if a:isruntime
if empty(s:runtime_dir)
return
endif
let filename = s:runtime_dir[0].'/'.filetype.'.snip'
else
if empty(s:snippets_dir)
return
endif
let filename = s:snippets_dir[-1].'/'.filetype.'.snip'
endif
if filereadable(filename)
edit `=filename`
else
enew
setfiletype snippet
saveas `=filename`
endif
endfunction"}}}
function! s:caching_snippets(filetype)"{{{
let filetype = a:filetype == '' ?
\ &filetype : a:filetype
let snippet = {}
let snippets_files =
\ split(globpath(join(s:snippets_dir, ','),
\ filetype . '.snip*'), '\n')
\ + split(globpath(join(s:snippets_dir, ','),
\ filetype . '_*.snip*'), '\n')
\ + split(globpath(join(s:snippets_dir, ','),
\ filetype . '/*.snip*'), '\n')
for snippets_file in snippets_files
call s:load_snippets(snippet, snippets_file)
endfor
let s:snippets[filetype] = snippet
endfunction"}}}
function! s:load_snippets(snippet, snippets_file)"{{{
let dup_check = {}
let snippet_pattern = { 'word' : '' }
let abbr_pattern = printf('%%.%ds..%%s',
\ g:neocomplcache_max_keyword_width-10)
let linenr = 1
for line in readfile(a:snippets_file)
if line =~ '^\h\w*.*\s$'
" Delete spaces.
let line = substitute(line, '\s\+$', '', '')
endif
if line =~ '^include'
" Include snippets.
let snippet_file = matchstr(line, '^include\s\+\zs.*$')
for snippets_file in split(globpath(join(s:snippets_dir, ','),
\ snippet_file), '\n')
call s:load_snippets(a:snippet, snippets_file)
endfor
elseif line =~ '^delete\s'
let name = matchstr(line, '^delete\s\+\zs.*$')
if name != '' && has_key(a:snippet, name)
call filter(a:snippet, 'v:val.real_name !=# name')
endif
elseif line =~ '^snippet\s'
if has_key(snippet_pattern, 'name')
" Set previous snippet.
call s:set_snippet_dict(snippet_pattern,
\ a:snippet, dup_check, a:snippets_file)
let snippet_pattern = { 'word' : '' }
endif
let snippet_pattern.name =
\ substitute(matchstr(line, '^snippet\s\+\zs.*$'),
\ '\s', '_', 'g')
" Check for duplicated names.
if has_key(dup_check, snippet_pattern.name)
call neocomplcache#print_error(
\ 'Warning: ' . a:snippets_file . ':'
\ . linenr . ': duplicated snippet name `'
\ . snippet_pattern.name . '`')
call neocomplcache#print_error(
\ 'Please delete this snippet name before.')
endif
elseif has_key(snippet_pattern, 'name')
" Only in snippets.
if line =~ '^abbr\s'
let snippet_pattern.abbr = matchstr(line, '^abbr\s\+\zs.*$')
elseif line =~ '^alias\s'
let snippet_pattern.alias = split(matchstr(line,
\ '^alias\s\+\zs.*$'), '[,[:space:]]\+')
elseif line =~ '^prev_word\s'
let snippet_pattern.prev_word = matchstr(line,
\ '^prev_word\s\+[''"]\zs.*\ze[''"]$')
elseif line =~ '^\s'
if snippet_pattern.word != ''
let snippet_pattern.word .= "\n"
else
" Substitute Tab character.
let line = substitute(line, '^\t', '', '')
endif
let snippet_pattern.word .=
\ matchstr(line, '^ *\zs.*$')
elseif line =~ '^$'
" Blank line.
let snippet_pattern.word .= "\n"
endif
endif
let linenr += 1
endfor
if snippet_pattern.word !~
\ s:get_placeholder_marker_substitute_pattern()
" Add placeholder.
let snippet_pattern.word .= '${0}'
endif
" Set previous snippet.
call s:set_snippet_dict(snippet_pattern,
\ a:snippet, dup_check, a:snippets_file)
return a:snippet
endfunction"}}}
function! s:get_cursor_keyword_snippet(snippets, cur_text)"{{{
let cur_word = matchstr(a:cur_text,
\ neocomplcache#get_keyword_pattern_end().'\|\h\w*\W\+$')
" Check prev_word.
let prev_word = neocomplcache#get_prev_word(cur_word)
let pattern = printf('(!has_key(v:val, "prev_word") || v:val.prev_word ==# %s)',
\ string(prev_word))
let dict = filter(copy(a:snippets), pattern)
if !has_key(dict, cur_word)
let cur_word = ''
endif
return cur_word
endfunction"}}}
function! s:get_cursor_snippet(snippets, cur_text)"{{{
let cur_word = matchstr(a:cur_text, '\S\+$')
while cur_word != '' && !has_key(a:snippets, cur_word)
let cur_word = cur_word[1:]
endwhile
return cur_word
endfunction"}}}
function! s:snippets_force_expand(cur_text, col)"{{{
let cur_word = s:get_cursor_snippet(
\ neocomplcache#sources#snippets_complete#get_snippets(),
\ a:cur_text)
call neocomplcache#sources#snippets_complete#expand(
\ a:cur_text, a:col, cur_word)
endfunction"}}}
function! s:snippets_expand_or_jump(cur_text, col)"{{{
let cur_word = s:get_cursor_keyword_snippet(
\ neocomplcache#sources#snippets_complete#get_snippets(),
\ a:cur_text)
if cur_word == ''
" Check by force_expand.
let cur_word = s:get_cursor_snippet(
\ neocomplcache#sources#snippets_complete#get_snippets(),
\ a:cur_text)
endif
if cur_word != ''
" Found snippet trigger.
call neocomplcache#sources#snippets_complete#expand(
\ a:cur_text, a:col, cur_word)
else
call s:snippets_force_jump(a:cur_text, a:col)
endif
endfunction"}}}
function! s:snippets_jump_or_expand(cur_text, col)"{{{
let cur_word = s:get_cursor_keyword_snippet(
\ neocomplcache#sources#snippets_complete#get_snippets(), a:cur_text)
if search(s:get_placeholder_marker_pattern(). '\|'
\ .s:get_sync_placeholder_marker_pattern(), 'nw') > 0
" Found snippet placeholder.
call s:snippets_force_jump(a:cur_text, a:col)
else
call neocomplcache#sources#snippets_complete#expand(
\ a:cur_text, a:col, cur_word)
endif
endfunction"}}}
function! neocomplcache#sources#snippets_complete#expand(cur_text, col, trigger_name)"{{{
if a:trigger_name == ''
let pos = getpos('.')
let pos[2] = len(a:cur_text)+1
call setpos('.', pos)
if pos[2] < col('$')
startinsert
else
startinsert!
endif
return
endif
let snippets = neocomplcache#sources#snippets_complete#get_snippets()
let snippet = snippets[a:trigger_name]
let cur_text = a:cur_text[: -1-len(a:trigger_name)]
let snip_word = snippet.snip
if snip_word =~ '\\\@<!`.*\\\@<!`'
let snip_word = s:eval_snippet(snip_word)
endif
" Substitute escaped `.
let snip_word = substitute(snip_word, '\\`', '`', 'g')
" Substitute markers.
let snip_word = substitute(snip_word,
\ s:get_placeholder_marker_substitute_pattern(),
\ '<`\1`>', 'g')
let snip_word = substitute(snip_word,
\ s:get_mirror_placeholder_marker_substitute_pattern(),
\ '<|\1|>', 'g')
" Insert snippets.
let next_line = getline('.')[a:col-1 :]
let snippet_lines = split(snip_word, '\n', 1)
if empty(snippet_lines)
return
endif
let begin_line = line('.')
let end_line = line('.') + len(snippet_lines) - 1
let snippet_lines[0] = cur_text . snippet_lines[0]
let next_col = len(snippet_lines[-1]) + 1
let snippet_lines[-1] = snippet_lines[-1] . next_line
call setline('.', snippet_lines[0])
if len(snippet_lines) > 1
call append('.', snippet_lines[1:])
endif
call s:indent_snippet(begin_line, end_line)
let begin_patterns = (begin_line > 1) ?
\ [getline(begin_line - 1)] : []
let end_patterns = (end_line < line('$')) ?
\ [getline(end_line + 1)] : []
call add(s:snippets_expand_stack, {
\ 'begin_line' : begin_line,
\ 'begin_patterns' : begin_patterns,
\ 'end_line' : end_line,
\ 'end_patterns' : end_patterns,
\ 'holder_cnt' : 1,
\ })
if has('folding') && foldclosed(line('.'))
" Open fold.
silent! normal! zO
endif
if next_col < col('$')
startinsert
else
startinsert!
endif
if snip_word =~ s:get_placeholder_marker_pattern()
call s:snippets_force_jump(a:cur_text, a:col)
endif
let &l:iminsert = 0
let &l:imsearch = 0
endfunction"}}}
function! s:indent_snippet(begin, end)"{{{
let equalprg = &l:equalprg
setlocal equalprg=
let pos = getpos('.')
let base_indent = matchstr(getline(a:begin), '^\s\+')
for line_nr in range(a:begin+1, a:end)
call cursor(line_nr, 0)
if getline('.') =~ '^\t\+'
" Delete head tab character.
let current_line = substitute(getline('.'), '^\t', '', '')
if &l:expandtab && current_line =~ '^\t\+'
" Expand tab.
cal setline('.', substitute(current_line,
\ '^\t\+', base_indent . repeat(' ', &shiftwidth *
\ len(matchstr(current_line, '^\t\+'))), ''))
elseif line_nr != a:begin
call setline('.', base_indent . current_line)
endif
else
silent normal! ==
endif
endfor
call setpos('.', pos)
let &l:equalprg = equalprg
endfunction"}}}
function! s:snippets_force_jump(cur_text, col)"{{{
" Get patterns and count.
if empty(s:snippets_expand_stack)
return s:search_outof_range(a:col)
endif
let expand_info = s:snippets_expand_stack[-1]
" Search patterns.
let [begin, end] = s:get_snippet_range(
\ expand_info.begin_line,
\ expand_info.begin_patterns,
\ expand_info.end_line,
\ expand_info.end_patterns)
if s:search_snippet_range(begin, end, expand_info.holder_cnt)
" Next count.
let expand_info.holder_cnt += 1
return 1
endif
" Search placeholder 0.
if s:search_snippet_range(begin, end, 0)
return 1
endif
" Not found.
let s:snippets_expand_stack = s:snippets_expand_stack[: -2]
return s:search_outof_range(a:col)
endfunction"}}}
function! s:get_snippet_range(begin_line, begin_patterns, end_line, end_patterns)"{{{
let pos = getpos('.')
call cursor(a:begin_line, 0)
if empty(a:begin_patterns)
let begin = line('.') - 50
else
let [begin, _] = searchpos('^' . neocomplcache#util#escape_pattern(
\ a:begin_patterns[0]) . '$', 'bnW')
if begin <= 0
let begin = line('.') - 50
endif
endif
if begin <= 0
let begin = 1
endif
call cursor(a:end_line, 0)
if empty(a:end_patterns)
let end = line('.') + 50
else
let [end, _] = searchpos('^' . neocomplcache#util#escape_pattern(
\ a:end_patterns[0]) . '$', 'nW')
if end <= 0
let end = line('.') + 50
endif
endif
if end > line('$')
let end = line('$')
endif
call setpos('.', pos)
return [begin, end]
endfunction"}}}
function! s:search_snippet_range(start, end, cnt)"{{{
call s:substitute_placeholder_marker(a:start, a:end, a:cnt)
let pattern = substitute(
\ s:get_placeholder_marker_pattern(), '\\d\\+', a:cnt, '')
let line = a:start
for line in filter(range(a:start, a:end),
\ 'getline(v:val) =~ pattern')
call s:expand_placeholder(a:start, a:end, a:cnt, line)
return 1
endfor
return 0
endfunction"}}}
function! s:search_outof_range(col)"{{{
call s:substitute_placeholder_marker(1, 0, 0)
let pattern = s:get_placeholder_marker_pattern()
if search(pattern, 'w') > 0
call s:expand_placeholder(line('.'), 0, '\d\+', line('.'))
return 1
endif
let pos = getpos('.')
if a:col == 1
let pos[2] = 1
call setpos('.', pos)
startinsert
elseif a:col == col('$')
startinsert!
else
let pos[2] = a:col+1
call setpos('.', pos)
startinsert
endif
" Not found.
return 0
endfunction"}}}
function! s:expand_placeholder(start, end, holder_cnt, line)"{{{
let pattern = substitute(s:get_placeholder_marker_pattern(),
\ '\\d\\+', a:holder_cnt, '')
let current_line = getline(a:line)
let match = match(current_line, pattern)
let default_pattern = substitute(
\ s:get_placeholder_marker_default_pattern(),
\ '\\d\\+', a:holder_cnt, '')
let default = substitute(
\ matchstr(current_line, default_pattern), '\\\ze.', '', 'g')
" Substitute marker.
let default = substitute(default,
\ s:get_placeholder_marker_substitute_pattern(),
\ '<`\1`>', 'g')
let default = substitute(default,
\ s:get_mirror_placeholder_marker_substitute_pattern(),
\ '<|\1|>', 'g')
let default_len = len(default)
let pos = getpos('.')
let pos[1] = a:line
let pos[2] = match+1
let cnt = s:search_sync_placeholder(a:start, a:end, a:holder_cnt)
if cnt > 0
let pattern = substitute(s:get_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
call setline(a:line, substitute(current_line, pattern,
\ '<{'.cnt.':'.escape(default, '\').'}>', ''))
let pos[2] += len('<{'.cnt.':')
else
" Substitute holder.
call setline(a:line,
\ substitute(current_line, pattern, escape(default, '\'), ''))
endif
call setpos('.', pos)
if default_len > 0
" Select default value.
let len = default_len-1
if &l:selection == 'exclusive'
let len += 1
endif
stopinsert
execute 'normal! v'. repeat('l', len) . "\<C-g>"
elseif pos[2] < col('$')
startinsert
else
startinsert!
endif
endfunction"}}}
function! s:search_sync_placeholder(start, end, number)"{{{
if a:end == 0
" Search in current buffer.
let cnt = matchstr(getline('.'),
\ substitute(s:get_placeholder_marker_pattern(),
\ '\\d\\+', '\\zs\\d\\+\\ze', ''))
return search(substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, ''), 'nw') > 0 ? cnt : 0
endif
let pattern = substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', a:number, '')
for line in filter(range(a:start, a:end),
\ 'getline(v:val) =~ pattern')
return a:number
endfor
return 0
endfunction"}}}
function! s:substitute_placeholder_marker(start, end, snippet_holder_cnt)"{{{
if a:snippet_holder_cnt > 1
let cnt = a:snippet_holder_cnt-1
let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
let mirror_marker = substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
let line = a:start
for line in range(a:start, a:end)
if getline(line) =~ sync_marker
let sub = escape(matchstr(getline(line),
\ substitute(s:get_sync_placeholder_marker_default_pattern(),
\ '\\d\\+', cnt, '')), '/\')
silent execute printf('%d,%ds/' . mirror_marker . '/%s/'
\ . (&gdefault ? '' : 'g'), a:start, a:end, sub)
call setline(line, substitute(getline(line), sync_marker, sub, ''))
endif
endfor
elseif search(s:get_sync_placeholder_marker_pattern(), 'wb') > 0
let sub = escape(matchstr(getline('.'),
\ s:get_sync_placeholder_marker_default_pattern()), '/\')
let cnt = matchstr(getline('.'),
\ substitute(s:get_sync_placeholder_marker_pattern(),
\ '\\d\\+', '\\zs\\d\\+\\ze', ''))
silent execute printf('%%s/' . mirror_marker . '/%s/'
\ . (&gdefault ? 'g' : ''), sub)
let sync_marker = substitute(s:get_sync_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
let mirror_marker = substitute(
\ s:get_mirror_placeholder_marker_pattern(),
\ '\\d\\+', cnt, '')
call setline('.', substitute(getline('.'), sync_marker, sub, ''))
endif
endfunction"}}}
function! s:eval_snippet(snippet_text)"{{{
let snip_word = ''
let prev_match = 0
let match = match(a:snippet_text, '\\\@<!`.\{-}\\\@<!`')
while match >= 0
if match - prev_match > 0
let snip_word .= a:snippet_text[prev_match : match - 1]
endif
let prev_match = matchend(a:snippet_text,
\ '\\\@<!`.\{-}\\\@<!`', match)
let snip_word .= eval(a:snippet_text[match+1 : prev_match - 2])
let match = match(a:snippet_text, '\\\@<!`.\{-}\\\@<!`', prev_match)
endwhile
if prev_match >= 0
let snip_word .= a:snippet_text[prev_match :]
endif
return snip_word
endfunction"}}}
function! neocomplcache#sources#snippets_complete#get_snippets()"{{{
" Get buffer filetype.
let filetype = neocomplcache#get_context_filetype(1)
let snippets = {}
for source in neocomplcache#get_sources_list(s:snippets, filetype)
call extend(snippets, source, 'keep')
endfor
call extend(snippets, copy(s:snippets['_']), 'keep')
return snippets
return neosnippet#get_snippets()
endfunction"}}}
function! neocomplcache#sources#snippets_complete#get_snippets_dir()"{{{
return s:snippets_dir
return neosnippet#get_snippets_dir()
endfunction"}}}
function! s:get_placeholder_marker_pattern()"{{{
return '<`\d\+\%(:.\{-}\)\?\\\@<!`>'
endfunction"}}}
function! s:get_placeholder_marker_substitute_pattern()"{{{
return '\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}'
endfunction"}}}
function! s:get_placeholder_marker_default_pattern()"{{{
return '<`\d\+:\zs.\{-}\ze\\\@<!`>'
endfunction"}}}
function! s:get_sync_placeholder_marker_pattern()"{{{
return '<{\d\+\%(:.\{-}\)\?\\\@<!}>'
endfunction"}}}
function! s:get_sync_placeholder_marker_default_pattern()"{{{
return '<{\d\+:\zs.\{-}\ze\\\@<!}>'
endfunction"}}}
function! s:get_mirror_placeholder_marker_pattern()"{{{
return '<|\d\+|>'
endfunction"}}}
function! s:get_mirror_placeholder_marker_substitute_pattern()"{{{
return '\$\(\d\+\)'
endfunction"}}}
function! s:SID_PREFIX()"{{{
return matchstr(expand('<sfile>'), '<SNR>\d\+_')
endfunction"}}}
function! s:trigger(function)"{{{
let cur_text = neocomplcache#get_cur_text(1)
let col = col('.')
if mode() !=# 'i'
" Fix column.
let col += 2
endif
return printf("\<ESC>:call %s(%s,%d)\<CR>",
\ a:function, string(cur_text), col)
endfunction"}}}
" Plugin key-mappings.
inoremap <silent><expr> <Plug>(neosnippet_expand_or_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump')
snoremap <silent><expr> <Plug>(neosnippet_expand_or_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_expand_or_jump')
inoremap <silent><expr> <Plug>(neosnippet_jump_or_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand')
snoremap <silent><expr> <Plug>(neosnippet_jump_or_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_jump_or_expand')
inoremap <silent><expr> <Plug>(neosnippet_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand')
snoremap <silent><expr> <Plug>(neosnippet_expand_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_expand')
inoremap <silent><expr> <Plug>(neosnippet_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump')
snoremap <silent><expr> <Plug>(neosnippet_jump_impl)
\ <SID>trigger(<SID>SID_PREFIX().'snippets_force_jump')
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@@ -1,16 +0,0 @@
# Global snippets
snippet date
`strftime("%d %b %Y")`
snippet date_full
alias df
`strftime("%Y-%m-%dT%H:%M:%S")`
snippet date_day
alias dd
`strftime("%Y-%m-%d")`
snippet date_time
alias dt
`strftime("%H:%M:%S")`

View File

@@ -1,273 +0,0 @@
snippet ec
#endinitclip
snippet inc
#include "${1}"
snippet br
break;
snippet ca
call(${1:frame});
snippet case
abbr ce
case ${1:expression} :
${1:statement}
snippet catch
abbr ch
catch ($1) {
$2
}
snippet class
class ${1:ClassName} {
var _${2};
function ${1}(${2}){
_${2} = ${2};${0}
}
}
snippet co
continue;
snippet dt
default :
${1:statement}
snippet de
delete ${1};
snippet do
do {
${1}
} while (${2:condition});
snippet dm
duplicateMovieClip(${1:target}, ${2:newName}, ${3:depth});
snippet ei
else if (${1}) {
${2}
}
snippet fori
abbr fi
for ( var ${1} in ${2} ){
${3}
};
snippet for
abbr fr
for ( var ${1}=0; ${1}<${3}.length; ${1}++ ) {
${4}
};
snippet fs
fscommand(${1:command}, ${2:paramaters});
snippet fn
function ${1}(${2}):${3}{
${4}
};
snippet gu
getURL(${1});
snippet gp
gotoAndPlay(${1});
snippet gs
gotoAndStop(${1});
snippet if
if (${1}) {
${2}
}
snippet il
ifFrameLoaded (${1}) {
${2}
}
snippet ip
import ${1};
snippet it
interface ${1}{
${2}
}
snippet lm
loadMovie( ${1:url}, ${2:target}, ${3:method});
snippet ln
loadMovieNum( ${1:url}, ${2:level}, ${3:method});
snippet lv
loadVariables( ${1:url}, ${2:target}, ${3:method});
snippet vn
loadVariables( ${1:url}, ${2:level}, ${3:method});
snippet mc
MovieClip
snippet nf
nextFrame();
snippet ns
nextScene();
snippet on
on (${1}) {
${2}
};
snippet oc
onClipEvent (${1}) {
${2}
};
snippet pl
play();
snippet pf
pravFrame();
snippet ps
prevScene();
snippet pr
print( ${1:target}, ${2:type} );
snippet bn
printAsBitmapNum( ${1:level}, ${2:type} );
snippet pn
printNum( ${1:level}, ${2:type} );
snippet rm
removeMovieClip( ${1:target} );
snippet rt
return ${1};
snippet sp
setProperty( ${1:target}, ${2:property}, ${3:value} );
snippet sv
set( ${1:name}, ${2:value} );
snippet dr
startDrag(${1:target}, ${2:lockcenter}, ${3:l}, ${4:t}, ${5:r}, ${6:b} );
snippet st
stop();
snippet ss
stopAllSounds();
snippet sd
stopDrag();
snippet sw
switch ( ${1:condition} ) {
${2}
}
snippet tt
tellTarget( ${1:target} ) {
${2}
}
snippet th
throw ${1};
snippet tq
toggleHighQuality();
snippet tr
trace(${1:"$0"});
snippet ty
try {
${1}
};
snippet um
unloadMovie(${1:target});
snippet un
unloadMovieNum(${1:level});
snippet vr
var ${1}:${2};
snippet wh
while (${1:condition}) {
${2}
};
snippet wt
with (${1:target});
${2}
};

View File

@@ -1,23 +0,0 @@
snippet allow
AllowOverride ${1:AuthConfig} ${2:FileInfo} ${3:Indexes} ${4:Limit} ${5:Options}
snippet opt
Options ${1:All} ${2:ExecCGI} ${3:FollowSymLinks} ${4:Includes} ${5:IncludesNOEXEC} ${6:Indexes} ${7:MultiViews} ${8:SymLinksIfOwnerMatch}
snippet vhost
<VirtualHost ${1:example.org}>
ServerAdmin webmaster@${1}
DocumentRoot /www/vhosts/${1}
ServerName ${1}
ErrorLog logs/${1}-error_log
CustomLog logs/${1}-access_log common
</VirtualHost>
snippet dir
<Directory ${1:/Library/WebServer/}>
${0}
</Directory>

View File

@@ -1,201 +0,0 @@
snippet script
script ${1:new_object}
on run
${2:-- do something interesting}
end run
end script
snippet on
on ${1:functionName}(${2:arguments})
${3:-- function actions}
end ${1}
snippet tell
tell ${1:app}
${0:-- insert actions here}
end tell
snippet terms
using terms from ${1:app}
${0:-- insert actions here}
end using terms from
snippet if
if ${1:true} then
${0:-- insert actions here}
end if
snippet rept
abbr rep
repeat ${1} times}
${0:-- insert actions here}
end repeat
snippet repwh
abbr rep
repeat while ${1:condition}
${0}
end repeat
snippet repwi
abbr rep
repeat with ${1} in ${2}
${0}
end repeat
snippet try
try
${0:-- actions to try}
on error
-- error handling
end try
<D-c>
snippet timeout
with timeout ${1:number} seconds
${0:-- insert actions here}
end timeout
snippet con
considering ${1:case}
${0:-- insert actions here}
end considering
snippet ign
ignoring ${1:application responses}
${0:-- insert actions here}
end ignoring
snippet shell
${1:set shell_stdout to }do shell script ${3:"${2:#script}"}
without altering line endings
${0}
snippet delim
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"${1:,}"}
${0:-- insert actions here}
set AppleScript's text item delimiters to oldDelims
snippet parent
prop parent : app "${1}"
snippet alert
display alert "${1:alert text}"
${2:message} "${3:message text}"
${4:as warning}
snippet dialog_OK
abbr dialog
display dialog "${1:text}"
${2:with icon} ${3:1}
buttons {"${4:OK}"} default button 1
snippet dialog_OK/Cancel
abbr dialog
display dialog "${1:text}"
${2:with icon}
buttons {"${3:Cancel}", "${4:OK}"}
default button "${4}"
set button_pressed to button returned of result
if button_pressed is "${4}" then
${5:-- action for default button button goes here}
else
-- action for cancel button goes here
end if
snippet dialog_OK/Cancel/Other
abbr dialog
display dialog "${1:text}"
${2:with icon}
buttons {"${3:Cancel}", "${4:Other Choice}", "${5:OK}"}
default button "${5}"
set button_pressed to button returned of result
if button_pressed is "${5}" then
${6:-- action for default button button goes here}
else if button_pressed is "${3}" then
-- action for cancel button goes here
else
-- action for other button goes here
end if
snippet dialog_TextFierld
abbr dialog
set the_result to display dialog "${1:text}"
default answer "${2:type here}"
${3:with icon}
buttons {"${4:Cancel}", "${5:OK}"}
default button "${5}"
set button_pressed to button returned of the_result
set text_typed to text returned of the_result
if button_pressed is "${5}" then
${6:-- action for default button button goes here}
else
-- action for cancel button goes here
end if
snippet choose_Applications
abbr choose
${1:set the_application to }choose application with prompt "${2:Choose an application:}"${3:with multiple selections allowed}
snippet choose_Files
abbr choose
${1:set the_file to }choose file with prompt "${2:Pick a file:}"
${3:default location path to home folder}
${4:with invisibles}
${5:with multiple selections allowed}
${6:with showing package contents}
snippet choose_Folders
abbr choose
${1:set the_folder to }choose folder with prompt "${2:Pick a folder:}"
${3:default location path to home folder}
${4:with invisibles}
${5:with multiple selections allowed}
${6:with showing package contents}
${0}
snippet choose_NewFile
abbr choose
${1:set the_filename to }choose file name with prompt "${2:Name this file:}"
default name "${3:untitled}" default location ${4:path to home folder}
snippet choose_URL
abbr choose
${1:set the_url to }choose URL showing ${2:Web} servers with editable URL
snippet choose_Color
abbr choose
${1:set the_color to }choose color default color ${2:{65536, 65536, 65536\}}
snippet choose_ItemFromList
abbr choose
set the_choice to choose from list ${1}"\}}

View File

@@ -1,135 +0,0 @@
snippet if
abbr if () {}
if (${1:/* condition */}) {
${0:/* code */}
}
snippet else
else {
${0}
}
snippet elseif
else if (${1:/* condition */}) {
${0}
}
snippet ifelse
abbr if () {} else {}
if (${1:condition}) {
${2}
} else {
${3}
}
snippet for
abbr for () {}
for (${1} = 0; $1 < ${2}; $1++) {
${0}
}
snippet while
abbr while () {}
while (${1:/* condition */}) {
${0:/* code */}
}
snippet do_while
alias do
do {
${0:/* code */}
} while (${1:/* condition */});
snippet switch
abbr switch () {}
switch (${1:var}) {
case ${2:val}:
${0}
break;
}
snippet function
alias func
abbr func() {}
${1:void} ${2:func_name}(${3}) {
${0}
}
snippet struct
abbr struct {}
struct ${1:name} {
${0:/* data */}
};
# Typedef struct
snippet struct_typedef
typedef struct ${1:name} {
${0:/* data */}
};
snippet enum
abbr enum {}
enum ${1:name} {
${0}
};
# main function.
snippet main
int main(int argc, char const* argv[])
{
${0}
return 0;
}
# #include <...>
snippet inc
alias #inc, #include
#include <${1:stdio}.h>${0}
# #include "..."
snippet inc2
alias #inc2, #include2
#include "${1:}.h"${0}
snippet ifndef
alias #ifndef
abbr #ifndef ... #define ... #endif
#ifndef $1
#define ${1:SYMBOL}
#endif${0}
snippet def
alias #def, #define
#define
# Include-Guard
snippet once
abbr include-guard
#ifndef ${1:SYMBOL}
#define $1
${0}
#endif /* end of include guard */
# Tertiary conditional
snippet conditional
(${1:/* condition */}) ? ${2:a} : ${3:b}
# Typedef
snippet typedef
typedef ${1:base_type} ${2:custom_type};
snippet printf
printf("${1}\n"${2});${0}
snippet fprintf
fprintf(${1:stderr}, "${2}\n"${3});${0}
snippet comment
alias /*
/* ${1:comment} */
${0}
snippet sizeof
alias size
sizeof(${0})

View File

@@ -1,72 +0,0 @@
snippet req
${1:object} = require('$1')
snippet log
console.log ${0}
snippet unl
${1:action} unless ${2:condition}
snippet try
try
${1}
catch ${2:error}
${3}
snippet if
if ${1:condition}
${0:# body...}
snippet elif
else if ${1:condition}
${0:# body...}
snippet ifte
if ${1:condition} then ${2:value} else ${3:other}
snippet ife
if ${1:condition}
${2:# body...}
else
${3:# body...}
snippet swi
switch ${1:object}
when ${2:value}
${0:# body...}
snippet ^j
\`${1:javascript}\`
snippet forr
for ${1:name} in [${2:start}..${3:finish}]${4: by ${5:step\}}
${0:# body...}
snippet forrex
for ${1:name} in [${2:start}...${3:finish}]${4: by ${t:step\}}
${0:# body...}
snippet foro
for ${1:key}, ${2:value} of ${3:object}
${0:# body...}
snippet fora
for ${1:name} in ${2:array}
${0:# body...}
snippet fun
${1:name} = (${2:args}) ->
${0:# body...}
snippet bfun
(${1:args}) =>
${0:# body...}
snippet cla
abbr cla
prev_word '^'
class ${1:ClassName}${2: extends ${3:Ancestor\}}
constructor: (${4:args}) ->
${5:# body...}

View File

@@ -1,37 +0,0 @@
include c.snip
snippet template
abbr template <T>
template<typename ${1:T}>
snippet class
abbr class {}
class ${1:name} {
${2}
};
snippet try
abbr try catch
try {
${1}
} catch (${2:exception}) {
${3}
}
# range based for ( C++11 feature )
snippet for_CPP11
abbr for (:) {}
for (${1:var} : ${2:container}) {
${0}
}
# lambda expression ( C++11 feature )
snippet lambda
abbr [](){}
[${1}](${2})${3}{ ${4} }
# scoped enumeration ( C++11 feature )
snippet enum_scoped
abbr enum struct {}
enum struct { ${1} }

View File

@@ -1,252 +0,0 @@
snippet background
alias bg
background:${1};${2}
snippet backattachment
alias ba
background-attachment:${1};${2}
snippet backcolor
alias bc
background-color:${1};${2}
snippet backimage
alias bi
background-image:${1};${2}
snippet backposition
alias bp
background-position:${1};${2}
snippet backrepeat
alias br
background-repeat:${1};${2}
snippet border
alias b
border:${1};${2}
snippet border-style
alias bs
border-style:${1};${2}
snippet border-color
alias bc
border-color:${1};${2}
snippet border-width
alias bw
border-width:${1};${2}
snippet border-bottom-width
alias bbw
border-bottom-width:${1};${2}
snippet border-top-width
alias btw
border-top-width:${1};${2}
snippet border-left-width
alias blw
border-left-width:${1};${2}
snippet border-right-width
alias brw
border-right-width:${1};${2}
snippet border-bottom-style
alias bbs
border-bottom-style:${1};${2}
snippet border-top-style
alias bts
border-top-style:${1};${2}
snippet border-left-style
alias bls
border-left-style:${1};${2}
snippet border-right-style
alias brs
border-right-style:${1};${2}
snippet border-bottom-color
alias bbc
border-bottom-color:${1};${2}
snippet border-top-color
alias btc
border-top-color:${1};${2}
snippet border-left-color
alias blc
border-left-color:${1};${2}
snippet border-right-color
alias brc
border-right-color:${1};${2}
snippet outline
alias ol
outline:${1};${2}
snippet outline-color
alias oc
outline-color:${1};${2}
snippet outline-style
alias os
outline-style:${1};${2}
snippet outline-width
alias ow
outline-width:${1};${2}
snippet color
alias c
color:${1};${2}
snippet direction
alias d
direction:${1};${2}
snippet letter-spacing
alias ls
letter-spacing:${1};${2}
snippet line-height
alias lh
line-height:${1};${2}
snippet text-align
alias ta
text-align:${1};${2}
snippet text-decoration
alias td
text-decoration:${1};${2}
snippet text-indent
alias ti
text-indent:${1};${2}
snippet text-transform
alias tt
text-transform:${1};${2}
snippet unicode-bidi
alias ub
unicode-bidi:${1};${2}
snippet white-space
alias ws
white-space:${1};${2}
snippet word-spacing
alias ws
word-spacing:${1};${2}
snippet font
alias f
font:${1};${2}
snippet font-family
alias ff
font-family:${1:"Times New Roman",Georgia,Serif};${2}
snippet font-size
alias fs
font-size:${1};${2}
snippet font-style
alias fs
font-style:${1};${2}
snippet font-weight
alias fw
font-weight:${1};${2}
snippet margin
alias m
margin:${1};${2}
snippet margin-bottom
alias mb
margin-bottom:${1};${2}
snippet margin-top
alias mt
margin-top:${1};${2}
snippet margin-left
alias ml
margin-left:${1};${2}
snippet margin-right
alias mr
margin-right:${1};${2}
snippet padding
alias p
padding:${1};${2}
snippet padding-bottom
alias pb
padding-bottom:${1};${2}
snippet padding-top
alias pt
padding-top:${1};${2}
snippet padding-left
alias pl
padding-left:${1};${2}
snippet padding-right
alias pr
padding-right:${1};${2}
snippet list-style
alias ls
list-style:${1};${2}
snippet list-style-image
alias lsi
list-style-image:${1};${2}
snippet list-style-position
alias lsp
list-style-position:${1};${2}
snippet list-style-type
alias lst
list-style-type:${1};${2}
snippet content
alias c
content:${1};${2}
snippet height
alias h
height:${1};${2}
snippet max-height
alias mah
max-height:${1};${2}
snippet max-width
alias maw
max-width:${1};${2}
snippet min-height
alias mih
min-height:${1};${2}
snippet min-width
alias miw
min-width:${1};${2}
snippet width
alias w
width:${1};${2}

View File

@@ -1,39 +0,0 @@
include c.snip
# Delete snippet depended on C.
delete struct
delete struct_typedef
delete enum
delete main
delete inc
delete inc2
delete Inc
delete Def
delete def
delete once
delete printf
delete fprintf
snippet foreach
abbr foreach() {}
foreach (${1:var}; ${2:list}) {
${3}
}
snippet class
abbr class {}
class ${1:name} {
${2}
}
snippet struct
abbr struct {}
struct ${1:name} {
${2}
}
snippet enum
abbr enum {}
enum ${1:name} {
${2}
}

View File

@@ -1,19 +0,0 @@
snippet ruby_print
abbr <%= %>
<%= ${1:Ruby print code} %>${2}
snippet ruby_code
abbr <% %>
<% ${1:Ruby code} %>${2}
snippet ruby_print_nonl
abbr <%= -%>
<%= ${1:Ruby print code} -%>${2}
snippet ruby_code_nonl
abbr <% -%>
<% ${1:Ruby code} -%>${2}
snippet comment
abbr <%# %>
<%# ${1:Comment} %>${2}

View File

@@ -1,229 +0,0 @@
snippet pu
public
snippet po
protected
snippet pr
private
snippet st
static
snippet fi
final
snippet ab
abstract
snippet cl
class ${1} ${2:extends} ${3:Parent} ${4:implements} ${5:Interface} {
${0}
}
snippet in
interface ${1} ${2:extends} ${3:Parent} {
${0}
}
snippet m
${1:void} ${2:method}(${3}) ${4:throws} {
${0}
}
snippet v
${1:String} ${2:var}${3};
snippet co
static public final ${1:String} ${2:var} = ${3};${4}
snippet cos
static public final String ${1:var} = "${2}";${4}
snippet re
return
snippet as
assert ${1:test} ${2:Failure message};${3}
snippet if
if (${1}) {
${2}
}
snippet elif
else if (${1}) {
${2}
}
snippet wh
while (${1}) {
${2}
}
snippet for
for (${1}; ${2}; ${3}) {
${4}
}
snippet fore
for (${1} : ${2}) {
${3}
}
snippet sw
switch (${1}) {
${2}
}
snippet case
abbr ce
case ${1}:
${2}
${0}
snippet br
break;
snippet de
default:
${0}
snippet ca
catch (${1:Exception} ${2:e}) {
${0}
}
snippet th
throw ${0}
snippet sy
synchronized
snippet im
import
snippet pa
package
snippet tc
public class ${1} extends ${2:TestCase} {
${0}
}
snippet test
public void test${1:Name}() throws Exception {
${0}
}
snippet imt
import junit.framework.TestCase;
${0}
snippet j.u
java.util.
snippet j.i
java.io.
snippet j.b
java.beans.
snippet j.n
java.net
snippet j.m
java.math.
snippet main
public static void main(String[] args) {
${0}
}
snippet pl
System.out.println(${1});${0}
snippet p
System.out.print(${1});${0}
#javadoc
snippet c
/**
* ${0}
*/
snippet a
@author ${0:$TM_FULLNAME}
snippet {code
abbr {
{@code ${0}
snippet d
@deprecated ${0:description}
snippet {docRoot
abbr {
{@docRoot
snippet {inheritDoc
abbr {
{@inheritDoc
snippet {link
abbr {
{@link ${1:target} ${0:label}
snippet {linkplain
abbr {
{@linkplain ${1:target} ${0:label}
snippet {literal
abbr {
{@literal ${0}
snippet param
@param ${1:var} ${0:description}
snippet r
@return ${0:description}
snippet s
@see ${0:reference}
snippet se
@serial ${0:description}
snippet sd
@serialField ${0:description}
snippet sf
@serialField ${1:name} ${2:type} ${0:description}
snippet si
@since ${0:version}
snippet t
@throws ${1:class} ${0:description}
snippet {value
abbr {
{@value ${0}
snippet ver
@version ${0:version}
snippet null
{@code null}

View File

@@ -1,49 +0,0 @@
snippet :f
${1:method_name}: function(${2:attribute}) {
${0}
}
snippet func
alias function
function ${1:function_name}(${2:argument}) {
${0:// body...}
}
snippet proto
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
${0:// body...}
};
snippet f
function(${1}) { ${0:$TM_SELECTED_TEXT} };
snippet if
if (${1:true}) {
${0:$TM_SELECTED_TEXT}
}
snippet ife
if (${1:true}) {
${0:$TM_SELECTED_TEXT}
} else {
}
snippet for
for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) {
${0}
}
snippet forin
for (var ${2:i} in ${1:Things}) {
${0}
};
snippet ;,
${1:value_name}:${0:value},
snippet key
${1:key}: "${2:value}"}${3:, }
snippet timeout
setTimeout(function() {${0}}${2:}, ${1:10});

View File

@@ -1,20 +0,0 @@
snippet func
alias function
function ${1:function_name}(${2:argument})
${0:// body...}
end
snippet if
if (${1:true}) then
${0:$TM_SELECTED_TEXT}
end
snippet for
for ${2:i} = 0, ${1:Things} do
${0}
end
snippet forin
for ${2:k}, ${3:v} in ${1:ipairs(xs)} do
${0}
end

View File

@@ -1,51 +0,0 @@
snippet link
abbr [link][]
[${1:link_id}][]${2}
snippet linkid
abbr [link][id]
[${1:link}][${2:id}]${3}
snippet linkurl
abbr [link](url)
[${1:link}](http://${2:url})${3}
snippet linkemail
abbr [link](email)
[${1:link}](mailto:${2:email})${3}
snippet linkurltitle
abbr [link](url "title")
[${1:link}](${2:url} "${3:title}")${4}
snippet idurl
abbr [id]: url "title"
[${1:id}]: http://${2:url} "${3:title}"
snippet idemail
abbr [id]: email "title"
[${1:id}]: mailto:${2:url} "${3:title}"
snippet altid
abbr ![alt][id]
![${1:alt}][${2:id}]${3}
snippet alturl
abbr ![alt](url)
![${1:alt}](${2:url})${3}
snippet alturltitle
abbr ![alt](url "title")
![${1:alt}](${2:url} "${3:title}")${4}
snippet emphasis1
abbr *emphasis*
*${1}*${2}
snippet emphasis2
abbr _emphasis_
_${1}_${2}
snippet strong1
abbr **strong**
**${1}**${2}
snippet strong2
abbr __strong__
__${1}__${2}
snippet code
abbr `code`
`${1}`${2}

View File

@@ -1,352 +0,0 @@
snippet sel
@selector(${1:method}:)
snippet imp
#import <${1:Cocoa/Cocoa.h}>
snippet Imp
#import "${1}}"
snippet log
abbr NSLog(...)
NSLog(@"${1}")
snippet cl
abbr Class
@interface ${1} : ${2:NSObject}
{
}
@end
@implementation ${1}
- (id)init
{
if((self = [super init]))
{${0}
}
return self;
}
@end
snippet cli
abbr ClassInterface
@interface ${1} : ${2:NSObject}
{${3}
}
${0}
@end
snippet clm
abbr ClassImplementation
@implementation ${1:object}
- (id)init
{
if((self = [super init]))
{${0}
}
return self;
}
@end
snippet cat
abbr Category
@interface ${1:NSObject} (${2:Category})
@end
@implementation ${1} (${2})
${0}
@end
snippet cati
abbr CategoryInterface
@interface ${1:NSObject)} (${2:Category)})
${0}
@end
snippet array
NSMutableArray *${1:array} = [NSMutableArray array];
snippet dict
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];
snippet bez
NSBezierPath *${1:path} = [NSBezierPath bezierPath];
${0}
snippet m
abbr Method
- (${1:id})${2:method}${3:(id)}${4:anArgument}
{
${0}
return nil;
}
snippet M
abbr Method
- (${1:id})${2:method}${3:(id)}${4:anArgument};
snippet cm
abbr ClassMethod
+ (${1:id})${2:method}${3:(id)}${4:anArgument}
{
${0}
return nil;
}
snippet icm
abbr InterfaceClassMethod
+ (${1:id})${0:method};
snippet sm
abbr SubMethod
- (${1:id})${2:method}${3:(id)}${4:anArgument}
{
${1} res = [super ${2:method}]
return res;
}
snippet mi
abbr MethodInitialize
+ (void)initialize
{
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
${0}@"value", @"key",
nil]];
}
snippet obj
- (${1:id})${2:thing}
{
return ${2};
}
- (void)set${2}:(${1})aValue
{
${0}${1}old${2} = ${2};
${2} = [aValue retain];
[old${2} release];
}
snippet iobj
- (${1:id})${2:thing};
- (void)set${2}:(${1})aValue;
snippet str
- (NSString${$1: *)})${1:thing}
{
return ${2};
}
- (void)set${1}:(NSString${2: *})${3}
{
${3} = [${3} copy];
[${2} release];
${2} = ${3};
}
snippet istr
- (NSString${1: *)}${1:thing};
- (void)set${1}:(NSString${2: *})${2};
snippet cd
abbr CoreData
- (${1:id})${2:attribute}
{
[self willAccessValueForKey:@"${2: attribute}"];
${1:id} value = [self primitiveValueForKey:@"${2: attribute}"];
[self didAccessValueForKey:@"${2: attribute}"];
return value;
}
- (void)set${2}:(${1})aValue
{
[self willChangeValueForKey:@"${2: attribute}"];
[self setPrimitiveValue:aValue forKey:@"${2: attribute}"];
[self didChangeValueForKey:@"${2: attribute}"];
}
snippet karray
abbr KVCArry
- (void)addObjectTo${1:Things}:(${2:id})anObject
{
[${3}} addObject:anObject];
}
- (void)insertObject:(${2})anObject in${1}AtIndex:(unsigned int)i
{
[${3} insertObject:anObject atIndex:i];
}
- (${2})objectIn${1}AtIndex:(unsigned int)i
{
return [${3} objectAtIndex:i];
}
- (unsigned int)indexOfObjectIn${1}:(${2})anObject
{
return [${3} indexOfObject:anObject];
}
- (void)removeObjectFrom${1}AtIndex:(unsigned int)i
{
[${3} removeObjectAtIndex:i];
}
- (unsigned int)countOf${1}
{
return [${3} count];
}
- (NSArray${4: *}${1}
{
return ${3}
}
- (void)set${1}:(NSArray${4: *})new${1}
{
[${3} setArray:new${1}];
}
snippet iarray
abbr InterfaceAccessorsForKVCArray
- (void)addObjectTo${1:Things}:(${2:id})anObject;
- (void)insertObject:(${2})anObject in${1}AtIndex:(unsigned int)i;
- (${2})objectIn${1}AtIndex:(unsigned int)i;
- (unsigned int)indexOfObjectIn${1}:(${2})anObject;
- (void)removeObjectFrom${1}AtIndex:(unsigned int)i;
- (unsigned int)countOf${1};
- (NSArray${3: *})${1};
- (void)set${1}:(NSArray${3: *})new${1};
snippet acc
abbr PrimitiveType
- (${1:unsigned int})${2:thing}
{
return ${3};
}
- (void)set${2}:(${1:unsigned int})new${2}
{
${3} = new${2};
}
snippet iacc
abbr Interface:AccessorsForPrimitiveType
- (${1:unsigned int})${2:thing};
- (void)set${2}:($1)new${2};
snippet rdef
abbr ReadDefaultsValue
[[NSUserDefaults standardUserDefaults] objectForKey:${1:key}];
snippet wdef
abbr WriteDefaultsValue
[[NSUserDefaults standardUserDefaults] setObject:${1:object} forKey:${2:key}];
snippet ibo
abbr IBOutlet
IBOutlet ${1}${2: *}${3};
snippet syn
@synthesize ${1:property};
snippet bind
bind:@"${2:binding}" toObject:${3:observableController} withKeyPath:@"${4:keyPath}" options:${5:nil}
snippet reg
[[NSNotificationCenter defaultCenter] addObserver:${1:self} selector:@selector(${3}) name:${2:NSWindowDidBecomeMainNotification} object:${4:nil}];
snippet focus
[self lockFocus];
${0}
[self unlockFocus];
snippet forarray
unsigned int ${1:object}Count = [${2:array} count];
for(unsigned int index = 0; index < ${1}Count; index += 1)
{
${3:id} ${1} = [${2} objectAtIndex:index];
${0}
}
snippet alert
int choice = NSRunAlertPanel(@"${1:Something important!}", @"${2:Something important just happend, and now I need to ask you, do you want to continue?}", @"${3:Continue}", @"${4:Cancel}", nil);
if(choice == NSAlertDefaultReturn) // "${3:Continue}"
{
${0};
}
else if(choice == NSAlertAlternateReturn) // "${4:Cancel}"
{
}
snippet res
${1} Send ${2} to ${1}, if ${1} supports it}${3}
if ([${1:self} respondsToSelector:@selector(${2:someSelector:})])
{
[${1} ${3}];
}
snippet del
if([${1:[self delegate]} respondsToSelector:@selector(${2:selfDidSomething:})])
[${1} ${3}];
snippet format
[NSString stringWithFormat:@"${1}", ${2}]${0}
snippet save
[NSGraphicsContext saveGraphicsState];
${0}
[NSGraphicsContext restoreGraphicsState];
snippet thread
[NSThread detachNewThreadSelector:@selector(${1:method}:) toTarget:${2:aTarget} withObject:${3:anArgument}]
snippet pool
NSAutoreleasePool${TM_C_POINTER: *}pool = [NSAutoreleasePool new];
${0}
[pool drain];

View File

@@ -1,76 +0,0 @@
snippet perl
#!/opt/local/bin/perl
use strict;
use warnings;
${1}
snippet sub
sub ${1:function_name} {
${2:# body...}
}
snippet if
if (${1}) {
${2:# body...}
}
snippet ife
if (${1}) {
${2:# body...}
} else {
${3:# else...}
}
snippet ifee
if (${1}) {
${2:# body...}
} elsif (${3}) {
${4:# elsif...}
} else {
${5:# else...}
}
snippet xif
${1:expression} if ${2:condition};
snippet while
abbr wh
while (${1}) {
${2:# body...}
}
snippet xwhile
abbr xwh
${1:expression} while ${2:condition};
snippet for
for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) {
${3:# body...}
}
snippet fore
for ${1} (${2:expression}){
${3:# body...}
}
snippet xfor
${1:expression} for @${2:array};
snippet unless
abbr un
unless (${1}) {
${2:# body...}
}
snippet xunless
abbr xun
${1:expression} unless ${2:condition};
snippet eval
eval {
${1:# do something risky...}
};
if ($@) {
${2:# handle failure...}
}

View File

@@ -1,260 +0,0 @@
snippet function
abbr function () {}
${1:public }function ${2:FunctionName}(${3})
{
${4:// code...}
}
snippet php
<?php
${1}
?>
snippet pecho
<?php echo ${1} ?>${0}
snippet echoh
<?php echo htmlentities(${1}, ENT_QUOTES, 'utf-8') ?>${0}
snippet pfore
<?$php foreach ($${1:variable} as $${2:key}${3: =>}): ?>
${0}
<?php endforeach ?>
snippet pife
<?php if (${1:condition}): ?>
${2}
<?php else: ?>
${0}
<?php endif ?>
snippet pif
<?php if (${1:condition}): ?>
${0}
<?php endif ?>
snippet pelse
<?php else: ?>
snippet this
<?php $this->${0} ?>
snippet ethis
<?php echo $this->${0} ?>
snippet docc
/**
* ${3:undocumented class variable}
*
* @var ${4:string}
**/
${1:var} $${2};${0}
snippet docd
/**
* ${3:undocumented constant}
**/
define(${1} ${2});${0}
snippet docs
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6}
**/
${1}function ${2}(${3});${0}
snippet docf
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6}
**/
${1}function ${2}(${3})
{
${0}
}
snippet doch
/**
* ${1}
*
* @author ${2}
* @version ${3}
* @copyright ${4}
* @package ${5:default}
**/
/**
* Define DocBlock
**/
snippet doci
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4}
**/
interface ${1}
{
${0}
} // END interface ${1}
snippet c
/**
* $0
*/
snippet class
/**
* ${1}
*/
class ${2:ClassName}${3:extends}}
{
$5
function ${4:__construct}(${5:argument})
{
${0:# code...}
}
}
snippet def
${1}defined('${2}')${0}
snippet do
do {
${0:# code...}
} while (${1});
snippet if?
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b} ;
snippet ifelse
if (${1:condition}) {
${2:# code...}
} else {
${3:# code...}
}
${0}
snippet if
if (${1:condition}) {
${0:# code...}
}
snippet echo
echo "${1:string}"${0};
snippet else
else {
${0:# code...}
}
snippet elseif
elseif (${1:condition}) {
${0:# code...}
}
snippet for
for ($${1:i}=${2:0}; $${1:i} < ${3}; $${1:i}++) {
${0:# code...}
}
snippet fore
foreach ($${1:variable} as $${2:key}${3: =>} $${4:value}) {
${0:# code...}
}
snippet con
function __construct(${1})
{
${0}
}
snippet here
<<<${1:HTML}
${2:content here}
$1;
snippet inc
include '${1:file}';${0}
snippet inco
include_once '${1:file}';${0}
snippet array
$${1:arrayName} = array('${2}' => ${3} ${0});
snippet req
require '${1:file}';${0}
snippet reqo
require_once '${1:file}';${0}
snippet ret
return${1};${0}
snippet retf
return false;
snippet rett
return true;
snippet case
case '${1:variable}':
${0:# code...}
break;
snippet switch
abbr sw
switch (${1:variable}) {
case '${2:value}':
${3:# code...}
break;
${0}
default:
${4:# code...}
break;
}
snippet throw
throw new ${1}Exception(${2:"${3:Error Processing Request}"}${4:});
${0}
snippet while
abbr wh
while (${1}) {
${0:# code...}
}
snippet gloabals
\$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${0}
snippet cookie
\$_COOKIE['${1:variable}']
snippet env
\$_ENV['${1:variable}']
snippet files
\$_FILES['${1:variable}']
snippet get
\$_GET['${1:variable}']
snippet post
\$_POST['${1:variable}']
snippet request
\$_REQUEST['${1:variable}']
snippet server
\$_SERVER['${1:variable}']
snippet session
\$_SESSION['${1:variable}']

View File

@@ -1,85 +0,0 @@
snippet class
abbr class Class(...): ...
prev_word '^'
class ${1:name}(${2:object}):
"""${3:class documentation}"""
def __init__(self, ${4}):
"""${5:__init__ documentation}"""
${6:pass}
snippet def
abbr def function(...): ...
prev_word '^'
def ${1:name}(${2}):
"""${3:function documentation}"""
${4:pass}
snippet defm
abbr def method(self, ...): ...
prev_word '^'
def ${1:name}(self, ${2}):
"""${3:method documentation}"""
${4:pass}
snippet elif
abbr elif ...: ...
prev_word '^'
elif ${1:condition}:
${2:pass}
snippet else
abbr else: ...
prev_word '^'
else:
${1:pass}
snippet fileidiom
abbr f = None try: f = open(...) finally: ...
prev_word '^'
${1:f} = None
try:
$1 = open(${2})
${3}
finally:
if $1:
$1.close()
snippet for
abbr for ... in ...: ...
prev_word '^'
for ${1:value} in ${2:list}:
${3:pass}
snippet if
abbr if ...: ...
prev_word '^'
if ${1:condition}:
${2:pass}
snippet ifmain
abbr if __name__ == '__main__': ...
prev_word '^'
if __name__ == '__main__':
${1:pass}
snippet tryexcept
abbr try: ... except ...: ...
prev_word '^'
try:
${1:pass}
except ${2:ExceptionClass}:
${3:pass}
snippet tryfinally
abbr try: ... finally: ...
prev_word '^'
try:
${1:pass}
finally:
${2:pass}
snippet while
abbr while ...: ...
prev_word '^'
while ${1:condition}:
${2:pass}

View File

@@ -1,163 +0,0 @@
snippet rr
abbr render
render
snippet ra
abbr render :action
render :action =>
snippet rc
abbr render :controller
render :controller =>
snippet rf
abbr render :file
render :file =>
snippet ri
abbr render :inline
render :inline =>
snippet rj
abbr render :json
render :json =>
snippet rl
abbr render :layout
render :layout =>
snippet rp
abbr render :partial
render :partial =>
snippet rt
abbr render :text
render :text =>
snippet rx
abbr render :xml
render :xml =>
snippet dotiw
abbr distance_of_time_in_words
distance_of_time_in_words
snippet taiw
abbr time_ago_in_words
time_ago_in_words
snippet re
abbr redirect_to
redirect_to
snippet rea
abbr redirect_to :action
redirect_to :action =>
snippet rec
abbr redirect_to :controller
redirect_to :controller =>
snippet rst
abbr respond_to
respond_to
snippet bt
abbr belongs_to
belongs_to
snippet ho
abbr has_one
has_one
snippet hm
abbr has_many
has_many
snippet habtm
abbr has_and_belongs_to_many
has_and_belongs_to_many
snippet co
abbr composed_of
composed_of
snippet va
abbr validates_associated
validates_associated
snippet vb
abbr validates_acceptance_of
validates_acceptance_of
snippet vc
abbr validates_confirmation_of
validates_confirmation_of
snippet ve
abbr validates_exclusion_of
validates_exclusion_of
snippet vf
abbr validates_format_of
validates_format_of
snippet vi
abbr validates_inclusion_of
validates_inclusion_of
snippet vl
abbr validates_length_of
validates_length_of
snippet vn
abbr validates_numericality_of
validates_numericality_of
snippet vp
abbr validates_presence_of
validates_presence_of
snippet vu
abbr validates_uniqueness_of
validates_uniqueness_of
snippet logd
abbr logger.debug
logger.debug
snippet logi
abbr logger.info
logger.info
snippet logw
abbr logger.warn
logger.warn
snippet loge
abbr logger.error
logger.error
snippet logf
abbr logger.fatal
logger.fatal
snippet action
abbr :action =>
:action =>
snippet co_
abbr :co________ =>
:co________ =>
snippet id
abbr :id =>
:id =>
snippet object
abbr :object =>
:object =>
snippet partial
abbr :partial =>
:partial =>

View File

@@ -1,50 +0,0 @@
snippet if
abbr if end
if ${1:condition}
${2}
end
snippet def
abbr def end
def ${1:method_name}
${2}
end
snippet do
abbr do end
do
${1}
end
snippet dovar
abbr do |var| end
do |${1:var}|
${2}
end
snippet block
abbr { }
{
${1}
}
snippet blockvar
abbr {|var| }
{|${1:var}|
${2}
}
snippet fileopen
abbr File.open(filename) do end
File.open(${1:filename}, '${2:w}') do |${3:io}|
${0}
end
snippet edn
abbr => end?
end
snippet urlencode
# coding: utf-8
require 'erb'
puts ERB::Util.url_encode '${1}'

View File

@@ -1,59 +0,0 @@
snippet if
if [ ${1:condition} ]; then
${0:#statements}
fi
snippet el
else
${0:#statements}
snippet elif
elif [ ${1:condition} ]; then
${0:#statements}
snippet for
for ${1:i} in ${2:words}; do
${0:#statements}
done
snippet wh
abbr while
while ${1:condition} ; do
${0:#statements}
done
snippet until
until ${1:condition} ; do
${0:#statements}
done
snippet case
case ${1:word} in
${2:pattern} )
${0}
;;
esac
snippet h
<<${1}
${0}
snippet env
#!/usr/bin/env ${1}
snippet tmp
${1:TMPFILE}="mktemp -t ${2:untitled}"
trap "rm -f '$${1}'" 0 # EXIT
trap "rm -f '$${1}'; exit 1" 2 # INT
trap "rm -f '$${1}'; exit 1" 1 15 # HUP TERM
${0}

View File

@@ -1,8 +0,0 @@
snippet snippet
abbr snippet abbr prev_word <snippet code>
alias snip
prev_word '^'
snippet ${1:trigger}
abbr ${2:abbr}
prev_word '^'
${3:snippet code}

View File

@@ -1,431 +0,0 @@
snippet mathexpression
abbr $ expression $
$${1:expression}$${2}
# ========== ENVIRONMENT ==========
snippet begin
alias \begin
\begin{${1:type}}
${2}
\end{$1}
${0}
snippet list
alias \begin{list}
\begin{list}
${1}
\end{list}
${0}
snippet quotation
alias \begin{quotation}
\begin{quotation}
${1}
\end{quotation}
${0}
snippet description
alias \begin{description}
\begin{description}
\item ${1}
\end{description}
${0}
snippet sloppypar
alias \begin{sloppypar}
\begin{sloppypar}
${1}
\end{sloppypar}
${0}
snippet enumerate
alias \begin{enumerate}
\begin{enumerate}
\item ${1}
\end{enumerate}
${0}
snippet theindex
alias \begin{theindex}
\begin{theindex}
${1}
\end{theindex}
${0}
snippet itemize
alias \begin{itemize}
\begin{itemize}
\item ${1}
\end{itemize}
${0}
snippet titlepage
alias \begin{titlepage}
\begin{titlepage}
${1}
\end{titlepage}
${0}
snippet verbatim
alias \begin{verbatim}
\begin{verbatim}
${1}
\end{verbatim}
${0}
snippet verbatimtab
alias \begin{verbatimtab}
\begin{verbatimtab}[${1:8}]
${2}
\end{verbatim}
${0}
snippet trivlist
alias \begin{trivlist}
\begin{trivlist}
${1}
\end{trivlist}
${0}
snippet verse
alias \begin{verse}
\begin{verse}
${1}
\end{verse}
${0}
snippet table
alias \begin{table}
\begin{table}
${1}
\end{table}
${0}
snippet thebibliography
alias \begin{thebibliography}
\begin{thebibliography}
${1}
\end{thebibliography}
${0}
snippet tabbing
alias \begin{tabbing}
\begin{tabbing}
${1}
\end{tabbing}
${0}
snippet note
alias \begin{note}
\begin{note}
${1}
\end{note}
${0}
snippet tabular
alias \begin{tabular}
\begin{tabular}{${1}}
${2}
\end{tabular}
${0}
snippet overlay
alias \begin{overlay}
\begin{overlay}
${1}
\end{overlay}
${0}
snippet array
alias \begin{array}
\begin{array}
${1}
\end{array}
${0}
snippet slide
alias \begin{slide}
\begin{slide}
${1}
\end{slide}
${0}
snippet displaymath
alias \begin{displaymath}
\begin{displaymath}
${1}
\end{displaymath}
${0}
snippet abstract
alias \begin{abstract}
\begin{abstract}
${1}
\end{abstract}
${0}
snippet eqnarray
alias \begin{eqnarray}
\begin{eqnarray}
${1}
\end{eqnarray}
${0}
snippet eqnarray*
alias \begin{eqnarray*}
\begin{eqnarray*}
${1}
\end{eqnarray}
${0}
snippet appendix
alias \begin{appendix}
\begin{appendix}
${1}
\end{appendix}
${0}
snippet equation
alias \begin{equation}
\begin{equation}
${1}
\end{equation}
${0}
snippet center
alias \begin{center}
\begin{center}
${1}
\end{center}
${0}
snippet document
alias \begin{document}
\begin{document}
${1}
\end{document}
${0}
snippet figure
alias \begin{figure}
\begin{figure}
\begin{center}
\includegraphics[${1:width=}]{${2}}
\caption{${3}}
\label{${4}}
\end{center}
\end{figure}
${0}
snippet filecontents
alias \begin{filecontents}
\begin{filecontents}
${1}
\end{filecontents}
${0}
snippet lrbox
alias \begin{lrbox}
\begin{lrbox}
${1}
\end{lrbox}
${0}
snippet flushleft
alias \begin{flushleft}
\begin{flushleft}
${1}
\end{flushleft}
${0}
snippet minipage
alias \begin{minipage}
\begin{minipage}
${1}
\end{minipage}
${0}
snippet flushright
alias \begin{flushright}
\begin{flushright}
${1}
\end{flushright}
${0}
snippet picture
alias \begin{picture}
\begin{picture}
${1}
\end{picture}
${0}
snippet math
alias \begin{math}
\begin{math}
${1}
\end{math}
${0}
snippet quote
alias \begin{quote}
\begin{quote}
${1}
\end{quote}
${0}
# ========== SECTION ==========
snippet part
alias \begin{part}
\begin{part}
${1}
\end{part}
${0}
snippet chapter
alias \begin{chapter}
\begin{chapter}
${1}
\end{chapter}
${0}
snippet \chapter
alias \chapter{
\chapter{${1}}
${0}
snippet section
alias \begin{section}
\begin{section}
${1}
\end{section}
${0}
snippet \section
alias \section{
\section{${1}}
${0}
snippet subsection
alias \begin{subsection}
\begin{subsection}
${1}
\end{subsection}
${0}
snippet \subsection
alias \subsection{
\subsection{${1}}
${0}
snippet subsubsection
alias \begin{subsubsection}
\begin{subsubsection}
${1}
\end{subsubsection}
${0}
snippet \subsubsection
alias \subsubsection{
\subsubsection{${1}}
${0}
snippet paragraph
alias \begin{paragraph}
\begin{paragraph}
${1}
\end{paragraph}
${0}
snippet \paragraph
alias \paragraph{
\paragraph{${1}}
${0}
snippet subparagraph
alias \begin{subparagraph}
\begin{subparagraph}
${1}
\end{subparagraph}
${0}
snippet \subparagraph
alias \subparagraph{
\subparagraph{${1}}
${0}
# ========== FONT ==========
snippet bfseries
alias \begin{bfseries}
\begin{bfseries}
${1}
\end{bfseries}
snippet mdseries
alias \begin{mdseries}
\begin{mdseries}
${1}
\end{mdseries}
snippet ttfamily
alias \begin{ttfamily}
\begin{ttfamily}
${1}
\end{ttfamily}
snippet sffamily
alias \begin{sffamily}
\begin{sffamily}
${1}
\end{sffamily}
snippet rmfamily
alias \begin{rmfamily}
\begin{rmfamily}
${1}
\end{rmfamily}
snippet upshape
alias \begin{upshape}
\begin{upshape}
${1}
\end{upshape}
snippet slshape
alias \begin{slshape}
\begin{slshape}
${1}
\end{slshape}
snippet scshape
alias \begin{scshape}
\begin{scshape}
${1}
\end{scshape}
snippet itshape
alias \begin{itshape}
\begin{itshape}
${1}
\end{itshape}
# ========== OTHERS ==========
snippet usepackage
alias \usepackage
\usepackage${1:[${2\}]}{${3}}
${0}
snippet \ref
alias \ref{
\ref{${1}}${0}
snippet \label
alias \label{
\label{${1}}${0}
snippet \cite
alias \cite{
\cite{${1}}${0}

View File

@@ -1,67 +0,0 @@
snippet if
abbr if endif
prev_word '^'
if ${1:condition}
${0}
endif
snippet elseif
prev_word '^'
else if ${1:/* condition */}
${0}
snippet ifelse
abbr if else endif
prev_word '^'
if ${1:condition}
${2}
else
${3}
endif
snippet for
abbr for in endfor
prev_word '^'
for ${1:var} in ${2:list}
${0}
endfor
snippet while
abbr while endwhile
prev_word '^'
while ${1:condition}
${0}
endwhile
snippet function
abbr func endfunc
alias func
prev_word '^'
function! ${1:func_name}(${2})
${0}
endfunction
snippet try
abbr try endtry
prev_word '^'
try
${1}
catch /${2:pattern}/
${3}
endtry
snippet log
prev_word '^'
echomsg string(${1})
snippet command
abbr command call function
prev_word '^'
command! ${1:command_name} call ${2:func_name}
snippet customlist
abbr customlist complete function
prev_word '^'
function! ${1:func_name}(arglead, cmdline, cursorpos)
return filter(${2:list}, 'stridx(v:val, a:arglead) == 0')
endfunction

View File

@@ -1,4 +0,0 @@
snippet sl
abbr => ls?
ls

View File

@@ -1,235 +0,0 @@
snippet doctypetransitional
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
snippet doctypeframeset
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
snippet doctypestrict
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet xhtml
<html xmlns="http://www.w3.org/1999/xhtml">
${1}
</html>
snippet head
<head>
<meta http-equiv="content-type" content="text/html; charset=${1:utf-8}">
<title>${2}</title>
<style type="text/css">
${3}
</style>
${4}
</head>${5}
snippet metaauthor
<meta name="author" content="${1}">${2}
snippet keywords
<meta name="keywords" content="${1}">${2}
snippet metaothers
<meta name="others" content="${1}">${2}
snippet metagenerator
<meta name="generator" content="${1}">${2}
snippet metadescription
<meta name="description" content="${1}">${2}
snippet scriptcharset
<script type="text/javascript" charset="${1:UTF-8}">
${2}
</script>${3}
snippet script
<script type="text/javascript">
${1}
</script>${2}
snippet body
<body>
${1}
</body>
snippet h
<h${1:1}>${2}</h$1>${3}
snippet p
<p>${1}</p>${2}
snippet br
<br />
snippet hr
<hr />
snippet comment
<!--${1}-->${2}
snippet b
<b>${1}</b>${2}
snippet small
<small>${1}</small>${2}
snippet strong
<strong>${1}</strong>${2}
snippet sub
<sub>${1}</sub>${2}
snippet sup
<sup>${1}</sup>${2}
snippet ins
<ins>${1}</ins>${2}
snippet del
<del>${1}</del>${2}
snippet em
<em>${1}</em>${2}
snippet bdo
<bdo dir="${1:rtl}">${2}</bdo>${3}
snippet pre
<pre>
${1}
</pre>${2}
snippet blockquote
<blockquote>
${1}
</blockquote>
${2}
snippet link
abbr link stylesheet css
<link rel="${1:stylesheet}" href="${2}.css" type="text/css" media="${3:screen}" charset="utf-8">${4}
snippet alignl
text-align="left"
snippet alignr
text-align="right"
snippet alignc
text-align="center"
snippet bgcolor
bgcolor="${1}"${2}
snippet ahref
<a href="${1}">${2}</a>${3}
snippet ahref_blank
<a href="${1}" target="_blank">${2}</a>${3}
snippet ahref_parent
<a href="${1}" target="_parent">${2}</a>${3}
snippet ahref_top
<a href="${1}" target="_top">${2}</a>${3}
snippet aname
<a name="${1}">${2}</a>${3}
snippet framesetcols
<frameset cols="${1}">
${2}
</frameset>${3}
snippet framesetrows
<frameset rows="${1}"
${2}
</frameset>${3}
snippet iframe
<iframe src="${1}"></iframe>${2}
snippet table
<table border="${1}">
${2}
</table>${3}
snippet th
<th>${1}</th>${2}
snippet ulsquare
<ul type="square">${1}</ul>${2}
snippet ulcircle
<ul type="circle">${1}</ul>${2}
snippet uldisc
<ul type="disc">${1}</ul>${2}
snippet ol
<ol>${1}</ol>${2}
snippet olA
<ol type="A">${1}</ol>${2}
snippet ola
<ol type="a">${1}</ol>${2}
snippet olI
<ol type="I">${1}</ol>${2}
snippet oli
<ol type="i">${1}</ol>${2}
snippet li
<li>${1}</li>${2}
snippet dl
<dl>${1}</dl>${2}
snippet dt
<dt>${1}</dt>${2}
snippet dd
<dd>${1}</dd>${2}
snippet form
<form>
${1}
</form>${2}
snippet inputtext
<input type="text" name="${1:user}">${2}
snippet inputpassword
<input type="password" name="${1:password}">${2}
snippet inputradio
<input type="radio" name="${1}" value="value">${2}
snippet inputcheckbox
<input type="checkbox" name="${1}">${2}
snippet textarea
<textarea rows="${1}" cols="${2}">
${3}
</textarea>
${4}
snippet button
<button>${1}</button>${2}
snippet select
<select>${1}</select>${2}
snippet optgroup
<optgroup label="${1}">
${2}
<optgroup>${3}
snippet option
<option value="${1}">${2}</option>${3}
snippet label
<label>${1}: <input type="${2}" /><label>${3}
snippet labelfor
<label for="${1}:id">${2}</label>${3}
snippet fiedset
<fiedlset>${1}</fiedset>${2}
snippet legend
<legend>${1}</legend>${2}
snippet id
id="${1}"${2}
snippet class
class="${1}"${2}
snippet pclass
<p class="${1}">${2}</p>${3}
snippet pid
<p id="${1}">${2}</p>${3}
snippet divid
<div id="${1}">${2}</div>${3}
snippet divclass
<div class="${1}">${2}</div>${3}
snippet img
<img src="${1}">${2}
snippet div
<div ${1:id="${2:someid\}"}>${3}</div>${4}