" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish README [[[1 110 Description: neocomplcache performs keyword completion by making a cache of keyword in buffer. Because I implemented it by paying own expenses unlike the keyword completion including the Vim composing type, neocomplcache can be customized flexibly. Unfortunately neocomplcache may use more memory than other plugins. Installation: 1: Extract the file and Put files in your Vim directory (usually ~/.vim/ or Program Files/Vim/vimfiles on Windows). 2: Execute |:NeoComplCacheEnable| command or let g:neocomplcache_enable_at_startup = 1 in your .vimrc. Caution: Because all variable names are changed in neocomplcache Ver.5, there is not backward compatibility. In the case of the upgrade, you should use the next script which Mr.thinca made. http://gist.github.com/422503 Screen shots: Quick match. http://3.bp.blogspot.com/_ci2yBnqzJgM/TD1PeahCmOI/AAAAAAAAADc/Rz_Pbpr92z4/s1600/quick_match.png Snippet completion like snipMate. http://3.bp.blogspot.com/_ci2yBnqzJgM/SfkgaHXLS0I/AAAAAAAAAA4/TmaylpFl_Uw/s1600-h/Screenshot2.PNG Original filename completion. http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1O5_bOQ2I/AAAAAAAAADE/vHf9Xg_mrTI/s1600/filename_complete.png Register completion. http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1Pel4fomI/AAAAAAAAADk/YsAxF8i6r3w/s1600/register_complete.png Omni completion. http://2.bp.blogspot.com/_ci2yBnqzJgM/TD1PTolkTBI/AAAAAAAAADU/knJ3eniuHWI/s1600/omni_complete.png Completion with vimshell(http://github.com/Shougo/vimshell). http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1PLfdQrwI/AAAAAAAAADM/2pSFRTHwYOY/s1600/neocomplcache_with_vimshell.png Vim completion. http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1PfKTlwnI/AAAAAAAAADs/nOGWTRLuae8/s1600/vim_complete.png Setting examples: " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Use camel case completion. let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion. let g:neocomplcache_enable_underbar_completion = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword. if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif let g:neocomplcache_keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. imap (neocomplcache_snippets_expand) smap (neocomplcache_snippets_expand) inoremap neocomplcache#undo_completion() inoremap neocomplcache#complete_common_string() " SuperTab like snippets behavior. "imap neocomplcache#sources#snippets_complete#expandable() ? "\(neocomplcache_snippets_expand)" : pumvisible() ? "\" : "\" " Recommended key-mappings. " : close popup and save indent. inoremap neocomplcache#smart_close_popup() . "\" " : completion. inoremap pumvisible() ? "\" : "\" " , : close popup and delete backword char. inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#close_popup() inoremap neocomplcache#cancel_popup() " AutoComplPop like behavior. "let g:neocomplcache_enable_auto_select = 1 " Shell like behavior(not recommended). "set completeopt+=longest "let g:neocomplcache_enable_auto_select = 1 "let g:neocomplcache_disable_auto_complete = 1 "inoremap pumvisible() ? "\" : "\" "inoremap neocomplcache#smart_close_popup() . "\" " Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " Enable heavy omni completion. if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' "autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::' let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*' let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::' autoload/neocomplcache/async_cache.vim [[[1 326 "============================================================================= " FILE: async_cache.vim " AUTHOR: Shougo Matsushita " Last Modified: 12 Aug 2011. " 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 condition " " 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 function! s:main(argv)"{{{ " args: funcname, outputname filename pattern_file_name mark minlen maxfilename let [l:funcname, l:outputname, l:filename, l:pattern_file_name, l:mark, l:minlen, l:maxfilename, l:fileencoding] \ = a:argv if l:funcname ==# 'load_from_file' let l:keyword_list = s:load_from_file(l:filename, l:pattern_file_name, l:mark, l:minlen, l:maxfilename, l:fileencoding) else let l:keyword_list = s:load_from_tags(l:filename, l:pattern_file_name, l:mark, l:minlen, l:maxfilename, l:fileencoding) endif " Create dictionary key. for keyword in l:keyword_list if !has_key(keyword, 'abbr') let keyword.abbr = keyword.word endif if !has_key(keyword, 'kind') let keyword.kind = '' endif if !has_key(keyword, 'menu') let keyword.menu = '' endif endfor " Output cache. let l:word_list = [] for keyword in l:keyword_list call add(l:word_list, printf('%s|||%s|||%s|||%s', \keyword.word, keyword.abbr, keyword.menu, keyword.kind)) endfor call writefile(l:word_list, l:outputname) endfunction"}}} function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding)"{{{ if filereadable(a:filename) let l:lines = map(readfile(a:filename), 'iconv(v:val, a:fileencoding, &encoding)') else " File not found. return [] endif let l:pattern = get(readfile(a:pattern_file_name), 0, '\h\w*') let l:max_lines = len(l:lines) let l:menu = '[' . a:mark . '] ' . s:strwidthpart( \ fnamemodify(a:filename, ':t'), a:maxfilename) let l:keyword_list = [] let l:dup_check = {} let l:keyword_pattern2 = '^\%('.l:pattern.'\m\)' for l:line in l:lines"{{{ let l:match = match(l:line, l:pattern) while l:match >= 0"{{{ let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match) if !has_key(l:dup_check, l:match_str) && len(l:match_str) >= a:minlen " Append list. call add(l:keyword_list, { 'word' : l:match_str, 'menu' : l:menu }) let l:dup_check[l:match_str] = 1 endif let l:match = match(l:line, l:pattern, l:match + len(l:match_str)) endwhile"}}} endfor"}}} return l:keyword_list endfunction"}}} function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding)"{{{ let l:menu = '[' . a:mark . ']' let l:menu_pattern = l:menu . printf(' %%.%ds', a:maxfilename) let l:keyword_lists = [] let l:dup_check = {} let l:line_num = 1 let [l:pattern, l:tags_file_name, l:filter_pattern, l:filetype] = \ readfile(a:pattern_file_name)[: 4] if l:tags_file_name !=# '$dummy$' " Check output. let l:tags_list = [] let i = 0 while i < 2 if filereadable(l:tags_file_name) " Use filename. let l:tags_list = map(readfile(l:tags_file_name), \ 'iconv(v:val, a:fileencoding, &encoding)') break endif sleep 500m let i += 1 endwhile else " Use filename. let l:tags_list = map(readfile(a:filename), \ 'iconv(v:val, a:fileencoding, &encoding)') endif if empty(l:tags_list) " File caching. return s:load_from_file(a:filename, a:pattern_file_name, \ a:mark, a:minlen, a:maxfilename, a:fileencoding) endif for l:line in l:tags_list"{{{ let l:tag = split(substitute(l:line, "\", '', 'g'), '\t', 1) let l:opt = join(l:tag[2:], "\") let l:cmd = matchstr(l:opt, '.*/;"') " Add keywords. if l:line !~ '^!' && len(l:tag) >= 3 && len(l:tag[0]) >= a:minlen \&& !has_key(l:dup_check, l:tag[0]) let l:option = { \ 'cmd' : substitute(substitute(substitute(l:cmd, \'^\%([/?]\^\?\)\?\s*\|\%(\$\?[/?]\)\?;"$', '', 'g'), \ '\\\\', '\\', 'g'), '\\/', '/', 'g'), \ 'kind' : '' \} if l:option.cmd =~ '\d\+' let l:option.cmd = l:tag[0] endif for l:opt in split(l:opt[len(l:cmd):], '\t', 1) let l:key = matchstr(l:opt, '^\h\w*\ze:') if l:key == '' let l:option['kind'] = l:opt else let l:option[l:key] = matchstr(l:opt, '^\h\w*:\zs.*') endif endfor if has_key(l:option, 'file') || (has_key(l:option, 'access') && l:option.access != 'public') let l:line_num += 1 continue endif let l:abbr = has_key(l:option, 'signature')? l:tag[0] . l:option.signature : \ (l:option['kind'] == 'd' || l:option['cmd'] == '') ? \ l:tag[0] : l:option['cmd'] let l:abbr = substitute(l:abbr, '\s\+', ' ', 'g') " Substitute "namespace foobar" to "foobar ". let l:abbr = substitute(l:abbr, \'^\(namespace\|class\|struct\|enum\|union\)\s\+\(.*\)$', '\2 <\1>', '') " Substitute typedef. let l:abbr = substitute(l:abbr, '^typedef\s\+\(.*\)\s\+\(\h\w*\%(::\w*\)*\);\?$', '\2 ', 'g') let l:keyword = { \ 'word' : l:tag[0], 'abbr' : l:abbr, 'kind' : l:option['kind'], 'dup' : 1, \ } if has_key(l:option, 'struct') let keyword.menu = printf(l:menu_pattern, l:option.struct) elseif has_key(l:option, 'class') let keyword.menu = printf(l:menu_pattern, l:option.class) elseif has_key(l:option, 'enum') let keyword.menu = printf(l:menu_pattern, l:option.enum) elseif has_key(l:option, 'union') let keyword.menu = printf(l:menu_pattern, l:option.union) else let keyword.menu = l:menu endif call add(l:keyword_lists, l:keyword) let l:dup_check[l:tag[0]] = 1 endif let l:line_num += 1 endfor"}}} if l:filter_pattern != '' call filter(l:keyword_lists, l:filter_pattern) endif return l:keyword_lists endfunction"}}} function! s:truncate(str, width)"{{{ " Original function is from mattn. " http://github.com/mattn/googlereader-vim/tree/master if a:str =~# '^[\x00-\x7f]*$' return len(a:str) < a:width ? \ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width) endif let ret = a:str let width = s:wcswidth(a:str) if width > a:width let ret = s:strwidthpart(ret, a:width) let width = s:wcswidth(ret) endif if width < a:width let ret .= repeat(' ', a:width - width) endif return ret endfunction"}}} function! s:strchars(str)"{{{ return len(substitute(a:str, '.', 'x', 'g')) endfunction"}}} function! s:strwidthpart(str, width)"{{{ let ret = a:str let width = s:wcswidth(a:str) while width > a:width let char = matchstr(ret, '.$') let ret = ret[: -1 - len(char)] let width -= s:wcwidth(char) endwhile return ret endfunction"}}} function! s:strwidthpart_reverse(str, width)"{{{ let ret = a:str let width = s:wcswidth(a:str) while width > a:width let char = matchstr(ret, '^.') let ret = ret[len(char) :] let width -= s:wcwidth(char) endwhile return ret endfunction"}}} if v:version >= 703 " Use builtin function. function! s:wcswidth(str)"{{{ return strdisplaywidth(a:str) endfunction"}}} function! s:wcwidth(str)"{{{ return strwidth(a:str) endfunction"}}} else function! s:wcswidth(str)"{{{ if a:str =~# '^[\x00-\x7f]*$' return strlen(a:str) end let mx_first = '^\(.\)' let str = a:str let width = 0 while 1 let ucs = char2nr(substitute(str, mx_first, '\1', '')) if ucs == 0 break endif let width += s:wcwidth(ucs) let str = substitute(str, mx_first, '', '') endwhile return width endfunction"}}} " UTF-8 only. function! s:wcwidth(ucs)"{{{ let ucs = a:ucs if (ucs >= 0x1100 \ && (ucs <= 0x115f \ || ucs == 0x2329 \ || ucs == 0x232a \ || (ucs >= 0x2e80 && ucs <= 0xa4cf \ && ucs != 0x303f) \ || (ucs >= 0xac00 && ucs <= 0xd7a3) \ || (ucs >= 0xf900 && ucs <= 0xfaff) \ || (ucs >= 0xfe30 && ucs <= 0xfe6f) \ || (ucs >= 0xff00 && ucs <= 0xff60) \ || (ucs >= 0xffe0 && ucs <= 0xffe6) \ || (ucs >= 0x20000 && ucs <= 0x2fffd) \ || (ucs >= 0x30000 && ucs <= 0x3fffd) \ )) return 2 endif return 1 endfunction"}}} endif if argc() == 8 && \ (argv(0) ==# 'load_from_file' || argv(0) ==# 'load_from_tags') try call s:main(argv()) catch call writefile([v:throwpoint, v:exception], \ expand('~/async_error_log')) endtry qall! else function! neocomplcache#async_cache#main(argv)"{{{ call s:main(a:argv) endfunction"}}} endif " vim: foldmethod=marker autoload/neocomplcache/cache.vim [[[1 315 "============================================================================= " FILE: cache.vim " AUTHOR: Shougo Matsushita " Last Modified: 09 Aug 2011. " 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 conditionneocomplcache#cache# " " 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 " Cache loader. function! neocomplcache#cache#check_cache(cache_dir, key, async_cache_dictionary, \ keyword_list_dictionary, completion_length) "{{{ if !has_key(a:async_cache_dictionary, a:key) return endif for l:cache in a:async_cache_dictionary[a:key] " Check cache name. if filereadable(l:cache.cachename) " Caching. let a:keyword_list_dictionary[a:key] = {} let l:keyword_list = [] for l:cache in a:async_cache_dictionary[a:key] let l:keyword_list += neocomplcache#cache#load_from_cache(a:cache_dir, l:cache.filename) endfor call neocomplcache#cache#list2index( \ l:keyword_list, \ a:keyword_list_dictionary[a:key], \ a:completion_length) " Delete from dictionary. call remove(a:async_cache_dictionary, a:key) return endif endfor endfunction"}}} function! neocomplcache#cache#load_from_cache(cache_dir, filename)"{{{ let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) if !filereadable(l:cache_name) return [] endif try return map(map(readfile(l:cache_name), 'split(v:val, "|||", 1)'), '{ \ "word" : v:val[0], \ "abbr" : v:val[1], \ "menu" : v:val[2], \ "kind" : v:val[3], \}') catch /^Vim\%((\a\+)\)\=:E684:/ return [] endtry endfunction"}}} function! neocomplcache#cache#index_load_from_cache(cache_dir, filename, completion_length)"{{{ let l:keyword_lists = {} for l:keyword in neocomplcache#cache#load_from_cache(a:cache_dir, a:filename) let l:key = tolower(l:keyword.word[: a:completion_length-1]) if !has_key(l:keyword_lists, l:key) let l:keyword_lists[l:key] = [] endif call add(l:keyword_lists[l:key], l:keyword) endfor return l:keyword_lists endfunction"}}} function! neocomplcache#cache#list2index(list, dictionary, completion_length)"{{{ for l:keyword in a:list let l:key = tolower(l:keyword.word[: a:completion_length-1]) if !has_key(a:dictionary, l:key) let a:dictionary[l:key] = {} endif let a:dictionary[l:key][l:keyword.word] = l:keyword endfor return a:dictionary endfunction"}}} function! neocomplcache#cache#save_cache(cache_dir, filename, keyword_list)"{{{ " Create cache directory. let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) " Create dictionary key. for keyword in a:keyword_list if !has_key(keyword, 'abbr') let keyword.abbr = keyword.word endif if !has_key(keyword, 'kind') let keyword.kind = '' endif if !has_key(keyword, 'menu') let keyword.menu = '' endif endfor " Output cache. let l:word_list = [] for keyword in a:keyword_list call add(l:word_list, printf('%s|||%s|||%s|||%s', \keyword.word, keyword.abbr, keyword.menu, keyword.kind)) endfor call writefile(l:word_list, l:cache_name) endfunction"}}} " Cache helper. function! neocomplcache#cache#getfilename(cache_dir, filename)"{{{ let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) return l:cache_name endfunction"}}} function! neocomplcache#cache#filereadable(cache_dir, filename)"{{{ let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) return filereadable(l:cache_name) endfunction"}}} function! neocomplcache#cache#readfile(cache_dir, filename)"{{{ let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) return filereadable(l:cache_name) ? readfile(l:cache_name) : [] endfunction"}}} function! neocomplcache#cache#writefile(cache_dir, filename, list)"{{{ let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) call writefile(a:list, l:cache_name) endfunction"}}} function! neocomplcache#cache#encode_name(cache_dir, filename) " Check cache directory. let l:cache_dir = g:neocomplcache_temporary_dir . '/' . a:cache_dir if !isdirectory(l:cache_dir) call mkdir(l:cache_dir, 'p') endif let l:dir = printf('%s/%s/', g:neocomplcache_temporary_dir, a:cache_dir) return l:dir . s:create_hash(l:dir, a:filename) endfunction function! neocomplcache#cache#check_old_cache(cache_dir, filename)"{{{ " Check old cache file. let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) let l:ret = getftime(l:cache_name) == -1 || getftime(l:cache_name) <= getftime(a:filename) if l:ret && filereadable(l:cache_name) " Delete old cache. call delete(l:cache_name) endif return l:ret endfunction"}}} " Check md5. try call md5#md5() let s:exists_md5 = 1 catch let s:exists_md5 = 0 endtry function! s:create_hash(dir, str)"{{{ if len(a:dir) + len(a:str) < 150 let l:hash = substitute(substitute(a:str, ':', '=-', 'g'), '[/\\]', '=+', 'g') elseif s:exists_md5 " Use md5.vim. let l:hash = md5#md5(a:str) else " Use simple hash. let l:sum = 0 for i in range(len(a:str)) let l:sum += char2nr(a:str[i]) * (i + 1) endfor let l:hash = printf('%x', l:sum) endif return l:hash endfunction"}}} let s:sdir = fnamemodify(expand(''), ':p:h') " Async test. function! neocomplcache#cache#test_async()"{{{ if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename) return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif let l:filename = substitute(fnamemodify(expand('%'), ':p'), '\\', '/', 'g') let l:pattern_file_name = neocomplcache#cache#encode_name('keyword_patterns', 'vim') let l:cache_name = neocomplcache#cache#encode_name('test_cache', l:filename) " Create pattern file. call neocomplcache#cache#writefile('keyword_patterns', a:filename, [a:pattern]) " args: funcname, outputname, filename pattern mark minlen maxfilename outputname let l:argv = [ \ 'load_from_file', l:cache_name, l:filename, l:pattern_file_name, '[B]', \ g:neocomplcache_min_keyword_length, g:neocomplcache_max_filename_width, &fileencoding \ ] return s:async_load(l:argv, 'test_cache', l:filename) endfunction"}}} function! neocomplcache#cache#async_load_from_file(cache_dir, filename, pattern, mark)"{{{ if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename) return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif let l:pattern_file_name = neocomplcache#cache#encode_name('keyword_patterns', a:filename) let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) " Create pattern file. call neocomplcache#cache#writefile('keyword_patterns', a:filename, [a:pattern]) " args: funcname, outputname, filename pattern mark minlen maxfilename outputname let l:fileencoding = &fileencoding == '' ? &encoding : &fileencoding let l:argv = [ \ 'load_from_file', l:cache_name, a:filename, l:pattern_file_name, a:mark, \ g:neocomplcache_min_keyword_length, g:neocomplcache_max_filename_width, l:fileencoding \ ] return s:async_load(l:argv, a:cache_dir, a:filename) endfunction"}}} function! neocomplcache#cache#async_load_from_tags(cache_dir, filename, filetype, mark, is_create_tags)"{{{ if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename) return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif let l:cache_name = neocomplcache#cache#encode_name(a:cache_dir, a:filename) let l:pattern_file_name = neocomplcache#cache#encode_name('tags_pattens', a:filename) if a:is_create_tags if !executable(g:neocomplcache_ctags_program) echoerr 'Create tags error! Please install ' . g:neocomplcache_ctags_program . '.' return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif " Create tags file. let l:tags_file_name = neocomplcache#cache#encode_name('tags_output', a:filename) let l:args = has_key(g:neocomplcache_ctags_arguments_list, a:filetype) ? \ g:neocomplcache_ctags_arguments_list[a:filetype] \ : g:neocomplcache_ctags_arguments_list['default'] if has('win32') || has('win64') let l:filename = substitute(a:filename, '\\', '/', 'g') let l:command = printf('%s -f "%s" %s "%s" ', \ g:neocomplcache_ctags_program, l:tags_file_name, l:args, l:filename) else let l:command = printf('%s -f ''%s'' 2>/dev/null %s ''%s''', \ g:neocomplcache_ctags_program, l:tags_file_name, l:args, a:filename) endif if neocomplcache#has_vimproc() call vimproc#system_bg(l:command) else call system(l:command) endif else let l:tags_file_name = '$dummy$' endif let l:filter_pattern = \ (a:filetype != '' && has_key(g:neocomplcache_tags_filter_patterns, a:filetype)) ? \ g:neocomplcache_tags_filter_patterns[a:filetype] : '' call neocomplcache#cache#writefile('tags_pattens', a:filename, \ [neocomplcache#get_keyword_pattern(), l:tags_file_name, l:filter_pattern, a:filetype]) " args: funcname, outputname, filename filetype mark minlen maxfilename outputname let l:fileencoding = &fileencoding == '' ? &encoding : &fileencoding let l:argv = [ \ 'load_from_tags', l:cache_name, a:filename, l:pattern_file_name, a:mark, \ g:neocomplcache_min_keyword_length, g:neocomplcache_max_filename_width, l:fileencoding \ ] return s:async_load(l:argv, a:cache_dir, a:filename) endfunction"}}} function! s:async_load(argv, cache_dir, filename)"{{{ let l:current = getcwd() lcd `=s:sdir` " if 0 if neocomplcache#has_vimproc() let l:args = ['vim', '-u', 'NONE', '-i', 'NONE', '-n', \ '-N', '-S', 'async_cache.vim'] \ + a:argv call vimproc#system_bg(l:args) " call vimproc#system(l:args) " call system(join(l:args)) else call neocomplcache#async_cache#main(a:argv) endif lcd `=l:current` return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/abbrev_complete.vim [[[1 72 "============================================================================= " FILE: abbrev_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 17 Aug 2010 " 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:source = { \ 'name' : 'abbrev_complete', \ 'kind' : 'plugin', \} function! s:source.initialize()"{{{ " Initialize. endfunction"}}} function! s:source.finalize()"{{{ endfunction"}}} function! s:source.get_keyword_list(cur_keyword_str)"{{{ " Get current abbrev list. let l:abbrev_list = '' redir => l:abbrev_list silent! iabbrev redir END let l:list = [] for l:line in split(l:abbrev_list, '\n') let l:abbrev = split(l:line) if l:abbrev[0] !~ '^[!i]$' " No abbreviation found. return [] endif call add(l:list, \{ 'word' : l:abbrev[1], 'menu' : printf('[A] %.'. g:neocomplcache_max_filename_width.'s', l:abbrev[2]) }) endfor return neocomplcache#keyword_filter(l:list, a:cur_keyword_str) endfunction"}}} function! neocomplcache#sources#abbrev_complete#define()"{{{ return s:source endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/buffer_complete.vim [[[1 679 "============================================================================= " FILE: buffer_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 20 Jun 2011. " 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 " Important variables. if !exists('s:buffer_sources') let s:buffer_sources = {} endif let s:source = { \ 'name' : 'buffer_complete', \ 'kind' : 'plugin', \} function! s:source.initialize()"{{{ augroup neocomplcache"{{{ " Caching events autocmd InsertEnter * call s:check_source() autocmd CursorHold * call s:rank_caching_current_cache_line(1) autocmd CursorHold * call s:check_deleted_buffer() autocmd InsertEnter,CursorHoldI * call s:rank_caching_current_cache_line(0) autocmd InsertLeave * call neocomplcache#sources#buffer_complete#caching_current_cache_line() autocmd VimLeavePre * call s:save_all_cache() augroup END"}}} " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'buffer_complete', 4) " Set completion length. call neocomplcache#set_completion_length('buffer_complete', 0) " Create cache directory. if !isdirectory(g:neocomplcache_temporary_dir . '/buffer_cache') call mkdir(g:neocomplcache_temporary_dir . '/buffer_cache', 'p') endif " Initialize script variables."{{{ let s:buffer_sources = {} let s:filetype_frequencies = {} let s:cache_line_count = 70 let s:rank_cache_count = 1 let s:disable_caching_list = {} let s:completion_length = g:neocomplcache_auto_completion_start_length "}}} " Add commands."{{{ command! -nargs=? -complete=buffer NeoComplCacheCachingBuffer call s:caching_buffer() command! -nargs=? -complete=buffer NeoComplCachePrintSource call s:print_source() command! -nargs=? -complete=buffer NeoComplCacheOutputKeyword call s:output_keyword() command! -nargs=? -complete=buffer NeoComplCacheSaveCache call s:save_all_cache() command! -nargs=? -complete=buffer NeoComplCacheDisableCaching call s:disable_caching() command! -nargs=? -complete=buffer NeoComplCacheEnableCaching call s:enable_caching() "}}} endfunction "}}} function! s:source.finalize()"{{{ delcommand NeoComplCacheCachingBuffer delcommand NeoComplCachePrintSource delcommand NeoComplCacheOutputKeyword delcommand NeoComplCacheSaveCache delcommand NeoComplCacheDisableCaching delcommand NeoComplCacheEnableCaching call s:save_all_cache() let s:buffer_sources = {} endfunction"}}} function! s:source.get_keyword_list(cur_keyword_str)"{{{ if neocomplcache#is_auto_complete() && len(a:cur_keyword_str) < s:completion_length " Check member prefix pattern. let l:filetype = neocomplcache#get_context_filetype() if !has_key(g:neocomplcache_member_prefix_patterns, l:filetype) \ || g:neocomplcache_member_prefix_patterns[l:filetype] == '' return [] endif let l:cur_text = neocomplcache#get_cur_text() let l:var_name = matchstr(l:cur_text, '\%(\h\w*\%(()\?\)\?\%(' . \ g:neocomplcache_member_prefix_patterns[l:filetype] . '\m\)\)\+$') if l:var_name == '' return [] endif let l:keyword_list = [] for src in s:get_sources_list() if has_key(s:buffer_sources[src].member_cache, l:var_name) let l:keyword_list += values(s:buffer_sources[src].member_cache[l:var_name]) endif endfor else let l:keyword_list = [] for src in s:get_sources_list() let l:keyword_cache = neocomplcache#dictionary_filter( \ s:buffer_sources[src].keyword_cache, a:cur_keyword_str, s:completion_length) if src == bufnr('%') call s:calc_frequency(l:keyword_cache) endif let l:keyword_list += l:keyword_cache endfor endif return l:keyword_list endfunction"}}} function! neocomplcache#sources#buffer_complete#define()"{{{ return s:source endfunction"}}} function! neocomplcache#sources#buffer_complete#get_frequencies()"{{{ let l:filetype = neocomplcache#get_context_filetype() if !has_key(s:filetype_frequencies, l:filetype) return {} endif return s:filetype_frequencies[l:filetype] endfunction"}}} function! neocomplcache#sources#buffer_complete#caching_current_cache_line()"{{{ " Current line caching. if !s:exists_current_source() || has_key(s:disable_caching_list, bufnr('%')) return endif let l:source = s:buffer_sources[bufnr('%')] let l:filename = fnamemodify(l:source.name, ':t') let l:menu = '[B] ' . neocomplcache#util#strwidthpart( \ l:filename, g:neocomplcache_max_filename_width) let l:keyword_pattern = l:source.keyword_pattern let l:keyword_pattern2 = '^\%('.l:keyword_pattern.'\m\)' let l:keywords = l:source.keyword_cache let l:line = join(getline(line('.')-1, line('.')+1)) let l:match = match(l:line, l:keyword_pattern) while l:match >= 0"{{{ let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match) " Ignore too short keyword. if len(l:match_str) >= g:neocomplcache_min_keyword_length"{{{ " Check dup. let l:key = tolower(l:match_str[: s:completion_length-1]) if !has_key(l:keywords, l:key) let l:keywords[l:key] = {} endif if !has_key(l:keywords[l:key], l:match_str) " Append list. let l:keywords[l:key][l:match_str] = { 'word' : l:match_str, 'menu' : l:menu } endif endif"}}} " Next match. let l:match = match(l:line, l:keyword_pattern, l:match + len(l:match_str)) endwhile"}}} endfunction"}}} function! s:calc_frequency(list)"{{{ if !s:exists_current_source() return endif let l:list_len = len(a:list) if l:list_len > g:neocomplcache_max_list * 5 let l:calc_cnt = 15 elseif l:list_len > g:neocomplcache_max_list * 3 let l:calc_cnt = 13 elseif l:list_len > g:neocomplcache_max_list let l:calc_cnt = 10 elseif l:list_len > g:neocomplcache_max_list / 2 let l:calc_cnt = 8 elseif l:list_len > g:neocomplcache_max_list / 3 let l:calc_cnt = 5 elseif l:list_len > g:neocomplcache_max_list / 4 let l:calc_cnt = 4 else let l:calc_cnt = 3 endif let l:source = s:buffer_sources[bufnr('%')] let l:frequencies = l:source.frequencies let l:filetype = neocomplcache#get_context_filetype() if !has_key(s:filetype_frequencies, l:filetype) let s:filetype_frequencies[l:filetype] = {} endif let l:filetype_frequencies = s:filetype_frequencies[l:filetype] for keyword in a:list if s:rank_cache_count <= 0 " Set rank. let l:word = keyword.word let l:frequency = 0 for rank_lines in values(l:source.rank_lines) if has_key(rank_lines, l:word) let l:frequency += rank_lines[l:word] endif endfor if !has_key(l:filetype_frequencies, l:word) let l:filetype_frequencies[l:word] = 0 endif if has_key(l:frequencies, l:word) let l:filetype_frequencies[l:word] -= l:frequencies[l:word] endif if l:frequency == 0 " Garbage collect let l:ignorecase_save = &ignorecase let &ignorecase = 0 let l:pos = searchpos(neocomplcache#escape_match(l:word), 'ncw', 0) let &ignorecase = l:ignorecase_save if l:pos[0] == 0 " Delete. let l:key = tolower(l:word[: s:completion_length-1]) if has_key(l:source.keyword_cache[l:key], l:word) call remove(l:source.keyword_cache[l:key], l:word) endif if has_key(l:source.frequencies, l:word) call remove(l:source.frequencies, l:word) endif if l:filetype_frequencies[l:word] == 0 call remove(l:filetype_frequencies, l:word) endif else let l:frequencies[l:word] = 1 let l:filetype_frequencies[l:word] += 1 endif else let l:frequencies[l:word] = l:frequency let l:filetype_frequencies[l:word] += l:frequency endif " Reset count. let s:rank_cache_count = neocomplcache#rand(l:calc_cnt) endif let s:rank_cache_count -= 1 endfor endfunction"}}} function! s:get_sources_list()"{{{ let l:sources_list = [] let l:filetypes_dict = {} for l:filetype in neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype()) let l:filetypes_dict[l:filetype] = 1 endfor for key in keys(s:buffer_sources) if has_key(l:filetypes_dict, s:buffer_sources[key].filetype) || bufnr('%') == key \ || (bufname('%') ==# '[Command Line]' && bufnr('#') == key) call add(l:sources_list, key) endif endfor return l:sources_list endfunction"}}} function! s:rank_caching_current_cache_line(is_force)"{{{ if !s:exists_current_source() || neocomplcache#is_locked() return endif let l:source = s:buffer_sources[bufnr('%')] let l:filename = fnamemodify(l:source.name, ':t') let l:start_line = (line('.')-1)/l:source.cache_line_cnt*l:source.cache_line_cnt+1 let l:end_line = l:start_line + l:source.cache_line_cnt-1 let l:cache_num = (l:start_line-1) / l:source.cache_line_cnt " For debugging. "echomsg printf("start=%d, end=%d", l:start_line, l:end_line) if !a:is_force && has_key(l:source.rank_lines, l:cache_num) return endif " Clear cache line. let l:source.rank_lines[l:cache_num] = {} let l:rank_lines = l:source.rank_lines[l:cache_num] let l:buflines = getline(l:start_line, l:end_line) let l:menu = '[B] ' . neocomplcache#util#strwidthpart( \ l:filename, g:neocomplcache_max_filename_width) let l:keyword_pattern = l:source.keyword_pattern let l:keyword_pattern2 = '^\%('.l:keyword_pattern.'\m\)' let [l:line_num, l:max_lines] = [0, len(l:buflines)] while l:line_num < l:max_lines let l:line = buflines[l:line_num] let l:match = match(l:line, l:keyword_pattern) while l:match >= 0"{{{ let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match) " Ignore too short keyword. if len(l:match_str) >= g:neocomplcache_min_keyword_length"{{{ if !has_key(l:rank_lines, l:match_str) let l:rank_lines[l:match_str] = 1 else let l:rank_lines[l:match_str] += 1 endif endif"}}} " Next match. let l:match = match(l:line, l:keyword_pattern, l:match + len(l:match_str)) endwhile"}}} let l:line_num += 1 endwhile let l:filetype = neocomplcache#get_context_filetype(1) if !has_key(g:neocomplcache_member_prefix_patterns, l:filetype) \ || g:neocomplcache_member_prefix_patterns[l:filetype] == '' return endif let l:menu = '[B] member' let l:keyword_pattern = '\%(\h\w*\%(()\?\)\?\%(' . g:neocomplcache_member_prefix_patterns[l:filetype] . '\m\)\)\+\h\w*\%(()\?\)\?' let l:keyword_pattern2 = '^'.l:keyword_pattern let l:member_pattern = '\h\w*\%(()\?\)\?$' " Cache member pattern. let [l:line_num, l:max_lines] = [0, len(l:buflines)] while l:line_num < l:max_lines let l:line = buflines[l:line_num] let l:match = match(l:line, l:keyword_pattern) while l:match >= 0"{{{ let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match) " Next match. let l:match = matchend(l:line, l:keyword_pattern, l:match + len(l:match_str)) while l:match_str != '' let l:member_name = matchstr(l:match_str, l:member_pattern) let l:var_name = l:match_str[ : -len(l:member_name)-1] if !has_key(l:source.member_cache, l:var_name) let l:source.member_cache[l:var_name] = {} endif if !has_key(l:source.member_cache[l:var_name], l:member_name) let l:source.member_cache[l:var_name][l:member_name] = { 'word' : l:member_name, 'menu' : l:menu } endif let l:match_str = matchstr(l:var_name, l:keyword_pattern2) endwhile endwhile"}}} let l:line_num += 1 endwhile endfunction"}}} function! s:initialize_source(srcname)"{{{ let l:path = fnamemodify(bufname(a:srcname), ':p') let l:filename = fnamemodify(l:path, ':t') if l:filename == '' let l:filename = '[No Name]' let l:path .= '/[No Name]' endif " Set cache line count. let l:buflines = getbufline(a:srcname, 1, '$') let l:end_line = len(l:buflines) if l:end_line > 150 let cnt = 0 for line in l:buflines[50:150] let cnt += len(line) endfor if cnt <= 3000 let l:cache_line_cnt = s:cache_line_count elseif cnt <= 4000 let l:cache_line_cnt = s:cache_line_count*7 / 10 elseif cnt <= 5000 let l:cache_line_cnt = s:cache_line_count / 2 elseif cnt <= 7500 let l:cache_line_cnt = s:cache_line_count / 3 elseif cnt <= 10000 let l:cache_line_cnt = s:cache_line_count / 5 elseif cnt <= 12000 let l:cache_line_cnt = s:cache_line_count / 7 elseif cnt <= 14000 let l:cache_line_cnt = s:cache_line_count / 10 else let l:cache_line_cnt = s:cache_line_count / 13 endif elseif l:end_line > 100 let l:cache_line_cnt = s:cache_line_count / 3 else let l:cache_line_cnt = s:cache_line_count / 5 endif let l:ft = getbufvar(a:srcname, '&filetype') if l:ft == '' let l:ft = 'nothing' endif let l:keyword_pattern = neocomplcache#get_keyword_pattern(l:ft) let s:buffer_sources[a:srcname] = { \ 'keyword_cache' : {}, 'rank_lines' : {}, 'member_cache' : {}, \ 'name' : l:filename, 'filetype' : l:ft, 'keyword_pattern' : l:keyword_pattern, \ 'end_line' : l:end_line , 'cache_line_cnt' : l:cache_line_cnt, \ 'frequencies' : {}, 'check_sum' : len(join(l:buflines[:4], '\n')), \ 'path' : l:path, 'loaded_cache' : 0, \ 'cache_name' : neocomplcache#cache#encode_name('buffer_cache', l:path), \} endfunction"}}} function! s:word_caching(srcname)"{{{ " Initialize source. call s:initialize_source(a:srcname) let l:source = s:buffer_sources[a:srcname] let l:srcname = fnamemodify(l:source.name, ':p') if neocomplcache#cache#check_old_cache('buffer_cache', l:srcname) if l:source.name ==# '[Command Line]' \ || getbufvar(a:srcname, '&buftype') =~ 'nofile' " Ignore caching. return endif let l:source.cache_name = \ neocomplcache#cache#async_load_from_file('buffer_cache', l:source.path, l:source.keyword_pattern, 'B') endif endfunction"}}} function! s:check_changed_buffer(bufnumber)"{{{ let l:source = s:buffer_sources[a:bufnumber] if getbufvar(a:bufnumber, '&buftype') =~ 'nofile' " Check buffer changed. let l:check_sum = len(join(getbufline(a:bufnumber, 1, 5), '\n')) if l:check_sum != l:source.check_sum " Recaching. return 1 endif endif let l:ft = getbufvar(a:bufnumber, '&filetype') if l:ft == '' let l:ft = 'nothing' endif let l:filename = fnamemodify(bufname(a:bufnumber), ':t') if l:filename == '' let l:filename = '[No Name]' endif return s:buffer_sources[a:bufnumber].name != l:filename \ || s:buffer_sources[a:bufnumber].filetype != l:ft endfunction"}}} function! s:check_source()"{{{ let l:bufnumber = bufnr('%') " Check new buffer. let l:bufname = fnamemodify(bufname(l:bufnumber), ':p') if (!has_key(s:buffer_sources, l:bufnumber) || s:check_changed_buffer(l:bufnumber)) \ && !has_key(s:disable_caching_list, l:bufnumber) \ && !neocomplcache#is_locked(l:bufnumber) \ && !getwinvar(bufwinnr(l:bufnumber), '&previewwindow') \ && getfsize(l:bufname) < g:neocomplcache_caching_limit_file_size \ && (g:neocomplcache_force_caching_buffer_name_pattern == '' \ || l:bufname !~ g:neocomplcache_force_caching_buffer_name_pattern) " Caching. call s:word_caching(l:bufnumber) endif if has_key(s:buffer_sources, l:bufnumber) \ && !s:buffer_sources[l:bufnumber].loaded_cache let l:source = s:buffer_sources[l:bufnumber] if filereadable(l:source.cache_name) " Caching from cache. call neocomplcache#cache#list2index( \ neocomplcache#cache#load_from_cache('buffer_cache', l:source.path), \ l:source.keyword_cache, \ s:completion_length) let l:source.loaded_cache = 1 endif endif endfunction"}}} function! s:check_deleted_buffer()"{{{ " Check deleted buffer. for key in keys(s:buffer_sources) if !bufloaded(str2nr(key)) " Save cache. call s:save_cache(key) " Remove item. call remove(s:buffer_sources, key) endif endfor endfunction"}}} function! s:exists_current_source()"{{{ return has_key(s:buffer_sources, bufnr('%')) endfunction"}}} function! s:save_cache(srcname)"{{{ if s:buffer_sources[a:srcname].end_line < 500 return endif if getbufvar(a:srcname, '&buftype') =~ 'nofile' return endif let l:srcname = fnamemodify(bufname(str2nr(a:srcname)), ':p') if !filereadable(l:srcname) || \ (g:neocomplcache_disable_caching_file_path_pattern != '' \ && l:srcname =~ g:neocomplcache_disable_caching_file_path_pattern) return endif let l:cache_name = neocomplcache#cache#encode_name('buffer_cache', l:srcname) if filereadable(l:cache_name) && \ (g:neocomplcache_disable_caching_file_path_pattern != '' \ && l:srcname =~ g:neocomplcache_disable_caching_file_path_pattern) " Delete cache file. call delete(l:cache_name) return endif if getftime(l:cache_name) >= getftime(l:srcname) return endif " Output buffer. call neocomplcache#cache#save_cache('buffer_cache', l:srcname, neocomplcache#unpack_dictionary(s:buffer_sources[a:srcname].keyword_cache)) endfunction "}}} function! s:save_all_cache()"{{{ try for l:key in keys(s:buffer_sources) call s:save_cache(l:key) endfor catch call neocomplcache#print_error('Error occured while saving cache!') let l:error_file = g:neocomplcache_temporary_dir . strftime('/error-%Y-%m-%d.log') call writefile([v:exception . ' ' . v:throwpoint], l:error_file) call neocomplcache#print_error('Please check error file: ' . l:error_file) endtry endfunction"}}} " Command functions."{{{ function! s:caching_buffer(name)"{{{ if a:name == '' let l:number = bufnr('%') else let l:number = bufnr(a:name) if l:number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif " Word recaching. call s:word_caching(l:number) endfunction"}}} function! s:print_source(name)"{{{ if a:name == '' let l:number = bufnr('%') else let l:number = bufnr(a:name) if l:number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif if !has_key(s:buffer_sources, l:number) return endif silent put=printf('Print neocomplcache %d source.', l:number) for l:key in keys(s:buffer_sources[l:number]) silent put =printf('%s => %s', l:key, string(s:buffer_sources[l:number][l:key])) endfor endfunction"}}} function! s:output_keyword(name)"{{{ if a:name == '' let l:number = bufnr('%') else let l:number = bufnr(a:name) if l:number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif if !has_key(s:buffer_sources, l:number) return endif " Output buffer. for keyword in neocomplcache#unpack_dictionary(s:buffer_sources[l:number].keyword_cache) silent put=string(keyword) endfor endfunction "}}} function! s:disable_caching(name)"{{{ if a:name == '' let l:number = bufnr('%') else let l:number = bufnr(a:name) if l:number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif let s:disable_caching_list[l:number] = 1 if has_key(s:buffer_sources, l:number) " Delete source. call remove(s:buffer_sources, l:number) endif endfunction"}}} function! s:enable_caching(name)"{{{ if a:name == '' let l:number = bufnr('%') else let l:number = bufnr(a:name) if l:number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif if has_key(s:disable_caching_list, l:number) call remove(s:disable_caching_list, l:number) endif endfunction"}}} "}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/completefunc_complete.vim [[[1 120 "============================================================================= " FILE: completefunc_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 25 Jul 2010 " 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:source = { \ 'name' : 'completefunc_complete', \ 'kind' : 'complfunc', \} function! s:source.initialize()"{{{ " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'completefunc_complete', 5) endfunction"}}} function! s:source.finalize()"{{{ endfunction"}}} function! s:source.get_keyword_pos(cur_text)"{{{ return -1 endfunction"}}} function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{ return [] endfunction"}}} function! neocomplcache#sources#completefunc_complete#define()"{{{ return s:source endfunction"}}} function! neocomplcache#sources#completefunc_complete#call_completefunc(funcname)"{{{ let l:cur_text = neocomplcache#get_cur_text() " Save pos. let l:pos = getpos('.') let l:line = getline('.') let l:cur_keyword_pos = call(a:funcname, [1, '']) " Restore pos. call setpos('.', l:pos) if l:cur_keyword_pos < 0 return '' endif let l:cur_keyword_str = l:cur_text[l:cur_keyword_pos :] let l:pos = getpos('.') let l:list = call(a:funcname, [0, l:cur_keyword_str]) call setpos('.', l:pos) if empty(l:list) return '' endif let l:list = s:get_completefunc_list(l:list) " Start manual complete. return neocomplcache#start_manual_complete_list(l:cur_keyword_pos, l:cur_keyword_str, l:list) endfunction"}}} function! s:get_completefunc_list(list)"{{{ let l:comp_list = [] " Convert string list. for str in filter(copy(a:list), 'type(v:val) == '.type('')) let l:dict = { 'word' : str, 'menu' : '[C]' } call add(l:comp_list, l:dict) endfor for l:comp in filter(a:list, 'type(v:val) != '.type('')) let l:dict = { \'word' : l:comp.word, 'menu' : '[C]', \'abbr' : has_key(l:comp, 'abbr')? l:comp.abbr : l:comp.word \} if has_key(l:comp, 'kind') let l:dict.kind = l:comp.kind endif if has_key(l:comp, 'menu') let l:dict.menu .= ' ' . l:comp.menu endif call add(l:comp_list, l:dict) endfor return l:comp_list endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/dictionary_complete.vim [[[1 157 "============================================================================= " FILE: dictionary_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 21 Jul 2011. " 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 function! neocomplcache#sources#dictionary_complete#define()"{{{ return s:source endfunction"}}} let s:source = { \ 'name' : 'dictionary_complete', \ 'kind' : 'plugin', \} function! s:source.initialize()"{{{ " Initialize. let s:dictionary_list = {} let s:completion_length = neocomplcache#get_auto_completion_length('dictionary_complete') let s:async_dictionary_list = {} " Initialize dictionary."{{{ if !exists('g:neocomplcache_dictionary_filetype_lists') let g:neocomplcache_dictionary_filetype_lists = {} endif if !has_key(g:neocomplcache_dictionary_filetype_lists, 'default') let g:neocomplcache_dictionary_filetype_lists['default'] = '' endif "}}} " Initialize dictionary completion pattern."{{{ if !exists('g:neocomplcache_dictionary_patterns') let g:neocomplcache_dictionary_patterns = {} endif "}}} " Set caching event. autocmd neocomplcache FileType * call s:caching() " Add command. command! -nargs=? -complete=customlist,neocomplcache#filetype_complete NeoComplCacheCachingDictionary call s:recaching() " Create cache directory. if !isdirectory(g:neocomplcache_temporary_dir . '/dictionary_cache') call mkdir(g:neocomplcache_temporary_dir . '/dictionary_cache') endif " Initialize check. call s:caching() endfunction"}}} function! s:source.finalize()"{{{ delcommand NeoComplCacheCachingDictionary endfunction"}}} function! s:source.get_keyword_list(cur_keyword_str)"{{{ let l:list = [] let l:filetype = neocomplcache#is_text_mode() ? 'text' : neocomplcache#get_context_filetype() if neocomplcache#is_text_mode() && !has_key(s:dictionary_list, 'text') " Caching. call s:caching() endif for l:ft in neocomplcache#get_source_filetypes(l:filetype) call neocomplcache#cache#check_cache('dictionary_cache', l:ft, s:async_dictionary_list, \ s:dictionary_list, s:completion_length) for l:source in neocomplcache#get_sources_list(s:dictionary_list, l:ft) let l:list += neocomplcache#dictionary_filter(l:source, a:cur_keyword_str, s:completion_length) endfor endfor return l:list endfunction"}}} function! s:caching()"{{{ if !bufloaded(bufnr('%')) return endif let l:key = neocomplcache#is_text_mode() ? 'text' : neocomplcache#get_context_filetype() for l:filetype in neocomplcache#get_source_filetypes(l:key) if !has_key(s:dictionary_list, l:filetype) \ && !has_key(s:async_dictionary_list, l:filetype) call s:recaching(l:filetype) endif endfor endfunction"}}} function! s:caching_dictionary(filetype) if a:filetype == '' let l:filetype = neocomplcache#get_context_filetype(1) else let l:filetype = a:filetype endif if has_key(s:async_dictionary_list, l:filetype) \ && filereadable(s:async_dictionary_list[l:filetype].cache_name) " Delete old cache. call delete(s:async_dictionary_list[l:filetype].cache_name) endif call s:recaching(l:filetype) endfunction function! s:recaching(filetype)"{{{ " Caching. if has_key(g:neocomplcache_dictionary_filetype_lists, a:filetype) let l:dictionaries = g:neocomplcache_dictionary_filetype_lists[a:filetype] elseif a:filetype != &filetype || &l:dictionary == '' return else let l:dictionaries = &l:dictionary endif let s:async_dictionary_list[a:filetype] = [] let l:pattern = has_key(g:neocomplcache_dictionary_patterns, a:filetype) ? \ g:neocomplcache_dictionary_patterns[a:filetype] : \ neocomplcache#get_keyword_pattern(a:filetype) for l:dictionary in split(l:dictionaries, ',') if filereadable(l:dictionary) call add(s:async_dictionary_list[a:filetype], { \ 'filename' : l:dictionary, \ 'cachename' : neocomplcache#cache#async_load_from_file( \ 'dictionary_cache', l:dictionary, l:pattern, 'D') \ }) endif endfor endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/filename_complete.vim [[[1 266 "============================================================================= " FILE: filename_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 09 Aug 2011. " 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:source = { \ 'name' : 'filename_complete', \ 'kind' : 'complfunc', \} function! s:source.initialize()"{{{ " Initialize. let s:skip_dir = {} call neocomplcache#set_completion_length('filename_complete', g:neocomplcache_auto_completion_start_length) " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'filename_complete', 2) endfunction"}}} function! s:source.finalize()"{{{ endfunction"}}} function! s:source.get_keyword_pos(cur_text)"{{{ let l:filetype = neocomplcache#get_context_filetype() if l:filetype ==# 'vimshell' || l:filetype ==# 'unite' || neocomplcache#within_comment() return -1 endif " Not Filename pattern. if a:cur_text =~ \'\*$\|\.\.\+$\|[/\\][/\\]\f*$\|/c\%[ygdrive/]$\|\\|$\|\a:[^/]*$' return -1 endif " Filename pattern. let l:pattern = neocomplcache#get_keyword_pattern_end('filename') let [l:cur_keyword_pos, l:cur_keyword_str] = neocomplcache#match_word(a:cur_text, l:pattern) " Not Filename pattern. if neocomplcache#is_win() && l:filetype == 'tex' && l:cur_keyword_str =~ '\\' return -1 endif " Skip directory. if neocomplcache#is_auto_complete() let l:dir = simplify(fnamemodify(l:cur_keyword_str, ':p:h')) if l:dir != '' && has_key(s:skip_dir, l:dir) return -1 endif endif return l:cur_keyword_pos endfunction"}}} function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{ let l:filetype = neocomplcache#get_context_filetype() " Check include pattern. let l:pattern = exists('g:neocomplcache_include_patterns') && \ has_key(g:neocomplcache_include_patterns, l:filetype) ? \ g:neocomplcache_include_patterns[l:filetype] : \ getbufvar(bufnr('%'), '&include') let l:line = neocomplcache#get_cur_text() return (l:pattern == '' || l:line !~ l:pattern) ? \ s:get_glob_files(a:cur_keyword_str, '') : \ s:get_include_files(a:cur_keyword_str) endfunction"}} function! s:get_include_files(cur_keyword_str)"{{{ let l:filetype = neocomplcache#get_context_filetype() let l:path = exists('g:neocomplcache_include_patterns') && \ has_key(g:neocomplcache_include_paths, l:filetype) ? \ g:neocomplcache_include_paths[l:filetype] : \ getbufvar(bufnr('%'), '&path') let l:pattern = exists('g:neocomplcache_include_patterns') && \ has_key(g:neocomplcache_include_patterns, l:filetype) ? \ g:neocomplcache_include_patterns[l:filetype] : \ getbufvar(bufnr('%'), '&include') let l:line = neocomplcache#get_cur_text() let l:match_end = matchend(l:line, l:pattern) let l:cur_keyword_str = matchstr(l:line[l:match_end :], '\f\+') " Path search. let l:glob = (l:cur_keyword_str !~ '\*$')? \ l:cur_keyword_str . '*' : l:cur_keyword_str let l:cwd = getcwd() let l:bufdirectory = fnamemodify(expand('%'), ':p:h') let l:dir_list = [] let l:file_list = [] for subpath in map(split(l:path, ','), 'substitute(v:val, "\\\\", "/", "g")') let l:dir = (subpath == '.') ? l:bufdirectory : subpath if !isdirectory(l:dir) continue endif lcd `=l:dir` for word in split(substitute(glob(l:glob), '\\', '/', 'g'), '\n') let l:dict = { 'word' : word, 'menu' : '[F]' } let l:abbr = l:dict.word if isdirectory(l:word) let l:abbr .= '/' if g:neocomplcache_enable_auto_delimiter let l:dict.word .= '/' endif endif let l:dict.abbr = l:abbr " Escape word. let l:dict.word = escape(l:dict.word, ' *?[]"={}') call add(isdirectory(l:word) ? l:dir_list : l:file_list, l:dict) endfor endfor lcd `=l:cwd` return neocomplcache#keyword_filter(l:dir_list, a:cur_keyword_str) \ + neocomplcache#keyword_filter(l:file_list, a:cur_keyword_str) endfunction"}}} let s:cached_files = {} function! s:get_glob_files(cur_keyword_str, path)"{{{ let l:path = ',,' . substitute(a:path, '\.\%(,\|$\)\|,,', '', 'g') let l:cur_keyword_str = a:cur_keyword_str let l:cur_keyword_str = escape(a:cur_keyword_str, '[]') let l:cur_keyword_str = substitute(l:cur_keyword_str, '\\ ', ' ', 'g') let l:glob = (l:cur_keyword_str !~ '\*$')? l:cur_keyword_str . '*' : l:cur_keyword_str if a:path == '' && l:cur_keyword_str !~ '/' if !has_key(s:cached_files, getcwd()) call s:caching_current_files() endif let l:files = copy(s:cached_files[getcwd()]) else try let l:globs = globpath(l:path, l:glob) catch return [] endtry let l:files = split(substitute(l:globs, '\\', '/', 'g'), '\n') if empty(l:files) " Add '*' to a delimiter. let l:cur_keyword_str = substitute(l:cur_keyword_str, '\w\+\ze[/._-]', '\0*', 'g') let l:glob = (l:cur_keyword_str !~ '\*$')? l:cur_keyword_str . '*' : l:cur_keyword_str try let l:globs = globpath(l:path, l:glob) catch return [] endtry let l:files = split(substitute(l:globs, '\\', '/', 'g'), '\n') endif endif let l:files = neocomplcache#keyword_filter(map( \ l:files, '{ \ "word" : fnamemodify(v:val, ":t"), \ "orig" : v:val, \ }'), \ fnamemodify(a:cur_keyword_str, ':t')) if (neocomplcache#is_auto_complete() && len(l:files) > g:neocomplcache_max_list) let l:files = l:files[: g:neocomplcache_max_list - 1] endif let l:files = map(l:files, '{ \ "word" : substitute(v:val.orig, "//", "/", "g"), \ }') if a:cur_keyword_str =~ '^\$\h\w*' let l:env = matchstr(a:cur_keyword_str, '^\$\h\w*') let l:env_ev = eval(l:env) if neocomplcache#is_win() let l:env_ev = substitute(l:env_ev, '\\', '/', 'g') endif let l:len_env = len(l:env_ev) else let l:len_env = 0 endif let l:home_pattern = '^'.substitute($HOME, '\\', '/', 'g').'/' let l:exts = escape(substitute($PATHEXT, ';', '\\|', 'g'), '.') let l:dir_list = [] let l:file_list = [] for l:dict in l:files let l:dict.menu = '[F]' let l:dict.orig = l:dict.word if l:len_env != 0 && l:dict.word[: l:len_env-1] == l:env_ev let l:dict.word = l:env . l:dict.word[l:len_env :] elseif a:cur_keyword_str =~ '^\~/' let l:dict.word = substitute(l:dict.word, l:home_pattern, '\~/', '') endif let l:abbr = l:dict.word if isdirectory(expand(l:dict.word)) let l:abbr .= '/' if g:neocomplcache_enable_auto_delimiter let l:dict.word .= '/' endif elseif neocomplcache#is_win() if '.'.fnamemodify(l:dict.word, ':e') =~ l:exts let l:abbr .= '*' endif elseif executable(l:dict.word) let l:abbr .= '*' endif let l:dict.abbr = l:abbr " Escape word. let l:dict.word = escape(l:dict.word, ' *?[]"={}') call add(isdirectory(l:dict.word) ? l:dir_list : l:file_list, l:dict) endfor return l:dir_list + l:file_list endfunction"}}} function! s:caching_current_files() let s:cached_files[getcwd()] = \ split(substitute(glob('*') . "\n" . glob('.*'), '\\', '/', 'g'), '\n') endfunction function! neocomplcache#sources#filename_complete#define()"{{{ return s:source endfunction"}}} function! neocomplcache#sources#filename_complete#get_complete_words(cur_keyword_str, path)"{{{ return s:get_glob_files(a:cur_keyword_str, a:path) endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/include_complete.vim [[[1 356 "============================================================================= " FILE: include_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 09 Aug 2011. " 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:include_info = {} let s:source = { \ 'name' : 'include_complete', \ 'kind' : 'plugin', \} function! s:source.initialize()"{{{ " Initialize let s:include_info = {} let s:include_cache = {} let s:async_include_cache = {} let s:cached_pattern = {} let s:completion_length = neocomplcache#get_auto_completion_length('include_complete') " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'include_complete', 8) if neocomplcache#has_vimproc() augroup neocomplcache " Caching events autocmd BufWritePost * call s:check_buffer('', 0) augroup END endif " Initialize include pattern."{{{ call neocomplcache#set_dictionary_helper(g:neocomplcache_include_patterns, 'java,haskell', '^import') "}}} " Initialize expr pattern."{{{ call neocomplcache#set_dictionary_helper(g:neocomplcache_include_exprs, 'haskell', \'substitute(v:fname,''\\.'',''/'',''g'')') "}}} " Initialize path pattern."{{{ "}}} " Initialize suffixes pattern."{{{ call neocomplcache#set_dictionary_helper(g:neocomplcache_include_suffixes, 'haskell', '.hs') "}}} if !exists('g:neocomplcache_include_max_processes') let g:neocomplcache_include_max_processes = 20 endif " Create cache directory. if !isdirectory(g:neocomplcache_temporary_dir . '/include_cache') call mkdir(g:neocomplcache_temporary_dir . '/include_cache', 'p') endif " Add command. command! -nargs=? -complete=buffer NeoComplCacheCachingInclude call s:caching_include() if neocomplcache#exists_echodoc() call echodoc#register('include_complete', s:doc_dict) endif endfunction"}}} function! s:source.finalize()"{{{ delcommand NeoComplCacheCachingInclude if neocomplcache#exists_echodoc() call echodoc#unregister('include_complete') endif endfunction"}}} function! s:source.get_keyword_list(cur_keyword_str)"{{{ if neocomplcache#within_comment() return [] endif if !has_key(s:include_info, bufnr('%')) if !neocomplcache#has_vimproc() return [] endif " Auto caching. call s:check_buffer('', 0) endif let l:keyword_list = [] " Check caching. for l:include in s:include_info[bufnr('%')].include_files call neocomplcache#cache#check_cache( \ 'include_cache', l:include, s:async_include_cache, \ s:include_cache, s:completion_length) if has_key(s:include_cache, l:include) let l:keyword_list += neocomplcache#dictionary_filter( \ s:include_cache[l:include], a:cur_keyword_str, s:completion_length) endif endfor return neocomplcache#keyword_filter(neocomplcache#dup_filter(l:keyword_list), a:cur_keyword_str) endfunction"}}} function! neocomplcache#sources#include_complete#define()"{{{ return s:source endfunction"}}} function! neocomplcache#sources#include_complete#get_include_files(bufnumber)"{{{ if has_key(s:include_info, a:bufnumber) return s:include_info[a:bufnumber].include_files else return [] endif endfunction"}}} " For echodoc."{{{ let s:doc_dict = { \ 'name' : 'include_complete', \ 'rank' : 5, \ 'filetypes' : {}, \ } function! s:doc_dict.search(cur_text)"{{{ if &filetype ==# 'vim' || !has_key(s:include_info, bufnr('%')) return [] endif " Collect words. let l:words = [] let i = 0 while i >= 0 let l:word = matchstr(a:cur_text, '\k\+', i) if len(l:word) >= s:completion_length call add(l:words, l:word) endif let i = matchend(a:cur_text, '\k\+', i) endwhile for l:word in reverse(l:words) let l:key = tolower(l:word[: s:completion_length-1]) for l:include in filter(copy(s:include_info[bufnr('%')].include_files), \ 'has_key(s:include_cache, v:val) && has_key(s:include_cache[v:val], l:key)') for l:matched in filter(values(s:include_cache[l:include][l:key]), \ 'v:val.word ==# l:word && has_key(v:val, "kind") && v:val.kind != ""') let l:ret = [] let l:match = match(l:matched.abbr, neocomplcache#escape_match(l:word)) if l:match > 0 call add(l:ret, { 'text' : l:matched.abbr[ : l:match-1] }) endif call add(l:ret, { 'text' : l:word, 'highlight' : 'Identifier' }) call add(l:ret, { 'text' : l:matched.abbr[l:match+len(l:word) :] }) if l:match > 0 || len(l:ret[-1].text) > 0 return l:ret endif endfor endfor endfor return [] endfunction"}}} "}}} function! s:check_buffer(bufnumber, is_force)"{{{ if !executable(g:neocomplcache_ctags_program) return endif let l:bufnumber = (a:bufnumber == '') ? bufnr('%') : a:bufnumber let l:filename = fnamemodify(bufname(l:bufnumber), ':p') let l:filetype = getbufvar(l:bufnumber, '&filetype') if l:filetype == '' let l:filetype = 'nothing' endif if !has_key(s:include_info, l:bufnumber) " Initialize. let s:include_info[l:bufnumber] = { \ 'include_files' : [], 'lines' : [], \ 'async_files' : {}, \ } endif let l:include_info = s:include_info[l:bufnumber] if l:include_info.lines !=# getbufline(l:bufnumber, 1, 100) let l:include_info.lines = getbufline(l:bufnumber, 1, 100) " Check include files contained bufname. let l:include_files = \ neocomplcache#util#uniq(s:get_buffer_include_files(l:bufnumber)) if getbufvar(l:bufnumber, '&buftype') !~ 'nofile' \ && filereadable(l:filename) call add(l:include_files, l:filename) endif let l:include_info.include_files = l:include_files endif if g:neocomplcache_include_max_processes <= 0 return endif for l:filename in l:include_info.include_files if (a:is_force || !has_key(l:include_info.async_files, l:filename)) \ && !has_key(s:include_cache, l:filename) if !a:is_force && has_key(s:async_include_cache, l:filename) \ && len(s:async_include_cache[l:filename]) \ >= g:neocomplcache_include_max_processes break endif " Caching. let s:async_include_cache[l:filename] \ = [ s:initialize_include(l:filename, l:filetype) ] let l:include_info.async_files[l:filename] = 1 endif endfor endfunction"}}} function! s:get_buffer_include_files(bufnumber)"{{{ let l:filetype = getbufvar(a:bufnumber, '&filetype') if l:filetype == '' return [] endif if l:filetype == 'python' \ && !has_key(g:neocomplcache_include_paths, 'python') \ && executable('python') " Initialize python path pattern. call neocomplcache#set_dictionary_helper(g:neocomplcache_include_paths, 'python', \ neocomplcache#system('python -', 'import sys;sys.stdout.write(",".join(sys.path))')) elseif l:filetype == 'cpp' && isdirectory('/usr/include/c++') " Add cpp path. call neocomplcache#set_dictionary_helper(g:neocomplcache_include_paths, 'cpp', \ getbufvar(a:bufnumber, '&path') . ',/usr/include/c++/*') endif let l:pattern = has_key(g:neocomplcache_include_patterns, l:filetype) ? \ g:neocomplcache_include_patterns[l:filetype] : getbufvar(a:bufnumber, '&include') if l:pattern == '' return [] endif let l:path = has_key(g:neocomplcache_include_paths, l:filetype) ? \ g:neocomplcache_include_paths[l:filetype] : getbufvar(a:bufnumber, '&path') let l:expr = has_key(g:neocomplcache_include_exprs, l:filetype) ? \ g:neocomplcache_include_exprs[l:filetype] : getbufvar(a:bufnumber, '&includeexpr') if has_key(g:neocomplcache_include_suffixes, l:filetype) let l:suffixes = &l:suffixesadd endif " Change current directory. let l:cwd_save = getcwd() if isdirectory(fnamemodify(bufname(a:bufnumber), ':p:h')) lcd `=fnamemodify(bufname(a:bufnumber), ':p:h')` endif let l:include_files = s:get_include_files(0, getbufline(a:bufnumber, 1, 100), l:filetype, l:pattern, l:path, l:expr) lcd `=l:cwd_save` " Restore option. if has_key(g:neocomplcache_include_suffixes, l:filetype) let &l:suffixesadd = l:suffixes endif return l:include_files endfunction"}}} function! s:get_include_files(nestlevel, lines, filetype, pattern, path, expr)"{{{ let l:include_files = [] for l:line in a:lines"{{{ if l:line =~ a:pattern let l:match_end = matchend(l:line, a:pattern) if a:expr != '' let l:eval = substitute(a:expr, 'v:fname', string(matchstr(l:line[l:match_end :], '\f\+')), 'g') let l:filename = fnamemodify(findfile(eval(l:eval), a:path), ':p') else let l:filename = fnamemodify(findfile(matchstr(l:line[l:match_end :], '\f\+'), a:path), ':p') endif if filereadable(l:filename) && getfsize(l:filename) < g:neocomplcache_caching_limit_file_size call add(l:include_files, l:filename) if (a:filetype == 'c' || a:filetype == 'cpp') && a:nestlevel < 1 let l:include_files += s:get_include_files(a:nestlevel + 1, readfile(l:filename)[:100], \ a:filetype, a:pattern, a:path, a:expr) endif endif endif endfor"}}} return l:include_files endfunction"}}} function! s:initialize_include(filename, filetype)"{{{ " Initialize include list from tags. return { \ 'filename' : a:filename, \ 'cachename' : neocomplcache#cache#async_load_from_tags( \ 'include_cache', a:filename, a:filetype, 'I', 1) \ } endfunction"}}} function! s:caching_include(bufname)"{{{ let l:bufnumber = (a:bufname == '') ? bufnr('%') : bufnr(a:bufname) if has_key(s:async_include_cache, l:bufnumber) \ && filereadable(s:async_include_cache[l:bufnumber].cache_name) " Delete old cache. call delete(s:async_include_cache[l:bufnumber].cache_name) endif " Initialize. if has_key(s:include_info, l:bufnumber) call remove(s:include_info, l:bufnumber) endif call s:check_buffer(l:bufnumber, 1) endfunction"}}} " Global options definition."{{{ if !exists('g:neocomplcache_include_patterns') let g:neocomplcache_include_patterns = {} endif if !exists('g:neocomplcache_include_exprs') let g:neocomplcache_include_exprs = {} endif if !exists('g:neocomplcache_include_paths') let g:neocomplcache_include_paths = {} endif if !exists('g:neocomplcache_include_suffixes') let g:neocomplcache_include_suffixes = {} endif "}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/keyword_complete.vim [[[1 99 "============================================================================= " FILE: keyword_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 22 Jul 2011. " 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:source = { \ 'name' : 'keyword_complete', \ 'kind' : 'complfunc', \} function! s:source.initialize()"{{{ " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'keyword_complete', 5) " Initialize. for l:plugin in values(neocomplcache#available_plugins()) call l:plugin.initialize() endfor endfunction"}}} function! s:source.finalize()"{{{ for l:plugin in values(neocomplcache#available_plugins()) call l:plugin.finalize() endfor endfunction"}}} function! s:source.get_keyword_pos(cur_text)"{{{ let [l:cur_keyword_pos, l:cur_keyword_str] = neocomplcache#match_word(a:cur_text) if l:cur_keyword_pos < 0 " Empty string. return len(a:cur_text) endif return l:cur_keyword_pos endfunction"}}} function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{ " Get keyword list. let l:cache_keyword_list = [] for [l:name, l:plugin] in items(neocomplcache#available_plugins()) if (has_key(g:neocomplcache_plugin_disable, l:name) \ && g:neocomplcache_plugin_disable[l:name]) \ || len(a:cur_keyword_str) < neocomplcache#get_completion_length(l:name) \ || neocomplcache#is_plugin_locked(l:name) " Skip plugin. continue endif try let l:list = l:plugin.get_keyword_list(a:cur_keyword_str) catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error('Error occured in plugin''s get_keyword_list()!') call neocomplcache#print_error('Plugin name is ' . l:name) return [] endtry let l:rank = neocomplcache#get_plugin_rank(l:name) for l:keyword in l:list let l:keyword.rank = l:rank endfor let l:cache_keyword_list += l:list endfor return l:cache_keyword_list endfunction"}}} function! neocomplcache#sources#keyword_complete#define()"{{{ return s:source endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/omni_complete.vim [[[1 259 "============================================================================= " FILE: omni_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 22 Apr 2011. " 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:source = { \ 'name' : 'omni_complete', \ 'kind' : 'complfunc', \} function! s:source.initialize()"{{{ " Initialize omni completion pattern."{{{ if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'html,xhtml,xml,markdown', \'<[^>]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'css', \'^\s\+\w+\|\w+[):;]?\s\+\|[@!]') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'javascript', \'[^. \t]\.\%(\h\w*\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'actionscript', \'[^. \t][.:]\h\w*') "call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'php', "\'[^. \t]->\h\w*\|\h\w*::') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'java', \'\%(\h\w*\|)\)\.') "call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'perl', "\'\h\w*->\h\w*\|\h\w*::') "call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'c', "\'\%(\.\|->\)\h\w*') "call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'cpp', "\'\h\w*\%(\.\|->\)\h\w*\|\h\w*::') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'vimshell', \'\%(\\[^[:alnum:].-]\|[[:alnum:]@/.-_+,#$%~=*]\)\{2,}') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'objc', \'\h\w\+\|\h\w*\%(\.\|->\)\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'objj', \'[\[ \.]\w\+$\|:\w*$') " External language interface check. if has('ruby') " call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'ruby', " \'[^. *\t]\.\h\w*\|\h\w*::') endif if has('python') call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'python', \'[^. \t]\.\w*') endif "}}} " Initialize omni function list."{{{ if !exists('g:neocomplcache_omni_functions') let g:neocomplcache_omni_functions = {} endif "}}} " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'omni_complete', 100) endfunction"}}} function! s:source.finalize()"{{{ endfunction"}}} function! s:source.get_keyword_pos(cur_text)"{{{ if neocomplcache#within_comment() return -1 endif let l:filetype = neocomplcache#get_context_filetype() if neocomplcache#is_eskk_enabled() let l:omnifunc = &l:omnifunc elseif has_key(g:neocomplcache_omni_functions, l:filetype) let l:omnifunc = g:neocomplcache_omni_functions[l:filetype] elseif &filetype == l:filetype let l:omnifunc = &l:omnifunc else " &omnifunc is irregal. return -1 endif if l:omnifunc == '' return -1 endif if has_key(g:neocomplcache_omni_patterns, l:omnifunc) let l:pattern = g:neocomplcache_omni_patterns[l:omnifunc] elseif l:filetype != '' && has_key(g:neocomplcache_omni_patterns, l:filetype) let l:pattern = g:neocomplcache_omni_patterns[l:filetype] else let l:pattern = '' endif if !neocomplcache#is_eskk_enabled() && l:pattern == '' return -1 endif let l:is_wildcard = g:neocomplcache_enable_wildcard && a:cur_text =~ '\*\w\+$' \&& neocomplcache#is_auto_complete() " Check wildcard. if l:is_wildcard " Check wildcard. let l:cur_text = a:cur_text[: match(a:cur_text, '\%(\*\w\+\)\+$') - 1] else let l:cur_text = a:cur_text endif if !neocomplcache#is_eskk_enabled() \ && l:cur_text !~ '\%(' . l:pattern . '\m\)$' return -1 endif " Save pos. let l:pos = getpos('.') let l:line = getline('.') if neocomplcache#is_auto_complete() && l:is_wildcard call setline('.', l:cur_text) endif try let l:cur_keyword_pos = call(l:omnifunc, [1, '']) catch call neocomplcache#print_error(v:exception) let l:cur_keyword_pos = -1 endtry " Restore pos. if neocomplcache#is_auto_complete() && l:is_wildcard call setline('.', l:line) endif call setpos('.', l:pos) return l:cur_keyword_pos endfunction"}}} function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{ if neocomplcache#is_eskk_enabled() && exists('g:eskk#start_completion_length') " Check complete length. if neocomplcache#util#mb_strlen(a:cur_keyword_str) < g:eskk#start_completion_length return [] endif endif let l:is_wildcard = g:neocomplcache_enable_wildcard && a:cur_keyword_str =~ '\*\w\+$' \&& neocomplcache#is_eskk_enabled() && neocomplcache#is_auto_complete() let l:filetype = neocomplcache#get_context_filetype() if neocomplcache#is_eskk_enabled() let l:omnifunc = &l:omnifunc elseif has_key(g:neocomplcache_omni_functions, l:filetype) let l:omnifunc = g:neocomplcache_omni_functions[l:filetype] elseif &filetype == l:filetype let l:omnifunc = &l:omnifunc endif let l:pos = getpos('.') if l:is_wildcard " Check wildcard. let l:cur_keyword_str = a:cur_keyword_str[: match(a:cur_keyword_str, '\%(\*\w\+\)\+$') - 1] else let l:cur_keyword_str = a:cur_keyword_str endif try if l:omnifunc ==# 'rubycomplete#Complete' && l:is_wildcard let l:line = getline('.') let l:cur_text = neocomplcache#get_cur_text() call setline('.', l:cur_text[: match(l:cur_text, '\%(\*\w\+\)\+$') - 1]) endif let l:list = call(l:omnifunc, \ [0, (l:omnifunc ==# 'rubycomplete#Complete')? '' : l:cur_keyword_str]) if l:omnifunc ==# 'rubycomplete#Complete' && l:is_wildcard call setline('.', l:line) endif catch call neocomplcache#print_error(v:exception) let l:list = [] endtry call setpos('.', l:pos) if empty(l:list) return [] endif if l:is_wildcard let l:list = neocomplcache#keyword_filter(s:get_omni_list(l:list), a:cur_keyword_str) else let l:list = s:get_omni_list(l:list) endif return l:list endfunction"}}} function! neocomplcache#sources#omni_complete#define()"{{{ return s:source endfunction"}}} function! s:get_omni_list(list)"{{{ let l:omni_list = [] " Convert string list. for str in filter(copy(a:list), 'type(v:val) == '.type('')) let l:dict = { 'word' : str, 'menu' : '[O]' } call add(l:omni_list, l:dict) endfor for l:omni in filter(a:list, 'type(v:val) != '.type('')) let l:dict = { \'word' : l:omni.word, 'menu' : '[O]', \'abbr' : has_key(l:omni, 'abbr')? l:omni.abbr : l:omni.word, \} if has_key(l:omni, 'kind') let l:dict.kind = l:omni.kind endif if has_key(l:omni, 'menu') let l:dict.menu .= ' ' . l:omni.menu endif call add(l:omni_list, l:dict) endfor return l:omni_list endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker autoload/neocomplcache/sources/snippets_complete/_.snip [[[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")` autoload/neocomplcache/sources/snippets_complete/actionscript.snip [[[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} }; autoload/neocomplcache/sources/snippets_complete/apache.snip [[[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} autoload/neocomplcache/sources/snippets_complete/applescript.snip [[[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}"\}} autoload/neocomplcache/sources/snippets_complete/c.snip [[[1 124 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 do { ${0:/* code */} } while (${1:/* condition */}); snippet switch abbr switch () {} switch (${1:var}) { case ${2:val}: ${0} break; } snippet function 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 #include <${1:stdio}.h>${0} # #include "..." snippet Inc #include "${1:}.h"${0} snippet Def abbr #ifndef ... #define ... #endif #ifndef $1 #define ${1:SYMBOL} ${2:value} #endif${0} snippet def #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} autoload/neocomplcache/sources/snippets_complete/coffee.snip [[[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...} autoload/neocomplcache/sources/snippets_complete/cpp.snip [[[1 20 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} } autoload/neocomplcache/sources/snippets_complete/css.snip [[[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} autoload/neocomplcache/sources/snippets_complete/d.snip [[[1 38 include c.snip # Delete snippet depended on C. delete struct delete struct_typedef delete enum delete main delete inc 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} } autoload/neocomplcache/sources/snippets_complete/eruby.snip [[[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} autoload/neocomplcache/sources/snippets_complete/java.snip [[[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} autoload/neocomplcache/sources/snippets_complete/javascript.snip [[[1 42 snippet :f ${1:method_name}: function(${2:attribute}){ ${0} } snippet func 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 ;, ${1:value_name}:${0:value}, snippet key ${1:key}: "${2:value}"}${3:, } snippet timeout setTimeout(function() {${0}}${2:}, ${1:10}); autoload/neocomplcache/sources/snippets_complete/markdown.snip [[[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} autoload/neocomplcache/sources/snippets_complete/objc.snip [[[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]; autoload/neocomplcache/sources/snippets_complete/perl.snip [[[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...} } autoload/neocomplcache/sources/snippets_complete/php.snip [[[1 266 snippet function abbr func ${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 func ${1:public }function ${2:FunctionName}(${3}}) { ${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}'] autoload/neocomplcache/sources/snippets_complete/python.snip [[[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} autoload/neocomplcache/sources/snippets_complete/rails.snip [[[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 => autoload/neocomplcache/sources/snippets_complete/ruby.snip [[[1 40 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 autoload/neocomplcache/sources/snippets_complete/sh.snip [[[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} autoload/neocomplcache/sources/snippets_complete/snippet.snip [[[1 8 snippet snippet abbr snippet abbr prev_word alias snip prev_word '^' snippet ${1:trigger} abbr ${2:abbr} prev_word '^' ${3:snippet code} autoload/neocomplcache/sources/snippets_complete/tex.snip [[[1 15 snippet math abbr $ expression $ $${1:expression}$${2} snippet begin \begin{${1:type}} ${2} \end{$1} ${0} snippet \begin \begin{${1:type}} ${2} \end{$1} ${0} autoload/neocomplcache/sources/snippets_complete/vim.snip [[[1 56 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}) autoload/neocomplcache/sources/snippets_complete/vimshell.snip [[[1 4 snippet sl abbr => ls? ls autoload/neocomplcache/sources/snippets_complete/xhtml.snip [[[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