commit 81c4b428c2b202fe19187ac8da3df947ce91384a Author: Shougo Matsushita Date: Thu Feb 2 13:33:35 2012 +0900 - Initial version. diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim new file mode 100644 index 0000000..bcaae2e --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete.vim @@ -0,0 +1,797 @@ +"============================================================================= +" FILE: snippets_complete.vim +" AUTHOR: Shougo Matsushita +" Last Modified: 15 Jan 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 +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be included +" in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +" }}} +"============================================================================= + +let s:save_cpo = &cpo +set cpo&vim + +let s:begin_snippet = 0 +let s:end_snippet = 0 + +if !exists('s:snippets') + let s:snippets = {} +endif + +let s:source = { + \ 'name' : 'snippets_complete', + \ 'kind' : 'plugin', + \} + +function! s:source.initialize()"{{{ + " Initialize. + let s:snippets = {} + let s:begin_snippet = 0 + let s:end_snippet = 0 + let s:snippet_holder_cnt = 1 + + if !exists('g:neocomplcache_snippets_disable_runtime_snippets') + let g:neocomplcache_snippets_disable_runtime_snippets = 0 + endif + + call neocomplcache#set_dictionary_helper( + \ g:neocomplcache_plugin_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, ',') + \ : split(globpath(&runtimepath, 'snippets'), '\n')) + \ + s:runtime_dir + endif + + if exists('g:neocomplcache_snippets_dir') + for dir in split(g:neocomplcache_snippets_dir, ',') + 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(':t:r')) + " Detect syntax file. + autocmd BufNewFile,BufRead *.snip,*.snippets set filetype=snippet + augroup END"}}} + + if has('conceal') + " Supported conceal features. + augroup neocomplcache + autocmd BufNewFile,BufRead,ColorScheme * + \ syn match neocomplcacheExpandSnippets + \ '\${\d\+\%(:.\{-}\)\?\\\@\|\$\d\+' conceal cchar=$ + augroup END + else + augroup neocomplcache + autocmd BufNewFile,BufRead,ColorScheme * + \ syn match neocomplcacheExpandSnippets + \ '\${\d\+\%(:.\{-}\)\?\\\@\|\$\d\+' + augroup END + endif + + hi def link NeoComplCacheExpandSnippets Special + + command! -nargs=? -complete=customlist,neocomplcache#filetype_complete + \ NeoComplCacheEditSnippets call s:edit_snippets(, 0) + command! -nargs=? -complete=customlist,neocomplcache#filetype_complete + \ NeoComplCacheEditRuntimeSnippets call s:edit_snippets(, 1) + command! -nargs=? -complete=customlist,neocomplcache#filetype_complete + \ NeoComplCacheCachingSnippets call s:caching_snippets() + + " Select mode mappings. + if !exists('g:neocomplcache_disable_select_mode_mappings') + snoremap a + snoremap a + snoremap a + snoremap bi + snoremap ' a' + snoremap ` a` + snoremap % a% + snoremap U aU + snoremap ^ a^ + snoremap \ a\ + snoremap a + 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()"{{{ + delcommand NeoComplCacheEditSnippets + delcommand NeoComplCacheEditRuntimeSnippets + delcommand NeoComplCacheCachingSnippets + + hi clear NeoComplCacheExpandSnippets + + if neocomplcache#exists_echodoc() + call echodoc#unregister('snippets_complete') + endif +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 filetype = neocomplcache#get_context_filetype() + if !has_key(s: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 [] + 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' }) + call add(ret, { 'text' : ' ' }) + call add(ret, { 'text' : snip.snip}) + + return ret +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 list = filter(a:list, pattern) + + " Substitute abbr. + let abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10) + for snippet in list + if snippet.snip =~ '\\\@= 0 && + \ len(snippet.menu) > g:neocomplcache_max_keyword_width + let snippet.menu = printf(abbr_pattern, snippet.menu, snippet.menu[-8:]) + endif + let snippet.menu = '`Snip` ' . snippet.menu + endif + endfor + + return list +endfunction"}}} + +function! neocomplcache#sources#snippets_complete#expandable()"{{{ + let snippets = neocomplcache#sources#snippets_complete#get_snippets() + let cur_text = neocomplcache#get_cur_text(1) + + let ret = 0 + + if s:get_cursor_keyword_snippet(snippets, cur_text) != '' + " Found snippet trigger. + let ret += 1 + endif + + if search('\${\d\+\%(:.\{-}\)\?\\\@', 'nw') > 0 + " Found snippet placeholder. + let ret += 2 + endif + + return ret +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') + 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 + + if has_key(a:snippet_pattern, 'alias') + for alias in 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 + endif + + 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 + endif +endfunction"}}} +function! s:set_snippet_pattern(dict)"{{{ + let abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10) + + let word = substitute(a:dict.word, '\%(<\\n>\)\+$', '', '') + let menu_pattern = a:dict.word =~ '\${\d\+\%(:.\{-}\)\?\\\@ ' : '[Snip] ' + + let abbr = has_key(a:dict, 'abbr')? a:dict.abbr : + \substitute(a:dict.word, '\${\d\+\%(:.\{-}\)\?\\\@\|\$\d\+\|<\%(\\n\|\\t\)>\|\s\+', ' ', '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' : word, 'abbr' : a:dict.name, + \ 'description' : 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') + 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 = matchstr(line, '^\s\+\zs.*$') + elseif line =~ '^\t' + let line = substitute(line, '^\s', '', '') + let snippet_pattern.word .= '<\n>' . + \ substitute(line, '^\t\+', repeat('<\\t>', + \ matchend(line, '^\t\+')), '') + else + let snippet_pattern.word .= '<\n>' . matchstr(line, '^\s\+\zs.*$') + endif + elseif line =~ '^$' + " Blank line. + let snippet_pattern.word .= '<\n>' + endif + endif + + let linenr += 1 + endfor + + " 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\+$') + if !has_key(a:snippets, 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 != '' + " 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('\${\d\+\%(:.\{-}\)\?\\\@', '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 =~ '\\\@', 'g') + endif + + " Substitute escaped `. + let snip_word = substitute(snip_word, '\\`', '`', 'g') + + " Insert snippets. + let next_line = getline('.')[a:col-1 :] + call setline(line('.'), cur_text . snip_word . next_line) + let pos = getpos('.') + let pos[2] = len(cur_text)+len(snip_word)+1 + call setpos('.', pos) + let next_col = len(cur_text)+len(snip_word)+1 + + if snip_word =~ '<\\t>' + call s:expand_tabline() + else + call s:expand_newline() + end + if has('folding') && foldclosed(line('.')) + " Open fold. + silent! normal! zO + endif + if next_col < col('$') + startinsert + else + startinsert! + endif + + if snip_word =~ '\${\d\+\%(:.\{-}\)\?\\\@') + let s:snippet_holder_cnt = 1 + let s:begin_snippet = line('.') + let s:end_snippet = line('.') + + let formatoptions = &l:formatoptions + setlocal formatoptions-=r + + while match >= 0 + let end = getline('.')[matchend(getline('.'), '<\\n>') :] + " Substitute CR. + silent! execute 's/<\\n>//' . (&gdefault ? 'g' : '') + + " Return. + let pos = getpos('.') + let pos[2] = match+1 + call setpos('.', pos) + silent execute 'normal!' + \ (match+1 >= col('$')? 'a' : 'i')."\" + + " Next match. + let match = match(getline('.'), '<\\n>') + let s:end_snippet += 1 + endwhile + + let &l:formatoptions = formatoptions +endfunction"}}} +function! s:expand_tabline()"{{{ + let tablines = split(getline('.'), '<\\n>') + + let indent = matchstr(tablines[0], '^\s\+') + let line = line('.') + call setline(line, tablines[0]) + for tabline in tablines[1:] + if &expandtab + let tabline = substitute(tabline, '<\\t>', + \ repeat(' ', &softtabstop ? &softtabstop : &shiftwidth), 'g') + else + let tabline = substitute(tabline, '<\\t>', '\t', 'g') + endif + + call append(line, indent . tabline) + let line += 1 + endfor + + let s:snippet_holder_cnt = 1 + let s:begin_snippet = line('.') + let s:end_snippet = line('.') + len(tablines) - 1 +endfunction"}}} +function! s:snippets_force_jump(cur_text, col)"{{{ + if !s:search_snippet_range(s:begin_snippet, s:end_snippet) + if s:snippet_holder_cnt != 0 + " Search placeholder 0. + let s:snippet_holder_cnt = 0 + if s:search_snippet_range(s:begin_snippet, s:end_snippet) + return 1 + endif + endif + + " Not found. + let s:begin_snippet = 1 + let s:end_snippet = 0 + let s:snippet_holder_cnt = 1 + + return s:search_outof_range(a:col) + endif + + return 0 +endfunction"}}} +function! s:search_snippet_range(start, end)"{{{ + call s:substitute_marker(a:start, a:end) + + let pattern = '\${'.s:snippet_holder_cnt.'\%(:.\{-}\)\?\\\@ 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 = '\${'.a:holder_cnt.'\%(:.\{-}\)\?\\\@ 0 + let pattern = '\${' . cnt . '\%(:.\{-}\)\?\\\@', '')) + 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) . "\" + 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(a:start), + \ '\${\zs\d\+\ze\%(:.\{-}\)\?\\\@ 0 ? cnt : 0 + endif + + let pattern = '\$'.a:number.'\d\@!' + for line in filter(range(a:start, a:end), + \ 'getline(v:val) =~ pattern') + return s:snippet_holder_cnt + endfor + + return 0 +endfunction"}}} +function! s:substitute_marker(start, end)"{{{ + if s:snippet_holder_cnt > 1 + let cnt = s:snippet_holder_cnt-1 + let marker = '\$<'.cnt.'\%(:.\{-}\)\?\\\@' + let line = a:start + while line <= a:end + if getline(line) =~ marker + let sub = escape(matchstr(getline(line), '\$<'.cnt.':\zs.\{-}\ze\\\@'), '/\') + silent! execute printf('%d,%ds/$%d\d\@!/%s/' . (&gdefault ? '' : 'g'), + \a:start, a:end, cnt, sub) + silent! execute line.'s/'.marker.'/'.sub.'/' . (&gdefault ? 'g' : '') + break + endif + + let line += 1 + endwhile + elseif search('\$<\d\+\%(:.\{-}\)\?\\\@', 'wb') > 0 + let sub = escape(matchstr(getline('.'), '\$<\d\+:\zs.\{-}\ze\\\@'), '/\') + let cnt = matchstr(getline('.'), '\$<\zs\d\+\ze\%(:.\{-}\)\?\\\@') + silent! execute printf('%%s/$%d\d\@!/%s/' . (&gdefault ? 'g' : ''), cnt, sub) + silent! execute '%s/'.'\$<'.cnt.'\%(:.\{-}\)\?\\\@'.'/'.sub.'/' + \ . (&gdefault ? 'g' : '') + endif +endfunction"}}} +function! s:trigger(function)"{{{ + let cur_text = neocomplcache#get_cur_text(1) + return printf("\:call %s(%s,%d)\", a:function, string(cur_text), col('.')) +endfunction"}}} +function! s:eval_snippet(snippet_text)"{{{ + let snip_word = '' + let prev_match = 0 + let match = match(a:snippet_text, '\\\@= 0 + if match - prev_match > 0 + let snip_word .= a:snippet_text[prev_match : match - 1] + endif + let prev_match = matchend(a:snippet_text, '\\\@= 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 +endfunction"}}} + +function! s:SID_PREFIX() + return matchstr(expand(''), '\d\+_') +endfunction + +" Plugin key-mappings. +inoremap (neocomplcache_snippets_expand) + \ trigger(SID_PREFIX().'snippets_expand_or_jump') +snoremap (neocomplcache_snippets_expand) + \ trigger(SID_PREFIX().'snippets_expand_or_jump') +inoremap (neocomplcache_snippets_jump) + \ trigger(SID_PREFIX().'snippets_jump_or_expand') +snoremap (neocomplcache_snippets_jump) + \ trigger(SID_PREFIX().'snippets_jump_or_expand') +inoremap (neocomplcache_snippets_force_expand) + \ trigger(SID_PREFIX().'snippets_force_expand') +snoremap (neocomplcache_snippets_force_expand) + \ trigger(SID_PREFIX().'snippets_force_expand') +inoremap (neocomplcache_snippets_force_jump) + \ trigger(SID_PREFIX().'snippets_force_jump') +snoremap (neocomplcache_snippets_force_jump) + \ trigger(SID_PREFIX().'snippets_force_jump') + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: foldmethod=marker diff --git a/autoload/neocomplcache/sources/snippets_complete/_.snip b/autoload/neocomplcache/sources/snippets_complete/_.snip new file mode 100644 index 0000000..ed904fb --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/_.snip @@ -0,0 +1,16 @@ +# 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")` diff --git a/autoload/neocomplcache/sources/snippets_complete/actionscript.snip b/autoload/neocomplcache/sources/snippets_complete/actionscript.snip new file mode 100644 index 0000000..8497f99 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/actionscript.snip @@ -0,0 +1,273 @@ +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} + }; + diff --git a/autoload/neocomplcache/sources/snippets_complete/apache.snip b/autoload/neocomplcache/sources/snippets_complete/apache.snip new file mode 100644 index 0000000..e33909d --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/apache.snip @@ -0,0 +1,23 @@ +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 + + ServerAdmin webmaster@${1} + DocumentRoot /www/vhosts/${1} + ServerName ${1} + ErrorLog logs/${1}-error_log + CustomLog logs/${1}-access_log common + + + +snippet dir + + ${0} + + diff --git a/autoload/neocomplcache/sources/snippets_complete/applescript.snip b/autoload/neocomplcache/sources/snippets_complete/applescript.snip new file mode 100644 index 0000000..66943a1 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/applescript.snip @@ -0,0 +1,201 @@ +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 + + + +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}"\}} + diff --git a/autoload/neocomplcache/sources/snippets_complete/c.snip b/autoload/neocomplcache/sources/snippets_complete/c.snip new file mode 100644 index 0000000..4cce280 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/c.snip @@ -0,0 +1,135 @@ +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} ${2:value} + #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}) + diff --git a/autoload/neocomplcache/sources/snippets_complete/coffee.snip b/autoload/neocomplcache/sources/snippets_complete/coffee.snip new file mode 100644 index 0000000..57acffe --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/coffee.snip @@ -0,0 +1,72 @@ +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...} + diff --git a/autoload/neocomplcache/sources/snippets_complete/cpp.snip b/autoload/neocomplcache/sources/snippets_complete/cpp.snip new file mode 100644 index 0000000..6382791 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/cpp.snip @@ -0,0 +1,37 @@ +include c.snip + +snippet template +abbr template + template + +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} } + diff --git a/autoload/neocomplcache/sources/snippets_complete/css.snip b/autoload/neocomplcache/sources/snippets_complete/css.snip new file mode 100644 index 0000000..88afe84 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/css.snip @@ -0,0 +1,252 @@ +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} + diff --git a/autoload/neocomplcache/sources/snippets_complete/d.snip b/autoload/neocomplcache/sources/snippets_complete/d.snip new file mode 100644 index 0000000..c4f36ba --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/d.snip @@ -0,0 +1,39 @@ +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} + } diff --git a/autoload/neocomplcache/sources/snippets_complete/eruby.snip b/autoload/neocomplcache/sources/snippets_complete/eruby.snip new file mode 100644 index 0000000..6c7702b --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/eruby.snip @@ -0,0 +1,19 @@ +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} diff --git a/autoload/neocomplcache/sources/snippets_complete/java.snip b/autoload/neocomplcache/sources/snippets_complete/java.snip new file mode 100644 index 0000000..daad9b2 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/java.snip @@ -0,0 +1,274 @@ +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} diff --git a/autoload/neocomplcache/sources/snippets_complete/javascript.snip b/autoload/neocomplcache/sources/snippets_complete/javascript.snip new file mode 100644 index 0000000..fdb2a82 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/javascript.snip @@ -0,0 +1,47 @@ +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}); diff --git a/autoload/neocomplcache/sources/snippets_complete/markdown.snip b/autoload/neocomplcache/sources/snippets_complete/markdown.snip new file mode 100644 index 0000000..1dfe682 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/markdown.snip @@ -0,0 +1,51 @@ +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} diff --git a/autoload/neocomplcache/sources/snippets_complete/objc.snip b/autoload/neocomplcache/sources/snippets_complete/objc.snip new file mode 100644 index 0000000..0f3a10d --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/objc.snip @@ -0,0 +1,352 @@ +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]; + + \ No newline at end of file diff --git a/autoload/neocomplcache/sources/snippets_complete/perl.snip b/autoload/neocomplcache/sources/snippets_complete/perl.snip new file mode 100644 index 0000000..76186c4 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/perl.snip @@ -0,0 +1,76 @@ +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...} + } diff --git a/autoload/neocomplcache/sources/snippets_complete/php.snip b/autoload/neocomplcache/sources/snippets_complete/php.snip new file mode 100644 index 0000000..a063e11 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/php.snip @@ -0,0 +1,260 @@ +snippet function +abbr function () {} + ${1:public }function ${2:FunctionName}(${3}) + { + ${4:// code...} + } + +snippet php + + +snippet pecho + ${0} + +snippet echoh + ${0} + +snippet pfore + }): ?> + ${0} + + +snippet pife + + ${2} + + ${0} + + +snippet pif + + ${0} + + +snippet pelse + + +snippet this + ${0} ?> + +snippet ethis + ${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}'] diff --git a/autoload/neocomplcache/sources/snippets_complete/python.snip b/autoload/neocomplcache/sources/snippets_complete/python.snip new file mode 100644 index 0000000..607c93b --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/python.snip @@ -0,0 +1,85 @@ +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} diff --git a/autoload/neocomplcache/sources/snippets_complete/rails.snip b/autoload/neocomplcache/sources/snippets_complete/rails.snip new file mode 100644 index 0000000..94759e3 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/rails.snip @@ -0,0 +1,163 @@ +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 => diff --git a/autoload/neocomplcache/sources/snippets_complete/ruby.snip b/autoload/neocomplcache/sources/snippets_complete/ruby.snip new file mode 100644 index 0000000..e0e06e9 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/ruby.snip @@ -0,0 +1,44 @@ +snippet if +abbr if end + if ${1:condition} + ${2} + end + +snippet def +abbr def end + def ${1:func_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 { |var| } + { + ${1} + } + +snippet blockvar +abbr { |var| } + { |${1:var}| + ${2} + } + +snippet edn +abbr => end? + end + +snippet urlencode + # coding: utf-8 + require 'erb' + puts ERB::Util.url_encode '${1}' diff --git a/autoload/neocomplcache/sources/snippets_complete/sh.snip b/autoload/neocomplcache/sources/snippets_complete/sh.snip new file mode 100644 index 0000000..edcd1e0 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/sh.snip @@ -0,0 +1,59 @@ +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} + \ No newline at end of file diff --git a/autoload/neocomplcache/sources/snippets_complete/snippet.snip b/autoload/neocomplcache/sources/snippets_complete/snippet.snip new file mode 100644 index 0000000..e900e0f --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/snippet.snip @@ -0,0 +1,8 @@ +snippet snippet +abbr snippet abbr prev_word +alias snip +prev_word '^' + snippet ${1:trigger} + abbr ${2:abbr} + prev_word '^' + ${3:snippet code} diff --git a/autoload/neocomplcache/sources/snippets_complete/tex.snip b/autoload/neocomplcache/sources/snippets_complete/tex.snip new file mode 100644 index 0000000..6db011d --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/tex.snip @@ -0,0 +1,431 @@ +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} + diff --git a/autoload/neocomplcache/sources/snippets_complete/vim.snip b/autoload/neocomplcache/sources/snippets_complete/vim.snip new file mode 100644 index 0000000..f57ef62 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/vim.snip @@ -0,0 +1,67 @@ +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 diff --git a/autoload/neocomplcache/sources/snippets_complete/vimshell.snip b/autoload/neocomplcache/sources/snippets_complete/vimshell.snip new file mode 100644 index 0000000..6a93c92 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/vimshell.snip @@ -0,0 +1,4 @@ +snippet sl +abbr => ls? + ls + diff --git a/autoload/neocomplcache/sources/snippets_complete/xhtml.snip b/autoload/neocomplcache/sources/snippets_complete/xhtml.snip new file mode 100644 index 0000000..eebc987 --- /dev/null +++ b/autoload/neocomplcache/sources/snippets_complete/xhtml.snip @@ -0,0 +1,235 @@ +snippet doctypetransitional + + +snippet doctypeframeset + + +snippet doctypestrict + + +snippet xhtml + + ${1} + +snippet head + + + ${2} + + ${4} + ${5} + +snippet metaauthor + ${2} +snippet keywords + ${2} +snippet metaothers + ${2} +snippet metagenerator + ${2} +snippet metadescription + ${2} + +snippet scriptcharset + ${3} +snippet script + ${2} + +snippet body + + ${1} + + +snippet h + ${2}${3} + +snippet p +

${1}

${2} + +snippet br +
+ +snippet hr +
+ +snippet comment + ${2} + +snippet b + ${1}${2} +snippet small + ${1}${2} +snippet strong + ${1}${2} +snippet sub + ${1}${2} +snippet sup + ${1}${2} +snippet ins + ${1}${2} +snippet del + ${1}${2} +snippet em + ${1}${2} +snippet bdo + ${2}${3} +snippet pre +
+    ${1}
+    
${2} +snippet blockquote +
+ ${1} +
+ ${2} +snippet link +abbr link stylesheet css + ${4} + +snippet alignl + text-align="left" +snippet alignr + text-align="right" +snippet alignc + text-align="center" + +snippet bgcolor + bgcolor="${1}"${2} + +snippet ahref + ${2}${3} +snippet ahref_blank + ${2}${3} +snippet ahref_parent + ${2}${3} +snippet ahref_top + ${2}${3} +snippet aname + ${2}${3} + +snippet framesetcols + + ${2} + ${3} +snippet framesetrows + ${3} + +snippet iframe + ${2} +snippet table + + ${2} +
${3} + +snippet th + ${1}${2} + +snippet ulsquare +
    ${1}
${2} +snippet uldisc +
    ${1}
${2} +snippet ulcicle +
    ${1}
${2} + +snippet ol +
    ${1}
${2} +snippet olA +
    ${1}
${2} +snippet ola +
    ${1}
${2} +snippet olI +
    ${1}
${2} +snippet oli +
    ${1}
${2} + +snippet li +
  • ${1}
  • ${2} + +snippet dl +
    ${1}
    ${2} +snippet dt +
    ${1}
    ${2} +snippet dd +
    ${1}
    ${2} + +snippet form +
    + ${1} +
    ${2} + +snippet inputtext + ${2} +snippet inputpassword + ${2} +snippet inputradio + ${2} +snippet inputcheckbox + ${2} + +snippet textarea + + ${4} + +snippet button + ${2} + +snippet select + ${2} + +snippet optgroup + + ${2} + ${3} +snippet option + ${3} + +snippet label +