" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish autoload/neocomplcache.vim [[[1 1798 "============================================================================= " FILE: neocomplcache.vim " AUTHOR: Shougo Matsushita " Last Modified: 05 Dec 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. " }}} " Version: 5.3, for Vim 7.0 "============================================================================= " Check vimproc. try call vimproc#version() let s:exists_vimproc = 1 catch let s:exists_vimproc = 0 endtry let s:is_enabled = 0 function! neocomplcache#enable() "{{{ augroup neocomplcache "{{{ autocmd! " Auto complete events autocmd CursorMovedI * call s:on_moved_i() autocmd CursorHoldI * call s:on_hold_i() autocmd InsertEnter * call s:on_insert_enter() autocmd InsertLeave * call s:on_insert_leave() augroup END "}}} " Disable beep. set vb t_vb= " Initialize"{{{ let s:is_enabled = 1 let s:complfunc_sources = {} let s:plugin_sources = {} let s:ftplugin_sources = {} let s:loaded_ftplugin_sources = {} let s:complete_lock = {} let s:auto_completion_length = {} let s:cur_keyword_pos = -1 let s:cur_keyword_str = '' let s:complete_words = [] let s:old_cur_keyword_pos = -1 let s:quick_match_keywordpos = -1 let s:old_complete_words = [] let s:update_time_save = &updatetime let s:prev_numbered_dict = {} let s:cur_text = '' let s:old_cur_text = '' let s:moved_cur_text = '' let s:changedtick = b:changedtick let s:used_match_filter = 0 let s:context_filetype = '' let s:is_text_mode = 0 let s:within_comment = 0 let s:skip_next_complete = 0 "}}} " Initialize sources table."{{{ " Search autoload. for file in split(globpath(&runtimepath, 'autoload/neocomplcache/sources/*.vim'), '\n') let l:source_name = fnamemodify(file, ':t:r') if !has_key(s:plugin_sources, l:source_name) \ && (!has_key(g:neocomplcache_plugin_disable, l:source_name) || \ g:neocomplcache_plugin_disable[l:source_name] == 0) let l:source = call('neocomplcache#sources#' . l:source_name . '#define', []) if empty(l:source) " Ignore. elseif l:source.kind ==# 'complfunc' let s:complfunc_sources[l:source_name] = l:source elseif l:source.kind ==# 'ftplugin' let s:ftplugin_sources[l:source_name] = l:source " Clear loaded flag. let s:ftplugin_sources[l:source_name].loaded = 0 elseif l:source.kind ==# 'plugin' let s:plugin_sources[l:source_name] = l:source endif endif endfor "}}} " Initialize keyword patterns."{{{ if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'default', \'\k\+') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'filename', \'\%(\\[^[:alnum:].-]\|\f\)\+') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'lisp,scheme,clojure,int-gosh,int-clisp,int-clj', \'[[:alpha:]+*/@$_=.!?-][[:alnum:]+*/@$_:=.!?-]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'ruby,int-irb', \'^=\%(b\%[egin]\|e\%[nd]\)\|\%(@@\|[:$@]\)\h\w*\|\h\w*\%(::\w*\)*[!?]\?\%(()\?\|\s\?\%(do\|{\)\s\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'php', \'\)\?\|\$\h\w*\|\h\w*\%(\%(\\\|::\)\w*\)*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'perl,int-perlsh', \'<\h\w*>\?\|[$@%&*]\h\w*\|\h\w*\%(::\w*\)*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'perl6,int-perl6', \'<\h\w*>\?\|[$@%&][!.*?]\?\h[[:alnum:]_-]*\|\h[[:alnum:]_-]*\%(::[[:alnum:]_-]*\)*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'pir', \'[$@%.=]\?\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'pasm', \'[=]\?\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'vim,help', \'\c\[:\%(\h\w*:\]\)\?\|&\h[[:alnum:]_:]*\|\$\h\w*\|-\h\w*=\?\|\%(\h\w*(\?\)\?\|([^)]*)\?\|<\h[[:alnum:]_-]*>\?\|\h[[:alnum:]_:#]*\%(!\|()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'tex', \'\\\a{\a\{1,2}}\|\\[[:alpha:]@][[:alnum:]@]*\%({\%([[:alnum:]:]\+\*\?}\?\)\?\)\?\|\a[[:alnum:]:]*\*\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'sh,zsh,int-zsh,int-bash,int-sh', \'\$\w\+\|[[:alpha:]_.-][[:alnum:]_.-]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'vimshell', \'\$\$\?\w*\|[[:alpha:]_.\\/~-][[:alnum:]_.\\/~-]*\|\d\+\%(\.\d\+\)\+') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'ps1,int-powershell', \'\[\h\%([[:alnum:]_.]*\]::\)\?\|[$%@.]\?[[:alpha:]_.:-][[:alnum:]_.:-]*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'c', \'^\s*#\s*\h\w*\|\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'cpp', \'^\s*#\s*\h\w*\|\h\w*\%(::\w*\)*\%(()\?\|<>\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'objc', \'^\s*#\s*\h\w*\|\h\w*\%(()\?\|<>\?\|:\)\?\|@\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'objcpp', \'^\s*#\s*\h\w*\|\h\w*\%(::\w*\)*\%(()\?\|<>\?\|:\)\?\|@\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'objj', \'\h\w*\%(()\?\|<>\?\|:\)\?\|@\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'd', \'\h\w*\%(!\?()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'python,int-python,int-ipython', \'\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'cs', \'\h\w*\%(()\?\|<\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'java', \'[@]\?\h\w*\%(()\?\|<\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'javascript,actionscript,int-js,int-kjs', \'\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'coffee,int-coffee', \'@\h\w*\|\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'awk', \'\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'haskell,int-ghci', \'\%(\u\w*\.\)\+[[:alnum:]_'']*\|[[:alpha:]_''][[:alnum:]_'']*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'ml,ocaml,int-ocaml,int-sml,int-smlsharp', \'[''`#.]\?\h[[:alnum:]_'']*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'erlang,int-erl', \'^\s*-\h\w*()?\|\%(\h\w*:\)*\h\w()\?\|\h[[:alnum:]_@]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'html,xhtml,xml,markdown,eruby', \'\)\?\|&\h\%(\w*;\)\?\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'css', \'[@#.]\?[[:alpha:]_:-][[:alnum:]_:-]*(\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'tags', \'^[^!][^/[:blank:]]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'pic', \'^\s*#\h\w*\|\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'arm', \'\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'asmh8300', \'[[:alpha:]_.][[:alnum:]_.]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'masm', \'\.\h\w*\|[[:alpha:]_@?$][[:alnum:]_@?$]*\|\h\w*:\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'nasm', \'^\s*\[\h\w*\|[%.]\?\h\w*\|\%(\.\.@\?\|%[%$!]\)\%(\h\w*\)\?\|\h\w*:\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'asm', \'[%$.]\?\h\w*\%(\$\h\w*\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'gas', \'[$.]\?\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'gdb,int-gdb', \'$\h\w*\|[[:alnum:]:._-]\+') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'make', \'[[:alpha:]_.-][[:alnum:]_.-]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'scala,int-scala', \'\h\w*\%(()\?\|\[\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'int-termtter', \'\h[[:alnum:]_/-]*\|\$\a\+\|#\h\w*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'dosbatch,int-cmdproxy', \'\$\w+\|[[:alpha:]_./-][[:alnum:]_.-]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'vb', \'\a[[:alnum:]]*\%(()\?\)\?\|#\a[[:alnum:]]*') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'lua', \'\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'zimbu', \'\h\w*\%(()\?\)\?') call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns, 'konoha', \'[*$@%]\h\w*\|\h\w*\%(()\?\|!!\)\?') "}}} " Initialize next keyword patterns."{{{ if !exists('g:neocomplcache_next_keyword_patterns') let g:neocomplcache_next_keyword_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'perl', \'\h\w*>') call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'perl6', \'\h\w*>') call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'vim,help', \'\w*:\]\|[[:alnum:]_-]*[)>=]') call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'tex', \'\h\w*\*\?[*[{}]') call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'html,xhtml,xml,mkd', \'[[:alnum:]_:-]*>\|[^"]*"') "}}} " Initialize same file type lists."{{{ if !exists('g:neocomplcache_same_filetype_lists') let g:neocomplcache_same_filetype_lists = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'c', 'cpp') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'cpp', 'c') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'erb', 'ruby,html,xhtml') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'html,xml', 'xhtml') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'html,xhtml', 'css') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'xhtml', 'html,xml') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'help', 'vim') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'lingr-say', 'lingr-messages,lingr-members') " Interactive filetypes. call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-irb', 'ruby') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-ghci,int-hugs', 'haskell') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-python,int-ipython', 'python') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-gosh', 'scheme') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-clisp', 'lisp') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-erl', 'erlang') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-zsh', 'zsh') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-bash', 'bash') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-sh', 'sh') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-cmdproxy', 'dosbatch') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-powershell', 'powershell') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-perlsh', 'perl') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-perl6', 'perl6') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-ocaml', 'ocaml') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-clj', 'clojure') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-sml,int-smlsharp', 'sml') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-js,int-kjs', 'javascript') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-coffee', 'coffee') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-gdb', 'gdb') call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists, 'int-scala', 'scala') "}}} " Initialize include filetype lists."{{{ if !exists('g:neocomplcache_filetype_include_lists') let g:neocomplcache_filetype_include_lists = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists, 'c,cpp', [ \ {'filetype' : 'masm', 'start' : '_*asm\s*\%(\n\s*\)\?{', 'end' : '}'}, \ {'filetype' : 'masm', 'start' : '_*asm\s*\h\w*', 'end' : '$'}, \ {'filetype' : 'gas', 'start' : '_*asm_*\s*\%(_*volatile_*\s*\)\?(', 'end' : ');'}, \]) call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists, 'd', [ \ {'filetype' : 'masm', 'start' : 'asm\s*\%(\n\s*\)\?{', 'end' : '}'}, \]) call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists, 'perl6', [ \ {'filetype' : 'pir', 'start' : 'Q:PIR\s*{', 'end' : '}'}, \]) call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists, 'vimshell', [ \ {'filetype' : 'vim', 'start' : 'vexe \([''"]\)', 'end' : '\\\@'}, \]) call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists, 'vim', [ \ {'filetype' : 'python', 'start' : '^\s*python <<\s*\(\h\w*\)', 'end' : '^\1'}, \ {'filetype' : 'ruby', 'start' : '^\s*ruby <<\s*\(\h\w*\)', 'end' : '^\1'}, \]) call neocomplcache#set_dictionary_helper(g:neocomplcache_filetype_include_lists, 'html,xhtml', [ \ {'filetype' : 'javascript', 'start' : ''}, \ {'filetype' : 'css', 'start' : ''}, \]) "}}} " Initialize member prefix patterns."{{{ if !exists('g:neocomplcache_member_prefix_patterns') let g:neocomplcache_member_prefix_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_member_prefix_patterns, 'c,cpp,objc,objcpp', '\.\|->') call neocomplcache#set_dictionary_helper(g:neocomplcache_member_prefix_patterns, 'perl,php', '->') call neocomplcache#set_dictionary_helper(g:neocomplcache_member_prefix_patterns, 'cs,java,javascript,d,vim,ruby,python,perl6,scala,vb', '\.') call neocomplcache#set_dictionary_helper(g:neocomplcache_member_prefix_patterns, 'lua', '\.\|:') "}}} " Initialize delimiter patterns."{{{ if !exists('g:neocomplcache_delimiter_patterns') let g:neocomplcache_delimiter_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'vim,help', \['#']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'erlang,lisp,int-clisp', \[':']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'lisp,int-clisp', \['/', ':']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'clojure,int-clj', \['/', '\.']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'perl,cpp', \['::']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'php', \['\\', '::']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'java,d,javascript,actionscript,ruby,eruby,haskell,int-ghci,coffee,zimbu,konoha', \['\.']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'lua', \['\.', ':']) call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns, 'perl6', \['\.', '::']) "}}} " Initialize ctags arguments."{{{ if !exists('g:neocomplcache_ctags_arguments_list') let g:neocomplcache_ctags_arguments_list = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_ctags_arguments_list, 'default', '') call neocomplcache#set_dictionary_helper(g:neocomplcache_ctags_arguments_list, 'vim', \"--extra=fq --fields=afmiKlnsStz --regex-vim='/function!? ([a-z#:_0-9A-Z]+)/\\1/function/'") if !neocomplcache#is_win() && (has('macunix') || neocomplcache#system('uname') =~? '^darwin') call neocomplcache#set_dictionary_helper(g:neocomplcache_ctags_arguments_list, 'c', \'--c-kinds=+p --fields=+iaS --extra=+q -I__DARWIN_ALIAS,__DARWIN_ALIAS_C,__DARWIN_ALIAS_I,__DARWIN_INODE64 \ -I__DARWIN_1050,__DARWIN_1050ALIAS,__DARWIN_1050ALIAS_C,__DARWIN_1050ALIAS_I,__DARWIN_1050INODE64 \ -I__DARWIN_EXTSN,__DARWIN_EXTSN_C \ -I__DARWIN_LDBL_COMPAT,__DARWIN_LDBL_COMPAT2') else call neocomplcache#set_dictionary_helper(g:neocomplcache_ctags_arguments_list, 'c', \'--c-kinds=+p --fields=+iaS --extra=+q -I __wur') endif call neocomplcache#set_dictionary_helper(g:neocomplcache_ctags_arguments_list, 'cpp', \'--c++-kinds=+p --fields=+iaS --extra=+q -I __wur') "}}} " Initialize text mode filetypes."{{{ if !exists('g:neocomplcache_text_mode_filetypes') let g:neocomplcache_text_mode_filetypes = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_text_mode_filetypes, 'text,help,tex,gitcommit,nothing', 1) "}}} " Initialize quick match patterns."{{{ if !exists('g:neocomplcache_quick_match_patterns') let g:neocomplcache_quick_match_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_quick_match_patterns, 'default', '-') "}}} " Initialize tags filter patterns."{{{ if !exists('g:neocomplcache_tags_filter_patterns') let g:neocomplcache_tags_filter_patterns = {} endif call neocomplcache#set_dictionary_helper(g:neocomplcache_tags_filter_patterns, 'c,cpp', \'v:val.word !~ ''^[~_]''') "}}} " Add commands."{{{ command! -nargs=0 NeoComplCacheDisable call neocomplcache#disable() command! -nargs=? Neco call s:display_neco() command! -nargs=0 NeoComplCacheLock call s:lock() command! -nargs=0 NeoComplCacheUnlock call s:unlock() command! -nargs=0 NeoComplCacheToggle call s:toggle_lock() command! -nargs=1 NeoComplCacheAutoCompletionLength call s:set_auto_completion_length() "}}} " Must g:neocomplcache_auto_completion_start_length > 1. if g:neocomplcache_auto_completion_start_length < 1 let g:neocomplcache_auto_completion_start_length = 1 endif " Must g:neocomplcache_min_keyword_length > 1. if g:neocomplcache_min_keyword_length < 1 let g:neocomplcache_min_keyword_length = 1 endif " Save options. let s:completefunc_save = &completefunc let s:completeopt_save = &completeopt " Set completefunc. let &completefunc = 'neocomplcache#manual_complete' let &l:completefunc = 'neocomplcache#manual_complete' " Set options. set completeopt-=menu if !g:neocomplcache_disable_auto_complete set completeopt-=longest endif set completeopt+=menuone " Disable bell. set vb t_vb= " Initialize. for l:source in values(neocomplcache#available_complfuncs()) call l:source.initialize() endfor endfunction"}}} function! neocomplcache#disable()"{{{ let s:is_enabled = 0 " Restore options. let &completefunc = s:completefunc_save let &completeopt = s:completeopt_save augroup neocomplcache autocmd! augroup END delcommand NeoComplCacheDisable delcommand Neco delcommand NeoComplCacheLock delcommand NeoComplCacheUnlock delcommand NeoComplCacheToggle delcommand NeoComplCacheAutoCompletionLength for l:source in values(neocomplcache#available_complfuncs()) call l:source.finalize() endfor for l:source in values(neocomplcache#available_ftplugins()) if l:source.loaded call l:source.finalize() endif endfor endfunction"}}} function! neocomplcache#manual_complete(findstart, base)"{{{ if a:findstart if !neocomplcache#is_enabled() return -1 endif let s:old_complete_words = [] " Clear flag. let s:used_match_filter = 0 let [l:cur_keyword_pos, l:cur_keyword_str, l:complete_words] = s:integrate_completion(s:get_complete_result(s:get_cur_text()), 1) if empty(l:complete_words) return -1 endif let s:complete_words = l:complete_words return l:cur_keyword_pos else let s:old_complete_words = s:complete_words return s:complete_words endif endfunction"}}} function! neocomplcache#auto_complete(findstart, base)"{{{ if a:findstart if !neocomplcache#is_enabled() return -1 endif " Check text was changed. let l:cached_text = s:cur_text if s:get_cur_text() != l:cached_text " Text was changed. " Restore options. let s:cur_keyword_pos = -1 let &l:completefunc = 'neocomplcache#manual_complete' let s:old_complete_words = s:complete_words let s:complete_words = [] return -1 endif let s:old_cur_keyword_pos = s:cur_keyword_pos let s:cur_keyword_pos = -1 return s:old_cur_keyword_pos else " Restore option. let &l:completefunc = 'neocomplcache#manual_complete' let s:old_complete_words = s:complete_words let s:complete_words = [] return s:old_complete_words endif endfunction"}}} function! neocomplcache#do_auto_complete(is_moved)"{{{ if (&buftype !~ 'nofile\|nowrite' && b:changedtick == s:changedtick) || &paste \ || g:neocomplcache_disable_auto_complete \ || neocomplcache#is_locked() \ || (&l:completefunc != 'neocomplcache#manual_complete' && &l:completefunc != 'neocomplcache#auto_complete') return endif " Detect global completefunc. if &g:completefunc != 'neocomplcache#manual_complete' && &g:completefunc != 'neocomplcache#auto_complete' 99verbose set completefunc echohl Error | echoerr 'Other plugin Use completefunc! Disabled neocomplcache.' | echohl None NeoComplCacheLock return endif " Detect AutoComplPop. if exists('g:acp_enableAtStartup') && g:acp_enableAtStartup echohl Error | echoerr 'Detected enabled AutoComplPop! Disabled neocomplcache.' | echohl None NeoComplCacheLock return endif " Get cursor word. let l:cur_text = s:get_cur_text() " Prevent infinity loop. if l:cur_text == '' || l:cur_text == s:old_cur_text \|| (!neocomplcache#is_eskk_enabled() && exists('b:skk_on') && b:skk_on) let s:complete_words = [] let s:old_complete_words = [] return endif let l:quick_match_pattern = s:get_quick_match_pattern() if g:neocomplcache_enable_quick_match && l:cur_text =~ l:quick_match_pattern.'[a-z0-9;,./]$' " Select quick_match list. let l:complete_words = s:select_quick_match_list(l:cur_text[-1:]) let s:prev_numbered_dict = {} if !empty(l:complete_words) let s:complete_words = l:complete_words let s:cur_keyword_pos = s:old_cur_keyword_pos " Set function. let &l:completefunc = 'neocomplcache#auto_complete' if neocomplcache#is_auto_select() call feedkeys("\\\\", 'n') else call feedkeys("\\", 'n') endif let s:old_cur_text = l:cur_text return endif elseif g:neocomplcache_enable_quick_match \&& !empty(s:old_complete_words) \&& l:cur_text =~ l:quick_match_pattern.'$' \&& l:cur_text !~ l:quick_match_pattern . l:quick_match_pattern.'$' " Print quick_match list. let [l:cur_keyword_pos, l:cur_keyword_str] = neocomplcache#match_word(l:cur_text[: -len(matchstr(l:cur_text, l:quick_match_pattern.'$'))-1]) let s:cur_keyword_pos = l:cur_keyword_pos let s:complete_words = s:make_quick_match_list(s:old_complete_words, l:cur_keyword_str) " Set function. let &l:completefunc = 'neocomplcache#auto_complete' call feedkeys("\\\", 'n') let s:old_cur_text = l:cur_text return elseif a:is_moved && g:neocomplcache_enable_cursor_hold_i \&& !s:used_match_filter if l:cur_text !=# s:moved_cur_text let s:moved_cur_text = l:cur_text " Dummy cursor move. call feedkeys("a\", 'n') return endif endif let s:old_cur_text = l:cur_text if s:skip_next_complete let s:skip_next_complete = 0 return endif " Clear flag. let s:used_match_filter = 0 let l:is_quick_match_list = 0 let s:prev_numbered_dict = {} let s:complete_words = [] let s:old_complete_words = [] let s:changedtick = b:changedtick " Set function. let &l:completefunc = 'neocomplcache#auto_complete' " Get complete result. let [l:cur_keyword_pos, l:cur_keyword_str, l:complete_words] = s:integrate_completion(s:get_complete_result(l:cur_text), 1) if empty(l:complete_words) let &l:completefunc = 'neocomplcache#manual_complete' let s:changedtick = b:changedtick let s:used_match_filter = 0 return endif let [s:cur_keyword_pos, s:cur_keyword_str, s:complete_words] = \[l:cur_keyword_pos, l:cur_keyword_str, l:complete_words] " Start auto complete. if neocomplcache#is_auto_select() call feedkeys("\\\\", 'n') else call feedkeys("\\\", 'n') endif let s:changedtick = b:changedtick endfunction"}}} " Plugin helper."{{{ function! neocomplcache#available_complfuncs()"{{{ return s:complfunc_sources endfunction"}}} function! neocomplcache#available_ftplugins()"{{{ return s:ftplugin_sources endfunction"}}} function! neocomplcache#available_loaded_ftplugins()"{{{ return s:loaded_ftplugin_sources endfunction"}}} function! neocomplcache#available_plugins()"{{{ return s:plugin_sources endfunction"}}} function! neocomplcache#available_sources()"{{{ call s:set_context_filetype() return extend(extend(copy(s:complfunc_sources), s:plugin_sources), s:loaded_ftplugin_sources) endfunction"}}} function! neocomplcache#keyword_escape(cur_keyword_str)"{{{ " Escape."{{{ let l:keyword_escape = escape(a:cur_keyword_str, '~" \.^$[]') if g:neocomplcache_enable_wildcard let l:keyword_escape = substitute(substitute(l:keyword_escape, '.\zs\*', '.*', 'g'), '\%(^\|\*\)\zs\*', '\\*', 'g') if '-' !~ '\k' let l:keyword_escape = substitute(l:keyword_escape, '.\zs-', '.\\+', 'g') endif else let l:keyword_escape = escape(a:cur_keyword_str, '*') endif"}}} " Underbar completion."{{{ if g:neocomplcache_enable_underbar_completion && l:keyword_escape =~ '_' let l:keyword_escape = substitute(l:keyword_escape, '[^_]\zs_', '[^_]*_', 'g') endif if g:neocomplcache_enable_underbar_completion && '-' =~ '\k' && l:keyword_escape =~ '-' let l:keyword_escape = substitute(l:keyword_escape, '[^-]\zs-', '[^-]*-', 'g') endif "}}} " Camel case completion."{{{ if g:neocomplcache_enable_camel_case_completion && l:keyword_escape =~ '\u' let l:keyword_escape = substitute(l:keyword_escape, '\u\?\zs\U*', '\\%(\0\\l*\\|\U\0\E\\u*_\\?\\)', 'g') endif "}}} "echo l:keyword_escape return l:keyword_escape endfunction"}}} function! neocomplcache#keyword_filter(list, cur_keyword_str)"{{{ let l:cur_keyword_str = a:cur_keyword_str " Delimiter check. let l:filetype = neocomplcache#get_context_filetype() if has_key(g:neocomplcache_delimiter_patterns, l:filetype)"{{{ for l:delimiter in g:neocomplcache_delimiter_patterns[l:filetype] let l:cur_keyword_str = substitute(l:cur_keyword_str, l:delimiter, '*' . l:delimiter, 'g') endfor endif"}}} if l:cur_keyword_str == '' return a:list elseif neocomplcache#check_match_filter(l:cur_keyword_str) let s:used_match_filter = 1 " Match filter. return filter(a:list, printf("v:val.word =~ %s", \string('^' . neocomplcache#keyword_escape(l:cur_keyword_str)))) else " Use fast filter. return neocomplcache#head_filter(a:list, l:cur_keyword_str) endif endfunction"}}} function! neocomplcache#dup_filter(list)"{{{ let l:dict = {} for l:keyword in a:list if !has_key(l:dict, l:keyword.word) let l:dict[l:keyword.word] = l:keyword endif endfor return values(l:dict) endfunction"}}} function! neocomplcache#check_match_filter(cur_keyword_str, ...)"{{{ return neocomplcache#keyword_escape( \empty(a:000)? a:cur_keyword_str : a:cur_keyword_str[ : a:1-1]) =~ '[^\\]\*\|\\+' endfunction"}}} function! neocomplcache#head_filter(list, cur_keyword_str)"{{{ if &ignorecase let l:expr = printf('!stridx(tolower(v:val.word), %s)', string(tolower(a:cur_keyword_str))) else let l:expr = printf('!stridx(v:val.word, %s)', string(a:cur_keyword_str)) endif return filter(a:list, l:expr) endfunction"}}} function! neocomplcache#fuzzy_filter(list, cur_keyword_str)"{{{ let l:ret = [] let l:cur_keyword_str = a:cur_keyword_str[2:] let l:max_str2 = len(l:cur_keyword_str) let l:len = len(a:cur_keyword_str) let m = range(l:max_str2+1) for keyword in filter(a:list, 'len(v:val.word) >= '.l:max_str2) let l:str1 = keyword.word[2 : l:len-1] let i = 0 while i <= l:max_str2+1 let m[i] = range(l:max_str2+1) let i += 1 endwhile let i = 0 while i <= l:max_str2+1 let m[i][0] = i let m[0][i] = i let i += 1 endwhile let i = 1 let l:max = l:max_str2 + 1 while i < l:max let j = 1 while j < l:max let m[i][j] = min([m[i-1][j]+1, m[i][j-1]+1, m[i-1][j-1]+(l:str1[i-1] != l:cur_keyword_str[j-1])]) let j += 1 endwhile let i += 1 endwhile if m[-1][-1] <= 2 call add(l:ret, keyword) endif endfor return ret endfunction"}}} function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str, completion_length)"{{{ if len(a:cur_keyword_str) < a:completion_length || \neocomplcache#check_match_filter(a:cur_keyword_str, a:completion_length) return neocomplcache#keyword_filter(neocomplcache#unpack_dictionary(a:dictionary), a:cur_keyword_str) else let l:key = tolower(a:cur_keyword_str[: a:completion_length-1]) if !has_key(a:dictionary, l:key) return [] endif return (len(a:cur_keyword_str) == a:completion_length && &ignorecase)? \ a:dictionary[l:key] : neocomplcache#keyword_filter(copy(a:dictionary[l:key]), a:cur_keyword_str) endif endfunction"}}} function! neocomplcache#unpack_dictionary(dict)"{{{ let l:ret = [] for l in values(a:dict) let l:ret += l endfor return l:ret endfunction"}}} function! neocomplcache#unpack_dictionary_dictionary(dict)"{{{ let l:ret = [] for l in values(a:dict) let l:ret += values(l) endfor return l:ret endfunction"}}} function! neocomplcache#add_dictionaries(dictionaries)"{{{ if empty(a:dictionaries) return {} endif let l:ret = a:dictionaries[0] for l:dict in a:dictionaries[1:] for [l:key, l:value] in items(l:dict) if has_key(l:ret, l:key) let l:ret[l:key] += l:value else let l:ret[l:key] = l:value endif endfor endfor return l:ret endfunction"}}} function! neocomplcache#used_match_filter()"{{{ let s:used_match_filter = 1 endfunction"}}} " RankOrder."{{{ function! neocomplcache#compare_rank(i1, i2) return a:i2.rank - a:i1.rank endfunction"}}} " PosOrder."{{{ function! s:compare_pos(i1, i2) return a:i1[0] == a:i2[0] ? a:i1[1] - a:i2[1] : a:i1[0] - a:i2[0] endfunction"}}} function! neocomplcache#rand(max)"{{{ if !has('reltime') " Same value. return 0 endif let l:time = reltime()[1] return (l:time < 0 ? -l:time : l:time)% (a:max + 1) endfunction"}}} function! neocomplcache#system(str, ...)"{{{ let l:command = a:str let l:input = a:0 >= 1 ? a:1 : '' if &termencoding != '' && &termencoding != &encoding let l:command = iconv(l:command, &encoding, &termencoding) let l:input = iconv(l:input, &encoding, &termencoding) endif if !s:exists_vimproc if a:0 == 0 let l:output = system(l:command) else let l:output = system(l:command, l:input) endif elseif a:0 == 0 let l:output = vimproc#system(l:command) elseif a:0 == 1 let l:output = vimproc#system(l:command, l:input) else let l:output = vimproc#system(l:command, l:input, a:2) endif if &termencoding != '' && &termencoding != &encoding let l:output = iconv(l:output, &termencoding, &encoding) endif return l:output endfunction"}}} function! neocomplcache#get_cur_text(...)"{{{ " Return cached text. return a:0 == 0 ? s:cur_text : s:get_cur_text() endfunction"}}} function! neocomplcache#get_completion_length(plugin_name)"{{{ if neocomplcache#is_auto_complete() && has_key(s:auto_completion_length, bufnr('%')) return s:auto_completion_length[bufnr('%')] elseif has_key(g:neocomplcache_plugin_completion_length, a:plugin_name) return g:neocomplcache_plugin_completion_length[a:plugin_name] elseif neocomplcache#is_auto_complete() return g:neocomplcache_auto_completion_start_length else return g:neocomplcache_manual_completion_start_length endif endfunction"}}} function! neocomplcache#set_completion_length(plugin_name, length)"{{{ if !has_key(g:neocomplcache_plugin_completion_length, a:plugin_name) let g:neocomplcache_plugin_completion_length[a:plugin_name] = a:length endif endfunction"}}} function! neocomplcache#get_auto_completion_length(plugin_name)"{{{ if has_key(g:neocomplcache_plugin_completion_length, a:plugin_name) return g:neocomplcache_plugin_completion_length[a:plugin_name] else return g:neocomplcache_auto_completion_start_length endif endfunction"}}} function! neocomplcache#get_keyword_pattern(...)"{{{ let l:filetype = a:0 != 0? a:000[0] : neocomplcache#get_context_filetype() let l:keyword_patterns = [] for l:ft in split(l:filetype, '\.') call add(l:keyword_patterns, has_key(g:neocomplcache_keyword_patterns, l:ft) ? \ g:neocomplcache_keyword_patterns[l:ft] : g:neocomplcache_keyword_patterns['default']) endfor return join(l:keyword_patterns, '\m\|') endfunction"}}} function! neocomplcache#get_next_keyword_pattern(...)"{{{ let l:filetype = a:0 != 0? a:000[0] : neocomplcache#get_context_filetype() if has_key(g:neocomplcache_next_keyword_patterns, l:filetype) return g:neocomplcache_next_keyword_patterns[l:filetype] . '\m\|' . neocomplcache#get_keyword_pattern(l:filetype) else return neocomplcache#get_keyword_pattern(l:filetype) endif endfunction"}}} function! neocomplcache#get_keyword_pattern_end(...)"{{{ let l:filetype = a:0 != 0? a:000[0] : neocomplcache#get_context_filetype() return '\%('.neocomplcache#get_keyword_pattern(l:filetype).'\m\)$' endfunction"}}} function! neocomplcache#get_prev_word(cur_keyword_str)"{{{ let l:keyword_pattern = neocomplcache#get_keyword_pattern() let l:line_part = neocomplcache#get_cur_text()[: -1-len(a:cur_keyword_str)] let l:prev_word_end = matchend(l:line_part, l:keyword_pattern) if l:prev_word_end > 0 let l:word_end = matchend(l:line_part, l:keyword_pattern, l:prev_word_end) if l:word_end >= 0 while l:word_end >= 0 let l:prev_word_end = l:word_end let l:word_end = matchend(l:line_part, l:keyword_pattern, l:prev_word_end) endwhile endif let l:prev_word = matchstr(l:line_part[: l:prev_word_end-1], l:keyword_pattern . '$') else let l:prev_word = '^' endif return l:prev_word endfunction"}}} function! neocomplcache#match_word(cur_text, ...)"{{{ let l:pattern = a:0 >= 1 ? a:1 : neocomplcache#get_keyword_pattern_end() " Check wildcard. let l:cur_keyword_pos = s:match_wildcard(a:cur_text, l:pattern, match(a:cur_text, l:pattern)) let l:cur_keyword_str = a:cur_text[l:cur_keyword_pos :] return [l:cur_keyword_pos, l:cur_keyword_str] endfunction"}}} function! neocomplcache#is_enabled()"{{{ return s:is_enabled endfunction"}}} function! neocomplcache#is_locked(...)"{{{ let l:bufnr = a:0 > 0 ? a:1 : bufnr('%') return !s:is_enabled \ || (has_key(s:complete_lock, l:bufnr) && s:complete_lock[l:bufnr]) \ || (g:neocomplcache_lock_buffer_name_pattern != '' && bufname(l:bufnr) =~ g:neocomplcache_lock_buffer_name_pattern) endfunction"}}} function! neocomplcache#is_auto_select()"{{{ return g:neocomplcache_enable_auto_select && !neocomplcache#is_eskk_enabled() \ && (g:neocomplcache_disable_auto_select_buffer_name_pattern == '' \ || bufname('%') !~ g:neocomplcache_disable_auto_select_buffer_name_pattern) endfunction"}}} function! neocomplcache#is_auto_complete()"{{{ return &l:completefunc == 'neocomplcache#auto_complete' endfunction"}}} function! neocomplcache#is_eskk_enabled()"{{{ return exists('g:loaded_eskk') && (!exists('g:eskk_disable') || !g:eskk_disable) && eskk#is_enabled() endfunction"}}} function! neocomplcache#is_text_mode()"{{{ return s:is_text_mode || s:within_comment endfunction"}}} function! neocomplcache#is_win()"{{{ return has('win32') || has('win64') endfunction"}}} function! neocomplcache#exists_echodoc()"{{{ return exists('g:loaded_echodoc') && g:loaded_echodoc endfunction"}}} function! neocomplcache#within_comment()"{{{ return s:within_comment endfunction"}}} function! neocomplcache#print_caching(string)"{{{ if g:neocomplcache_enable_caching_message redraw echon a:string endif endfunction"}}} function! neocomplcache#print_error(string)"{{{ echohl Error | echomsg a:string | echohl None endfunction"}}} function! neocomplcache#print_warning(string)"{{{ echohl WarningMsg | echomsg a:string | echohl None endfunction"}}} function! neocomplcache#trunk_string(string, max)"{{{ return printf('%.' . a:max-10 . 's..%%s', a:string, a:string[-8:]) endfunction"}}} function! neocomplcache#head_match(checkstr, headstr)"{{{ return stridx(a:checkstr, a:headstr) == 0 endfunction"}}} function! neocomplcache#get_source_filetypes(filetype)"{{{ let l:filetype = a:filetype == ''? 'nothing' : a:filetype let l:filetype_dict = {} let l:filetypes = [l:filetype] if l:filetype =~ '\.' " Set compound filetype. let l:filetypes += split(l:filetype, '\.') endif for l:ft in l:filetypes let l:filetype_dict[l:ft] = 1 " Set same filetype. if has_key(g:neocomplcache_same_filetype_lists, l:ft) for l:same_ft in split(g:neocomplcache_same_filetype_lists[l:ft], ',') let l:filetype_dict[l:same_ft] = 1 endfor endif endfor return l:filetype_dict endfunction"}}} function! neocomplcache#get_sources_list(dictionary, filetype)"{{{ let l:list = [] for l:filetype in keys(neocomplcache#get_source_filetypes(a:filetype)) if has_key(a:dictionary, l:filetype) call add(l:list, a:dictionary[l:filetype]) endif endfor return l:list endfunction"}}} function! neocomplcache#escape_match(str)"{{{ return escape(a:str, '~"*\.^$[]') endfunction"}}} function! neocomplcache#get_context_filetype(...)"{{{ if a:0 != 0 || s:context_filetype == '' call s:set_context_filetype() endif return s:context_filetype endfunction"}}} function! neocomplcache#get_plugin_rank(plugin_name)"{{{ if has_key(g:neocomplcache_plugin_rank, a:plugin_name) return g:neocomplcache_plugin_rank[a:plugin_name] elseif has_key(s:complfunc_sources, a:plugin_name) return 10 elseif has_key(s:ftplugin_sources, a:plugin_name) return 100 elseif has_key(s:plugin_sources, a:plugin_name) return neocomplcache#get_plugin_rank('keyword_complete') else " unknown. return 1 endif endfunction"}}} function! neocomplcache#get_syn_name(is_trans)"{{{ return synIDattr(synID(line('.'), mode() ==# 'i' ? col('.')-1 : col('.'), a:is_trans), 'name') endfunction"}}} " Set pattern helper. function! neocomplcache#set_dictionary_helper(variable, keys, pattern)"{{{ for key in split(a:keys, ',') if !has_key(a:variable, key) let a:variable[key] = a:pattern endif endfor endfunction"}}} " Complete filetype helper. function! neocomplcache#filetype_complete(arglead, cmdline, cursorpos)"{{{ " Dup check. let l:ret = {} for l:item in map(split(globpath(&runtimepath, 'syntax/*.vim'), '\n'), 'fnamemodify(v:val, ":t:r")') if !has_key(l:ret, l:item) && l:item =~ '^'.a:arglead let l:ret[l:item] = 1 endif endfor return sort(keys(l:ret)) endfunction"}}} "}}} " Command functions."{{{ function! s:toggle_lock()"{{{ if !has_key(s:complete_lock, bufnr('%')) || !s:complete_lock[bufnr('%')] call s:lock() else call s:unlock() endif endfunction"}}} function! s:lock()"{{{ let s:complete_lock[bufnr('%')] = 1 endfunction"}}} function! s:unlock()"{{{ let s:complete_lock[bufnr('%')] = 0 endfunction"}}} function! s:display_neco(number)"{{{ let l:cmdheight_save = &cmdheight let l:animation = [ \[ \[ \ " A A", \ "~(-'_'-)" \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A ", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-^_^-)", \], \], \[ \[ \ " A A", \ "~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A ", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A ", \ " ~(-'_'-)" \], \[ \ " A A", \ " ~(-'_'-)" \], \[ \ " A A", \ " ~(-'_'-)" \], \[ \ " A A", \ "~(-'_'-)" \], \], \[ \[ \ " A A", \ "~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[ \ " A A", \ " ~(-'_'-)", \], \[" A A", \ " ~(-'_'-)", \], \], \[ \[ \ "", \ " A A", \ "~(-'_'-)", \], \[" A A", \ " ~(-'_'-)", \ "", \], \[ \ "", \ " A A", \ " ~(-'_'-)", \], \[ \ " A A ", \ " ~(-'_'-)", \ "", \], \[ \ "", \ " A A", \ " ~(-^_^-)", \], \], \[ \[ \ " A A A A", \ "~(-'_'-) -8(*'_'*)" \], \[ \ " A A A A", \ " ~(-'_'-) -8(*'_'*)" \], \[ \ " A A A A", \ " ~(-'_'-) -8(*'_'*)" \], \[ \ " A A A A", \ " ~(-'_'-) -8(*'_'*)" \], \[ \ " A A A A", \ "~(-'_'-) -8(*'_'*)" \], \], \[ \[ \ " A\\_A\\", \ "(=' .' ) ~w", \ "(,(\")(\")", \], \], \] let l:number = (a:number != '') ? a:number : len(l:animation) let l:anim = get(l:animation, l:number, l:animation[neocomplcache#rand(len(l:animation) - 1)]) let &cmdheight = len(l:anim[0]) for l:frame in l:anim echo repeat("\n", &cmdheight-2) redraw echon join(l:frame, "\n") sleep 300m endfor redraw let &cmdheight = l:cmdheight_save endfunction"}}} function! s:set_auto_completion_length(len)"{{{ let s:auto_completion_length[bufnr('%')] = a:len endfunction"}}} "}}} " Key mapping functions."{{{ function! neocomplcache#smart_close_popup()"{{{ return g:neocomplcache_enable_auto_select ? neocomplcache#cancel_popup() : neocomplcache#close_popup() endfunction "}}} function! neocomplcache#close_popup()"{{{ if !pumvisible() return '' endif let s:skip_next_complete = 1 let s:cur_keyword_pos = -1 let s:cur_keyword_str = '' let s:complete_words = [] let s:old_complete_words = [] let s:prev_numbered_dict = {} return "\" endfunction "}}} function! neocomplcache#cancel_popup()"{{{ if !pumvisible() return '' endif let s:skip_next_complete = 1 let s:cur_keyword_pos = -1 let s:cur_keyword_str = '' let s:complete_words = [] let s:old_complete_words = [] let s:prev_numbered_dict = {} return "\" endfunction "}}} " Wrapper functions. function! neocomplcache#manual_filename_complete()"{{{ return neocomplcache#start_manual_complete('filename_complete') endfunction"}}} function! neocomplcache#manual_omni_complete()"{{{ return neocomplcache#start_manual_complete('omni_complete') endfunction"}}} function! neocomplcache#manual_keyword_complete()"{{{ return neocomplcache#start_manual_complete('keyword_complete') endfunction"}}} " Manual complete wrapper. function! neocomplcache#start_manual_complete(complfunc_name)"{{{ let l:sources = neocomplcache#available_sources() if !has_key(l:sources, a:complfunc_name) echoerr printf("Invalid completefunc name %s is given.", a:complfunc_name) return '' endif " Clear flag. let s:used_match_filter = 0 " Set function. let &l:completefunc = 'neocomplcache#manual_complete' " Get complete result. let l:dict = {} let l:dict[a:complfunc_name] = l:sources[a:complfunc_name] let [l:cur_keyword_pos, l:cur_keyword_str, l:complete_words] = \ s:integrate_completion(s:get_complete_result(s:get_cur_text(), l:dict), 0) " Restore function. let &l:completefunc = 'neocomplcache#auto_complete' let [s:cur_keyword_pos, s:cur_keyword_str, s:complete_words] = [l:cur_keyword_pos, l:cur_keyword_str, l:complete_words] " Start complete. return "\\\" endfunction"}}} function! neocomplcache#start_manual_complete_list(cur_keyword_pos, cur_keyword_str, complete_words)"{{{ let [s:cur_keyword_pos, s:cur_keyword_str, s:complete_words] = [a:cur_keyword_pos, a:cur_keyword_str, a:complete_words] " Set function. let &l:completefunc = 'neocomplcache#auto_complete' " Start complete. return "\\\" endfunction"}}} function! neocomplcache#undo_completion()"{{{ if !exists(':NeoComplCacheDisable') return '' endif " Get cursor word. let [l:cur_keyword_pos, l:cur_keyword_str] = neocomplcache#match_word(s:get_cur_text()) let l:old_keyword_str = s:cur_keyword_str let s:cur_keyword_str = l:cur_keyword_str return (pumvisible() ? "\" : '') \ . repeat("\", len(l:cur_keyword_str)) . l:old_keyword_str endfunction"}}} function! neocomplcache#complete_common_string()"{{{ if !exists(':NeoComplCacheDisable') return '' endif " Save options. let l:ignorecase_save = &ignorecase " Get cursor word. let [l:cur_keyword_pos, l:cur_keyword_str] = neocomplcache#match_word(s:get_cur_text()) if neocomplcache#is_text_mode() let &ignorecase = 1 elseif g:neocomplcache_enable_smart_case && l:cur_keyword_str =~ '\u' let &ignorecase = 0 else let &ignorecase = g:neocomplcache_enable_ignore_case endif let l:complete_words = neocomplcache#keyword_filter(copy(s:old_complete_words), l:cur_keyword_str) if empty(l:complete_words) let &ignorecase = l:ignorecase_save return '' endif let l:common_str = l:complete_words[0].word for keyword in l:complete_words[1:] while !neocomplcache#head_match(keyword.word, l:common_str) let l:common_str = l:common_str[: -2] endwhile endfor if &ignorecase let l:common_str = tolower(l:common_str) endif let &ignorecase = l:ignorecase_save return (pumvisible() ? "\" : '') \ . repeat("\", len(l:cur_keyword_str)) . l:common_str endfunction"}}} "}}} " Event functions."{{{ function! s:on_hold_i()"{{{ if g:neocomplcache_enable_cursor_hold_i call neocomplcache#do_auto_complete(0) endif endfunction"}}} function! s:on_moved_i()"{{{ call neocomplcache#do_auto_complete(1) endfunction"}}} function! s:get_complete_result(cur_text, ...)"{{{ " Set context filetype. call s:set_context_filetype() let l:complfuncs = a:0 == 0 ? extend(copy(neocomplcache#available_complfuncs()), neocomplcache#available_loaded_ftplugins()) : a:1 " Try complfuncs completion."{{{ let l:complete_result = {} for [l:complfunc_name, l:complfunc] in items(l:complfuncs) if (has_key(g:neocomplcache_plugin_disable, l:complfunc_name) && g:neocomplcache_plugin_disable[l:complfunc_name]) \ || (neocomplcache#is_eskk_enabled() && l:complfunc_name !=# 'omni_complete') " Skip plugin. continue endif try let l:cur_keyword_pos = l:complfunc.get_keyword_pos(a:cur_text) catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error('Error occured in complfunc''s get_keyword_pos()!') call neocomplcache#print_error('Plugin name is ' . l:complfunc_name) return endtry if l:cur_keyword_pos >= 0 let l:cur_keyword_str = a:cur_text[l:cur_keyword_pos :] if len(l:cur_keyword_str) < neocomplcache#get_completion_length(l:complfunc_name) " Skip. continue endif " Save options. let l:ignorecase_save = &ignorecase if neocomplcache#is_text_mode() let &ignorecase = 1 elseif g:neocomplcache_enable_smart_case && l:cur_keyword_str =~ '\u' let &ignorecase = 0 else let &ignorecase = g:neocomplcache_enable_ignore_case endif try let l:words = l:complfunc.get_complete_words(l:cur_keyword_pos, l:cur_keyword_str) catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error('Error occured in complfunc''s get_complete_words()!') call neocomplcache#print_error('Plugin name is ' . l:complfunc_name) return endtry let &ignorecase = l:ignorecase_save if !empty(l:words) let l:complete_result[l:complfunc_name] = { \ 'complete_words' : l:words, \ 'cur_keyword_pos' : l:cur_keyword_pos, \ 'cur_keyword_str' : l:cur_keyword_str, \} endif endif endfor "}}} return l:complete_result endfunction"}}} function! s:integrate_completion(complete_result, is_sort)"{{{ if empty(a:complete_result) if neocomplcache#get_cur_text() =~ '\s\+$' " Caching current cache line. call neocomplcache#sources#buffer_complete#caching_current_cache_line() endif return [-1, '', []] endif let l:cur_keyword_pos = col('.') for l:result in values(a:complete_result) if l:cur_keyword_pos > l:result.cur_keyword_pos let l:cur_keyword_pos = l:result.cur_keyword_pos endif endfor let l:cur_text = neocomplcache#get_cur_text() let l:cur_keyword_str = l:cur_text[l:cur_keyword_pos :] let l:frequencies = neocomplcache#sources#buffer_complete#get_frequencies() " Append prefix. let l:complete_words = [] for [l:complfunc_name, l:result] in items(a:complete_result) let l:result.complete_words = deepcopy(l:result.complete_words) if l:result.cur_keyword_pos > l:cur_keyword_pos let l:prefix = l:cur_keyword_str[: l:result.cur_keyword_pos - l:cur_keyword_pos - 1] for keyword in l:result.complete_words let keyword.word = l:prefix . keyword.word endfor endif let l:base_rank = neocomplcache#get_plugin_rank(l:complfunc_name) for l:keyword in l:result.complete_words let l:word = l:keyword.word if !has_key(l:keyword, 'rank') let l:keyword.rank = l:base_rank endif if has_key(l:frequencies, l:word) let l:keyword.rank = l:keyword.rank * l:frequencies[l:word] endif endfor let l:complete_words += s:remove_next_keyword(l:complfunc_name, l:result.complete_words) endfor " Sort. if !neocomplcache#is_eskk_enabled() && a:is_sort call sort(l:complete_words, 'neocomplcache#compare_rank') endif let l:complete_words = l:complete_words[: g:neocomplcache_max_list] let l:icase = g:neocomplcache_enable_ignore_case && \!(g:neocomplcache_enable_smart_case && l:cur_keyword_str =~ '\u') for l:keyword in l:complete_words let l:keyword.icase = l:icase if !has_key(l:keyword, 'abbr') let l:keyword.abbr = l:keyword.word endif endfor " Delimiter check. let l:filetype = neocomplcache#get_context_filetype() if has_key(g:neocomplcache_delimiter_patterns, l:filetype)"{{{ for l:delimiter in g:neocomplcache_delimiter_patterns[l:filetype] " Count match. let l:delim_cnt = 0 let l:matchend = matchend(l:cur_keyword_str, l:delimiter) while l:matchend >= 0 let l:matchend = matchend(l:cur_keyword_str, l:delimiter, l:matchend) let l:delim_cnt += 1 endwhile for l:keyword in l:complete_words let l:split_list = split(l:keyword.word, l:delimiter) if len(l:split_list) > 1 let l:delimiter_sub = substitute(l:delimiter, '\\\([.^$]\)', '\1', 'g') let l:keyword.word = join(l:split_list[ : l:delim_cnt], l:delimiter_sub) let l:keyword.abbr = join(split(l:keyword.abbr, l:delimiter)[ : l:delim_cnt], l:delimiter_sub) if len(l:keyword.abbr) > g:neocomplcache_max_keyword_width let l:keyword.abbr = substitute(l:keyword.abbr, '\(\h\)\w*'.l:delimiter, '\1'.l:delimiter_sub, 'g') endif if l:delim_cnt+1 < len(l:split_list) let l:keyword.abbr .= l:delimiter_sub . '~' let l:keyword.dup = 0 if g:neocomplcache_enable_auto_delimiter let l:keyword.word .= l:delimiter_sub endif endif endif endfor endfor endif"}}} " Convert words. if neocomplcache#is_text_mode()"{{{ if l:cur_keyword_str =~ '^\l\+$' for l:keyword in l:complete_words let l:keyword.word = tolower(l:keyword.word) let l:keyword.abbr = tolower(l:keyword.abbr) endfor elseif l:cur_keyword_str =~ '^\u\+$' for l:keyword in l:complete_words let l:keyword.word = toupper(l:keyword.word) let l:keyword.abbr = toupper(l:keyword.abbr) endfor elseif l:cur_keyword_str =~ '^\u\l\+$' for l:keyword in l:complete_words let l:keyword.word = toupper(l:keyword.word[0]).tolower(l:keyword.word[1:]) let l:keyword.abbr = toupper(l:keyword.abbr[0]).tolower(l:keyword.abbr[1:]) endfor endif endif"}}} " Abbr check. let l:abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-15) for l:keyword in l:complete_words if len(l:keyword.abbr) > g:neocomplcache_max_keyword_width if l:keyword.abbr =~ '[^[:print:]]' " Multibyte string. let l:len = neocomplcache#util#wcswidth(l:keyword.abbr) if l:len > g:neocomplcache_max_keyword_width let l:keyword.abbr = neocomplcache#util#truncate(l:keyword.abbr, g:neocomplcache_max_keyword_width - 2) . '..' endif else let l:keyword.abbr = printf(l:abbr_pattern, l:keyword.abbr, l:keyword.abbr[-13:]) endif endif endfor return [l:cur_keyword_pos, l:cur_keyword_str, l:complete_words] endfunction"}}} function! s:on_insert_enter()"{{{ if &updatetime > g:neocomplcache_cursor_hold_i_time \&& g:neocomplcache_enable_cursor_hold_i let s:update_time_save = &updatetime let &updatetime = g:neocomplcache_cursor_hold_i_time endif endfunction"}}} function! s:on_insert_leave()"{{{ let s:cur_keyword_pos = -1 let s:cur_keyword_str = '' let s:complete_words = [] let s:old_complete_words = [] let s:prev_numbered_dict = {} let s:used_match_filter = 0 let s:context_filetype = '' let s:is_text_mode = 0 let s:skip_next_complete = 0 if &updatetime < s:update_time_save \&& g:neocomplcache_enable_cursor_hold_i let &updatetime = s:update_time_save endif endfunction"}}} function! s:remove_next_keyword(plugin_name, list)"{{{ let l:list = a:list " Remove next keyword."{{{ if a:plugin_name == 'filename_complete' let l:pattern = '^\%(' . neocomplcache#get_next_keyword_pattern('filename') . '\m\)' else let l:pattern = '^\%(' . neocomplcache#get_next_keyword_pattern() . '\m\)' endif let l:next_keyword_str = matchstr('a'.getline('.')[col('.') - 1 :], l:pattern)[1:] if l:next_keyword_str != '' let l:next_keyword_str = substitute(escape(l:next_keyword_str, '~" \.^$*[]'), "'", "''", 'g').'$' " No ignorecase. let l:ignorecase_save = &ignorecase let &ignorecase = 0 for r in l:list if r.word =~ l:next_keyword_str let r.word = r.word[: match(r.word, l:next_keyword_str)-1] endif endfor let &ignorecase = l:ignorecase_save endif"}}} return l:list endfunction"}}} "}}} " Internal helper functions."{{{ function! s:make_quick_match_list(list, cur_keyword_str)"{{{ let l:keys = {} for [l:key, l:number] in items(g:neocomplcache_quick_match_table) let l:keys[l:number] = l:key endfor " Save options. let l:ignorecase_save = &ignorecase if neocomplcache#is_text_mode() let &ignorecase = 1 elseif g:neocomplcache_enable_smart_case && a:cur_keyword_str =~ '\u' let &ignorecase = 0 else let &ignorecase = g:neocomplcache_enable_ignore_case endif " Check dup. let l:dup_check = {} let l:num = 0 let l:qlist = {} for keyword in neocomplcache#keyword_filter(a:list, a:cur_keyword_str) if keyword.word != '' && has_key(l:keys, l:num) \&& (!has_key(l:dup_check, keyword.word) || (has_key(keyword, 'dup') && keyword.dup)) let l:dup_check[keyword.word] = 1 let l:keyword = deepcopy(l:keyword) let keyword.abbr = printf('%s: %s', l:keys[l:num], keyword.abbr) let l:qlist[l:num] = keyword endif let l:num += 1 endfor let &ignorecase = l:ignorecase_save " Save numbered dicts. let s:prev_numbered_dict = l:qlist return values(l:qlist) endfunction"}}} function! s:select_quick_match_list(key)"{{{ if !has_key(g:neocomplcache_quick_match_table, a:key) return [] endif return has_key(s:prev_numbered_dict, g:neocomplcache_quick_match_table[a:key]) ? \ [ s:prev_numbered_dict[g:neocomplcache_quick_match_table[a:key]] ] : [] endfunction"}}} function! s:get_quick_match_pattern()"{{{ let l:filetype = neocomplcache#get_context_filetype() let l:pattern = has_key(g:neocomplcache_quick_match_patterns, l:filetype)? \ g:neocomplcache_quick_match_patterns[l:filetype] : g:neocomplcache_quick_match_patterns['default'] return l:pattern endfunction"}}} function! s:get_cur_text()"{{{ "let s:cur_text = col('.') < l:pos ? '' : matchstr(getline('.'), '.*')[: col('.') - l:pos] let s:cur_text = matchstr(getline('.'), '^.*\%' . col('.') . 'c' . (mode() ==# 'i' ? '' : '.')) " Save cur_text. return s:cur_text endfunction"}}} function! s:set_context_filetype()"{{{ let l:filetype = &filetype if l:filetype == '' let l:filetype = 'nothing' endif " Default. let s:context_filetype = l:filetype if neocomplcache#is_eskk_enabled() let s:context_filetype = 'eskk' let l:filetype = 'eskk' elseif has_key(g:neocomplcache_filetype_include_lists, l:filetype) \ && !empty(g:neocomplcache_filetype_include_lists[l:filetype]) let l:pos = [line('.'), col('.')] for l:include in g:neocomplcache_filetype_include_lists[l:filetype] let l:start_backward = searchpos(l:include.start, 'bnW') " Check start <= line <= end. if l:start_backward[0] == 0 || s:compare_pos(l:start_backward, l:pos) > 0 continue endif let l:end_pattern = l:include.end if l:end_pattern =~ '\\1' let l:match_list = matchlist(getline(l:start_backward[0]), l:include.start) let l:end_pattern = substitute(l:end_pattern, '\\1', '\=l:match_list[1]', 'g') endif let l:end_forward = searchpos(l:end_pattern, 'nW') if l:end_forward[0] == 0 || s:compare_pos(l:pos, l:end_forward) < 0 let l:end_backward = searchpos(l:end_pattern, 'bnW') if l:end_backward[0] == 0 || s:compare_pos(l:start_backward, l:end_backward) > 0 let s:context_filetype = l:include.filetype let l:filetype = l:include.filetype break endif endif endfor endif " Set text mode or not. let l:syn_name = neocomplcache#get_syn_name(1) let s:is_text_mode = (has_key(g:neocomplcache_text_mode_filetypes, s:context_filetype) && g:neocomplcache_text_mode_filetypes[s:context_filetype]) \ || l:syn_name ==# 'Constant' let s:within_comment = (l:syn_name ==# 'Comment') " Set filetype plugins. let s:loaded_ftplugin_sources = {} for [l:source_name, l:source] in items(neocomplcache#available_ftplugins()) if has_key(l:source.filetypes, l:filetype) let s:loaded_ftplugin_sources[l:source_name] = l:source if !l:source.loaded " Initialize. call l:source.initialize() let l:source.loaded = 1 endif endif endfor endfunction"}}} function! s:match_wildcard(cur_text, pattern, cur_keyword_pos)"{{{ let l:cur_keyword_pos = a:cur_keyword_pos if neocomplcache#is_eskk_enabled() || !g:neocomplcache_enable_wildcard return l:cur_keyword_pos endif while l:cur_keyword_pos > 1 && a:cur_text[l:cur_keyword_pos - 1] == '*' let l:left_text = a:cur_text[: l:cur_keyword_pos - 2] if l:left_text == '' || l:left_text !~ a:pattern break endif let l:cur_keyword_pos = match(l:left_text, a:pattern) endwhile return l:cur_keyword_pos endfunction"}}} "}}} " vim: foldmethod=marker 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/vim_complete/autocmds.dict [[[1 82 BufNewFile ; starting to edit a file that doesn't exist BufReadPre ; starting to edit a new buffer, before reading the file BufRead ; starting to edit a new buffer, after reading the file BufReadPost ; starting to edit a new buffer, after reading the file BufReadCmd ; before starting to edit a new buffer |Cmd-event| FileReadPre ; before reading a file with a ":read" command FileReadPost ; after reading a file with a ":read" command FileReadCmd ; before reading a file with a ":read" command |Cmd-event| FilterReadPre ; before reading a file from a filter command FilterReadPost ; after reading a file from a filter command StdinReadPre ; before reading from stdin into the buffer StdinReadPost ; After reading from the stdin into the buffer BufWrite ; starting to write the whole buffer to a file BufWritePre ; starting to write the whole buffer to a file BufWritePost ; after writing the whole buffer to a file BufWriteCmd ; before writing the whole buffer to a file |Cmd-event| FileWritePre ; starting to write part of a buffer to a file FileWritePost ; after writing part of a buffer to a file FileWriteCmd ; starting to append to a file FileAppendPre ; after appending to a file FileAppendPost ; before appending to a file |Cmd-event| FileAppendCmd ; starting to write a file for a filter command or diff FilterWritePre ; after writing a file for a filter command or diff FilterWritePost ; just after adding a buffer to the buffer list BufAdd ; just after adding a buffer to the buffer list BufCreate ; just after adding a buffer to the buffer list BufDelete ; before deleting a buffer from the buffer list BufWipeout ; before completely deleting a buffer BufFilePre ; before changing the name of the current buffer BufFilePost ; after changing the name of the current buffer BufEnter ; after entering a buffer BufLeave ; before leaving to another buffer BufWinEnter ; after a buffer is displayed in a window BufWinLeave ; before a buffer is removed from a window BufUnload ; before unloading a buffer BufHidden ; just after a buffer has become hidden BufNew ; just after creating a new buffer SwapExists ; detected an existing swap file FileType ; when the 'filetype' option has been set Syntax ; when the 'syntax' option has been set EncodingChanged ; after the 'encoding' option has been changed TermChanged ; after the value of 'term' has changed VimEnter ; after doing all the startup stuff GUIEnter ; after starting the GUI successfully TermResponse ; after the terminal response to |t_RV| is received VimLeavePre ; before exiting Vim, before writing the viminfo file VimLeave ; before exiting Vim, after writing the viminfo file FileChangedShell ; Vim notices that a file changed since editing started FileChangedShellPost ; After handling a file changed since editing started FileChangedRO ; before making the first change to a read-only file ShellCmdPost ; after executing a shell command ShellFilterPost ; after filtering with a shell command FuncUndefined ; a user function is used but it isn't defined SpellFileMissing ; a spell file is used but it can't be found SourcePre ; before sourcing a Vim script SourceCmd ; before sourcing a Vim script |Cmd-event| VimResized ; after the Vim window size changed FocusGained ; Vim got input focus FocusLost ; Vim lost input focus CursorHold ; the user doesn't press a key for a while CursorHoldI ; the user doesn't press a key for a while in Insert mode CursorMoved ; the cursor was moved in Normal mode CursorMovedI ; the cursor was moved in Insert mode WinEnter ; after entering another window WinLeave ; before leaving a window TabEnter ; after entering another tab page TabLeave ; before leaving a tab page CmdwinEnter ; after entering the command-line window CmdwinLeave ; before leaving the command-line window InsertEnter ; starting Insert mode InsertChange ; when typing while in Insert or Replace mode InsertLeave ; when leaving Insert mode ColorScheme ; after loading a color scheme RemoteReply ; a reply from a server Vim was received QuickFixCmdPre ; before a quickfix command is run QuickFixCmdPost ; after a quickfix command is run SessionLoadPost ; after loading a session file MenuPopup ; just before showing the popup menu User ; to be used in combination with ":doautocmd" ; buffer-local autocommands ; for the file name that is being ; for the buffer name that is being autoload/neocomplcache/cache.vim [[[1 403 "============================================================================= " FILE: cache.vim " AUTHOR: Shougo Matsushita " Last Modified: 01 Sep 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 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. " }}} "============================================================================= " Cache loader. function! neocomplcache#cache#load_from_cache(cache_dir, filename)"{{{ if neocomplcache#cache#check_old_cache(a:cache_dir, a:filename) return [] endif let l:keyword_lists = [] let l:lines = readfile(neocomplcache#cache#encode_name(a:cache_dir, a:filename)) let l:max_lines = len(l:lines) if empty(l:lines) return [] endif if l:max_lines > 3000 call neocomplcache#print_caching('Caching from cache "' . a:filename . '"... please wait.') endif if l:max_lines > 10000 let l:print_cache_percent = l:max_lines / 5 elseif l:max_lines > 5000 let l:print_cache_percent = l:max_lines / 4 elseif l:max_lines > 3000 let l:print_cache_percent = l:max_lines / 3 else let l:print_cache_percent = -1 endif let l:line_cnt = l:print_cache_percent try let l:line_num = 1 for l:line in l:lines"{{{ " Percentage check."{{{ if l:print_cache_percent > 0 if l:line_cnt == 0 call neocomplcache#print_caching(printf('Caching(%s): %d%%', a:filename, l:line_num*100 / l:max_lines)) let l:line_cnt = l:print_cache_percent endif let l:line_cnt -= 1 let l:line_num += 1 endif "}}} let l:cache = split(l:line, '|||', 1) let l:keyword = { \ 'word' : l:cache[0], 'abbr' : l:cache[1], 'menu' : l:cache[2], \} if l:cache[3] != '' let l:keyword.kind = l:cache[3] endif if l:cache[4] != '' let l:keyword.class = l:cache[4] endif call add(l:keyword_lists, l:keyword) endfor"}}} catch /E684:/ call neocomplcache#print_error(v:exception) call neocomplcache#print_error('Error occured while analyzing cache!') let l:cache_dir = g:neocomplcache_temporary_dir . '/' . a:cache_dir call neocomplcache#print_error('Please delete cache directory: ' . l:cache_dir) return [] endtry if l:max_lines > 3000 call neocomplcache#print_caching('') endif return l:keyword_lists 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#load_from_file(filename, pattern, mark)"{{{ if bufloaded(a:filename) let l:lines = getbufline(bufnr(a:filename), 1, '$') elseif filereadable(a:filename) let l:lines = readfile(a:filename) else " File not found. return [] endif let l:max_lines = len(l:lines) let l:menu = printf('[%s] %.' . g:neocomplcache_max_filename_width . 's', a:mark, fnamemodify(a:filename, ':t')) if l:max_lines > 1000 call neocomplcache#print_caching('Caching from file "' . a:filename . '"... please wait.') endif if l:max_lines > 10000 let l:print_cache_percent = l:max_lines / 9 elseif l:max_lines > 7000 let l:print_cache_percent = l:max_lines / 6 elseif l:max_lines > 5000 let l:print_cache_percent = l:max_lines / 5 elseif l:max_lines > 3000 let l:print_cache_percent = l:max_lines / 4 elseif l:max_lines > 2000 let l:print_cache_percent = l:max_lines / 3 elseif l:max_lines > 1000 let l:print_cache_percent = l:max_lines / 2 else return s:load_from_file_fast(l:lines, a:pattern, l:menu) endif let l:line_cnt = l:print_cache_percent let l:line_num = 1 let l:keyword_lists = [] let l:dup_check = {} let l:keyword_pattern2 = '^\%('.a:pattern.'\m\)' for l:line in l:lines"{{{ " Percentage check."{{{ if l:print_cache_percent > 0 if l:line_cnt == 0 call neocomplcache#print_caching(printf('Caching(%s): %d%%', a:filename, l:line_num*100 / l:max_lines)) let l:line_cnt = l:print_cache_percent endif let l:line_cnt -= 1 let l:line_num += 1 endif "}}} let l:match = match(l:line, a:pattern) while l:match >= 0"{{{ let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match) " Ignore too short keyword. if !has_key(l:dup_check, l:match_str) && len(l:match_str) >= g:neocomplcache_min_keyword_length " Append list. call add(l:keyword_lists, { 'word' : l:match_str, 'menu' : l:menu }) let l:dup_check[l:match_str] = 1 endif let l:match = match(l:line, a:pattern, l:match + len(l:match_str)) endwhile"}}} endfor"}}} if l:max_lines > 1000 call neocomplcache#print_caching('') endif return l:keyword_lists endfunction"}}} function! s:load_from_file_fast(lines, pattern, menu)"{{{ let l:line_num = 1 let l:keyword_lists = [] let l:dup_check = {} let l:keyword_pattern2 = '^\%('.a:pattern.'\m\)' let l:line = join(a:lines) let l:match = match(l:line, a:pattern) while l:match >= 0"{{{ let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match) " Ignore too short keyword. if !has_key(l:dup_check, l:match_str) && len(l:match_str) >= g:neocomplcache_min_keyword_length " Append list. call add(l:keyword_lists, { 'word' : l:match_str, 'menu' : a:menu }) let l:dup_check[l:match_str] = 1 endif let l:match = match(l:line, a:pattern, l:match + len(l:match_str)) endwhile"}}} return l:keyword_lists endfunction"}}} function! neocomplcache#cache#load_from_tags(cache_dir, filename, tags_list, mark, filetype)"{{{ let l:max_lines = len(a:tags_list) if l:max_lines > 1000 call neocomplcache#print_caching('Caching from tags "' . a:filename . '"... please wait.') endif if l:max_lines > 10000 let l:print_cache_percent = l:max_lines / 9 elseif l:max_lines > 7000 let l:print_cache_percent = l:max_lines / 6 elseif l:max_lines > 5000 let l:print_cache_percent = l:max_lines / 5 elseif l:max_lines > 3000 let l:print_cache_percent = l:max_lines / 4 elseif l:max_lines > 2000 let l:print_cache_percent = l:max_lines / 3 elseif l:max_lines > 1000 let l:print_cache_percent = l:max_lines / 2 else let l:print_cache_percent = -1 endif let l:line_cnt = l:print_cache_percent let l:menu_pattern = printf('[%s] %%.%ds %%.%ds', a:mark, g:neocomplcache_max_filename_width, g:neocomplcache_max_filename_width) let l:keyword_lists = [] let l:dup_check = {} let l:line_num = 1 try for l:line in a:tags_list"{{{ " Percentage check."{{{ if l:line_cnt == 0 call neocomplcache#print_caching(printf('Caching(%s): %d%%', a:filename, l:line_num*100 / l:max_lines)) let l:line_cnt = l:print_cache_percent endif let l:line_cnt -= 1"}}} let l:tag = split(substitute(l:line, "\", '', 'g'), '\t', 1) " Add keywords. if l:line !~ '^!' && len(l:tag) >= 3 && len(l:tag[0]) >= g:neocomplcache_min_keyword_length \&& !has_key(l:dup_check, l:tag[0]) let l:option = { \ 'cmd' : substitute(substitute(l:tag[2], '^\%([/?]\^\)\?\s*\|\%(\$\?[/?]\)\?;"$', '', 'g'), '\\\\', '\\', 'g'), \ 'kind' : '' \} if l:option.cmd =~ '\d\+' let l:option.cmd = l:tag[0] endif for l:opt in l:tag[3:] 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: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, fnamemodify(l:tag[1], ':t'), l:option.struct) let keyword.class = l:option.struct elseif has_key(l:option, 'class') let keyword.menu = printf(l:menu_pattern, fnamemodify(l:tag[1], ':t'), l:option.class) let keyword.class = l:option.class elseif has_key(l:option, 'enum') let keyword.menu = printf(l:menu_pattern, fnamemodify(l:tag[1], ':t'), l:option.enum) let keyword.class = l:option.enum elseif has_key(l:option, 'union') let keyword.menu = printf(l:menu_pattern, fnamemodify(l:tag[1], ':t'), l:option.union) let keyword.class = l:option.union else let keyword.menu = printf(l:menu_pattern, fnamemodify(l:tag[1], ':t'), '') let keyword.class = '' endif call add(l:keyword_lists, l:keyword) let l:dup_check[l:tag[0]] = 1 endif let l:line_num += 1 endfor"}}} catch /E684:/ call neocomplcache#print_warning('Error occured while analyzing tags!') call neocomplcache#print_warning(v:exception) let l:log_file = g:neocomplcache_temporary_dir . '/' . a:cache_dir . '/error_log' call neocomplcache#print_warning('Please look tags file: ' . l:log_file) call writefile(a:tags_list, l:log_file) return [] endtry if l:max_lines > 1000 call neocomplcache#print_caching('') endif if a:filetype != '' && has_key(g:neocomplcache_tags_filter_patterns, a:filetype) call filter(l:keyword_lists, g:neocomplcache_tags_filter_patterns[a:filetype]) endif return l:keyword_lists endfunction"}}} function! neocomplcache#cache#save_cache(cache_dir, filename, keyword_list)"{{{ " Create cache directory. call neocomplcache#cache#check_dir(a:cache_dir) 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, 'kind') let keyword.kind = '' endif if !has_key(keyword, 'class') let keyword.class = '' endif if !has_key(keyword, 'abbr') let keyword.abbr = keyword.word endif endfor " Output cache. let l:word_list = [] for keyword in a:keyword_list call add(l:word_list, printf('%s|||%s|||%s|||%s|||%s', \keyword.word, keyword.abbr, keyword.menu, keyword.kind, keyword.class)) 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)"{{{ call neocomplcache#cache#check_dir(a:cache_dir) 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) 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_dir(cache_dir)"{{{ " 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 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) return getftime(l:cache_name) == -1 || getftime(l:cache_name) <= getftime(a:filename) endfunction"}}} " Check md5. let s:is_md5 = exists('*md5#md5') 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:is_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]) * 2 endfor let l:hash = printf('%x', l:sum) endif return l:hash endfunction " vim: foldmethod=marker 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/vim_complete/command_args.dict [[[1 33 -nargs=0 ; no arguments are allowed (the default) -nargs=1 ; exactly one argument is required -nargs=* ; any number of arguments are allowed (0, 1, or many) -nargs=? ; 0 or 1 arguments are allowed -nargs=+ ; arguments must be supplied, but any number are allowed -complete=augroup ; autocmd groups -complete=buffer ; buffer names -complete=command ; Ex command (and arguments) -complete=dir ; directory names -complete=environment ; environment variable names -complete=event ; autocommand events -complete=expression ; Vim expression -complete=file ; file and directory names -complete=shellcmd ; Shell command -complete=function ; function name -complete=help ; help subjects -complete=highlight ; highlight groups -complete=mapping ; mapping name -complete=menu ; menus -complete=option ; options -complete=tag ; tags -complete=tag_list ; tags, file names are shown when CTRL-D is hit -complete=var ; user variables -complete=custom ; custom completion, defined via {func} -complete=customlist ; custom completion, defined via {func} -count= ; a count (default N) in the line or as an initial argument -range ; range allowed, default is current line -range= ; a count (default N) which is specified in the line -range=% ; range allowed, default is whole file (1,$) -bang ; the command can take a ! modifier (like :q or :w) -bar ; the command can be followed by a "|" and another command -register ; the first argument to the command can be an optional register name -buffer ; the command will only be available in the current buffer autoload/neocomplcache/sources/abbrev_complete.vim [[[1 65 "============================================================================= " 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: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"}}} " vim: foldmethod=marker autoload/neocomplcache/sources/snippets_complete/javascript.snip [[[1 47 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:i} < ${1:Things}.length; ${2:i}++) { ${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/vim_complete/command_completions.dict [[[1 498 N[ext] P[rint] a[ppend] ab[breviate] abbreviation abc[lear] abo[veleft] command al[l] am[enu] an[oremenu] menu ar[gs] file arga[dd] file argd[elete] file argdo command arge[dit] file argg[lobal] file argl[ocal] file argu[ment] as[cii] au[tocmd] autocmd_args aug[roup] augroup aun[menu] menu bN[ext] b[uffer] buffer ba[ll] bad[d] file bd[elete] buffer be[have] bel[owright] command bf[irst] bl[ast] bm[odified] bn[ext] bo[tright] command bp[revious] br[ewind] brea[k] breaka[dd] function breakd[el] breakl[ist] bro[wse] command bufdo command buffers bun[load] buffer bw[ipeout] buffer cN[ext] cNf[ile] c[hange] ca[bbrev] abbreviation cabc[lear] cad[dexpr] expression caddb[uffer] caddf[ile] file cal[l] function cat[ch] cb[uffer] cc ccl[ose] cd dir ce[nter] cex[pr] expression cf[ile] file cfir[st] cg[etfile] file cgetb[uffer] cgete[xpr] expression changes chd[ir] dir che[ckpath] checkt[ime] cl[ist] cla[st] clo[se] cm[ap] mapping cmapc[lear] cme[nu] menu cn[ext] cnew[er] cnf[ile] cno[remap] mapping cnorea[bbrev] abbreviation cnoreme[nu] menu co[py] col[der] colo[rscheme] colorscheme_args com[mand] command_args comc[lear] comp[iler] compiler_args con[tinue] conf[irm] command cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cscope_args cst[ag] cu[nmap] mapping cuna[bbrev] abbreviation cunme[nu] menu cw[indow] d[elete] deb[ug] command debugg[reedy] del[command] command delf[unction] function delm[arks] di[splay] diffg[et] diffo[ff] diffp[atch] file diffpu[t] diffs[plit] file diffthis diffu[pdate] dig[raphs] dj[ump] dl[ist] do[autocmd] autocmd_args doautoa[ll] autocmd_args dr[op] file ds[earch] dsp[lit] e[dit] file ea[rlier] ec[ho] expression echoe[rr] expression echoh[l] expression echom[sg] expression echon expression el[se] elsei[f] expression em[enu] menu en[dif] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] ex file exe[cute] expression exi[t] file exu[sage] f[ile] files filet[ype] fin[d] file fina[lly] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] foldd[oopen] command folddoc[losed] command foldo[pen] for expression fu[nction] function_args go[to] gr[ep] file grepa[dd] file gu[i] file gv[im] file h[elp] help ha[rdcopy] helpf[ind] helpg[rep] helpt[ags] dir hi[ghlight] highlight hid[e] command his[tory] i[nsert] ia[bbrev] abbreviation iabc[lear] if expression ij[ump] il[ist] im[ap] mapping imapc[lear] imenu menu ino[remap] mapping inorea[bbrev] mapping inoreme[nu] menu int[ro] is[earch] isp[lit] iu[nmap] mapping iuna[bbrev] abbreviation iunme[nu] menu j[oin] ju[mps] kee[pmarks] command keep[jumps] command keepa[lt] command lN[ext] lNf[ile] l[ist] la[st] lad[dexpr] expr laddb[uffer] laddf[ile] file lan[guage] language_args lat[er] lb[uffer] lc[d] dir lch[dir] dir lcl[ose] lcs[cope] cscope_args le[ft] lefta[bove] command let let lex[pr] expression lf[ile] file lfir[st] lg[etfile] file lgetb[uffer] lgete[xpr] expression lgr[ep] file lgrepa[dd] file lh[elpgrep] ll lla[st] lli[st] lm[ap] mapping lmak[e] file lmapc[lear] ln[oremap] mapping lne[xt] lnew[er] lnf[ile] lo[adview] loadk[eymap] loc[kmarks] command lockv[ar] var lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] ls lt[ag] lu[nmap] mapping lua luado luafile file lv[imgrep] file lvimgrepadd file lwindow m[ove] ma[rk] mak[e] file map mapping mapc[lear] marks match menu menu menut[ranslate] menutranslate_args mes[sages] mk[exrc] file mks[ession] file mksp[ell] file mkv[imrc] file mkvie[w] file mod[e] mz[scheme] file mzf[ile] file n[ext] nb[key] new nm[ap] mapping nmapc[lear] nmenu menu nno[remap] mapping nnoreme[nu] menu no[remap] mapping noa[utocmd] command noh[lsearch] norea[bbrev] abbreviation noreme[nu] menu norm[al] nu[mber] nun[map] mapping nunme[nu] menu o[pen] ol[dfiles] om[ap] mapping omapc[lear] ome[nu] menu on[ly] ono[remap] mapping onoreme[nu] menu opt[ions] ou[nmap] lhs ounmenu menu ownsyntax syntax_args p[rint] pc[lose] pe[rl] ped[it] file perld[o] po[p] popu[p] pp[op] pre[serve] prev[ious] prof[ile] profile_args profd[el] promptf[ind] promptr[epl] ps[earch] ptN[ext] pta[g] tag ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] tag pu[t] pw[d] py3f[ile] file py[thon] pyf[ile] file python3 q[uit] qa[ll] quita[ll] r[ead] rec[over] file red[o] redi[r] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] expression rew[ind] ri[ght] rightb[elow] command rub[y] rubyd[o] rubyf[ile] file runtime file rv[iminfo] file sN[ext] s[ubstitute] sa[rgument] sal[l] san[dbox] command sav[eas] file sbN[ext] sb[uffer] buffer sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] scrip[tnames] scripte[ncoding] encoding scscope cscope_args se[t] option setf[iletype] filetype setg[lobal] option setl[ocal] option sf[ind] file sfir[st] sh[ell] sig[n] sign_args sil[ent] command sim[alt] sl[eep] sla[st] sm[agic] sm[ap] mapping smapc[lear] sme[nu] menu sn[ext] file sni[ff] sno[remap] mapping snoreme[nu] menu so[urce] file sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellu[ndo] spellw[rong] spr[evious] sre[wind] st[op] sta[g] tag star[tinsert] startg[replace] startr[eplace] stj[ump] tag stopi[nsert] sts[elect] tag sun[hide] sunm[ap] mapping sunme[nu] menu sus[pend] sv[iew] file sw[apname] sy[ntax] syntax_args sync[bind] t tN[ext] ta[g] tag tab command tabN[ext] tabc[lose] tabd[o] command tabe[dit] file tabf[ind] file tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew file tabo[nly] tabp[revious] tabr[ewind] tabs tags tc[l] tcld[o] tclf[ile] file te[aroff] menu tf[irst] th[row] expression tj[ump] tag tl[ast] tm[enu] menu tn[ext] to[pleft] command tp[revious] tr[ewind] try tselect tu[nmenu] menu u[ndo] una[bbreviate] abbreviation undoj[oin] undol[ist] unh[ide] unl[et] var unlo[ckvar] var unm[ap] mapping unme[nu] menu uns[ilent] command up[date] file ve[rsion] verb[ose] command vert[ical] command vg[lobal] vi[sual] file vie[w] file vim[grep] file vimgrepa[dd] file viu[sage] vm[ap] mapping vmapc[lear] vmenu menu vn[oremap] mapping vne[w] file vnoremenu menu vsp[lit] file vu[nmap] mapping vunmenu menu wN[ext] file w[rite] file wa[ll] wh[ile] expression win[size] winc[md] windo command winp[os] wn[ext] wp[revious] file wq wqa[ll] ws[verb] wv[iminfo] file x[it] file xa[ll] xm[ap] mapping xmapc[lear] xmenu menu xn[oremap] mapping xnoremenu menu xu[nmap] mapping xunmenu menu y[ank] autoload/neocomplcache/sources/buffer_complete.vim [[[1 691 "============================================================================= " FILE: buffer_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 23 Oct 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. " }}} "============================================================================= " 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 FileType,BufWritePost * call s:check_source() autocmd CursorHold * call s:rank_caching_current_cache_line(1) 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() "}}} " Initialize cache. call s:check_source() 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 return l:keyword_list endif let l:keyword_list = [] let l:current = bufnr('%') if len(a:cur_keyword_str) < s:completion_length || \neocomplcache#check_match_filter(a:cur_keyword_str, s:completion_length) for src in s:get_sources_list() let l:keyword_cache = neocomplcache#keyword_filter( \neocomplcache#unpack_dictionary_dictionary(s:buffer_sources[src].keyword_cache), a:cur_keyword_str) if src == l:current call s:calc_frequency(l:keyword_cache) endif let l:keyword_list += l:keyword_cache endfor else let l:key = tolower(a:cur_keyword_str[: s:completion_length-1]) for src in s:get_sources_list() if has_key(s:buffer_sources[src].keyword_cache, l:key) let l:keyword_cache = neocomplcache#keyword_filter(values(s:buffer_sources[src].keyword_cache[l:key]), a:cur_keyword_str) if src == l:current call s:calc_frequency(l:keyword_cache) endif let l:keyword_list += l:keyword_cache endif 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 = printf('[B] %.' . g:neocomplcache_max_filename_width . 's', l:filename) 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 = neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype()) for key in keys(s:buffer_sources) if has_key(l:filetypes, s:buffer_sources[key].filetype) || 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 = printf('[B] %.' . g:neocomplcache_max_filename_width . 's', l:filename) 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:filename = fnamemodify(bufname(a:srcname), ':t') " 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')) \} endfunction"}}} function! s:word_caching(srcname)"{{{ " Initialize source. call s:initialize_source(a:srcname) if s:caching_from_cache(a:srcname) == 0 " Caching from cache. return endif let l:bufname = bufname(str2nr(a:srcname)) if fnamemodify(l:bufname, ':t') ==# '[Command Line]' " Ignore caching. return endif let l:keyword_cache = s:buffer_sources[a:srcname].keyword_cache for l:keyword in neocomplcache#cache#load_from_file(bufname(str2nr(a:srcname)), s:buffer_sources[a:srcname].keyword_pattern, 'B') let l:key = tolower(l:keyword.word[: s:completion_length-1]) if !has_key(l:keyword_cache, l:key) let l:keyword_cache[l:key] = {} endif let l:keyword_cache[l:key][l:keyword.word] = l:keyword endfor endfunction"}}} function! s:caching_from_cache(srcname)"{{{ if getbufvar(a:srcname, '&buftype') =~ 'nofile' return -1 endif let l:srcname = fnamemodify(bufname(str2nr(a:srcname)), ':p') if neocomplcache#cache#check_old_cache('buffer_cache', l:srcname) return -1 endif let l:source = s:buffer_sources[a:srcname] for l:keyword in neocomplcache#cache#load_from_cache('buffer_cache', l:srcname) let l:key = tolower(l:keyword.word[: s:completion_length-1]) if !has_key(l:source.keyword_cache, l:key) let l:source.keyword_cache[l:key] = {} endif let l:source.keyword_cache[l:key][l:keyword.word] = l:keyword endfor return 0 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 return s:buffer_sources[a:bufnumber].name != fnamemodify(bufname(a:bufnumber), ':t') \ || s:buffer_sources[a:bufnumber].filetype != l:ft endfunction"}}} function! s:check_source()"{{{ call s:check_deleted_buffer() let l:bufnumber = 1 " Check new buffer. while l:bufnumber <= bufnr('$') if bufwinnr(l:bufnumber) >= 0 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) \&& (g:neocomplcache_disable_caching_buffer_name_pattern == '' || l:bufname !~ g:neocomplcache_disable_caching_buffer_name_pattern) \&& !neocomplcache#is_locked(l:bufnumber) let l:buftype = getbufvar(l:bufnumber, '&buftype') if (g:neocomplcache_force_caching_buffer_name_pattern != '' && l:bufname =~ g:neocomplcache_force_caching_buffer_name_pattern) \ || (getfsize(l:bufname) < g:neocomplcache_caching_limit_file_size \ && (l:buftype == '' \ || (getbufvar(l:bufnumber, '&modifiable') && !getbufvar(l:bufnumber, '&readonly') && l:buftype !~ 'help'))) " Caching. call s:word_caching(l:bufnumber) endif endif endif let l:bufnumber += 1 endwhile 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) return endif let l:cache_name = neocomplcache#cache#encode_name('buffer_cache', l:srcname) if getftime(l:cache_name) >= getftime(l:srcname) return -1 endif " Output buffer. call neocomplcache#cache#save_cache('buffer_cache', l:srcname, neocomplcache#unpack_dictionary_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_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"}}} "}}} " vim: foldmethod=marker 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/vim_complete/command_prototypes.dict [[[1 498 N[ext] [count] [++opt] [+cmd] P[rint] [count] [flags] a[ppend] ab[breviate] abc[lear] abo[veleft] {cmd} al[l] [N] am[enu] an[oremenu] {menu} ar[gs] arga[dd] {name} .. argd[elete] {pattern} .. argdo {cmd} arge[dit] [++opt] [+cmd] {name} argg[lobal] [++opt] [+cmd] {arglist} argl[ocal] [++opt] [+cmd] {arglist} argu[ment] [count] [++opt] [+cmd] as[cii] au[tocmd] [group] {event} {pat} [nested] {cmd} aug[roup] {name} aun[menu] {menu} bN[ext] [N] b[uffer] {bufname} ba[ll] [N] bad[d] [+lnum] {fname} bd[elete] {bufname} be[have] {model} bel[owright] {cmd} bf[irst] bl[ast] bm[odified] [N] bn[ext] [N] bo[tright] {cmd} bp[revious] [N] br[ewind] brea[k] breaka[dd] func [lnum] {name} breakd[el] {nr} breakl[ist] bro[wse] {command} bufdo {cmd} buffers bun[load] {bufname} bw[ipeout] {bufname} cN[ext] cNf[ile] c[hange] ca[bbrev] [] [lhs] [rhs] cabc[lear] cad[dexpr] {expr} caddb[uffer] [bufnr] caddf[ile] [errorfile] cal[l] {name}([arguments]) cat[ch] /{pattern}/ cb[uffer] [bufnr] cc [nr] ccl[ose] cd {path} ce[nter] [width] cex[pr] {expr} cf[ile] [errorfile] cfir[st] [nr] cg[etfile] [errorfile] cgetb[uffer] [bufnr] cgete[xpr] {expr} changes chd[ir] [path] che[ckpath] checkt[ime] cl[ist] [from] [, [to]] cla[st] [nr] clo[se] cm[ap] {lhs} {rhs} cmapc[lear] cme[nu] {menu} cn[ext] cnew[er] [count] cnf[ile] cno[remap] {lhs} {rhs} cnorea[bbrev] [] [lhs] [rhs] cnoreme[nu] {menu} co[py] {address} col[der] [count] colo[rscheme] {name} com[mand] [{attr}...] {cmd} {rep} comc[lear] comp[iler] {name} con[tinue] conf[irm] {command} cope[n] [height] cp[revious] cpf[ile] cq[uit] cr[ewind] [nr] cs[cope] add {file|dir} [pre-path] [flags] | find {querytype} {name} | kill {num|partial_name} | help | reset | show cst[ag] cu[nmap] {lhs} cuna[bbrev] {lhs} cunme[nu] {menu} cw[indow] [height] d[elete] [x] deb[ug] {cmd} debugg[reedy] del[command] {cmd} delf[unction] {name} delm[arks] {marks} di[splay] [arg] diffg[et] [bufspec] diffo[ff] diffp[atch] {patchfile} diffpu[t] [bufspec] diffs[plit] {filename} diffthis diffu[pdate] dig[raphs] {char1}{char2} {number} ... dj[ump] [count] [/]string[/] dl[ist] [/]string[/] do[autocmd] [group] {event} [fname] doautoa[ll] [group] {event} [fname] dr[op] [++opt] [+cmd] {file} .. ds[earch] [count] [/]string[/] dsp[lit] [count] [/]string[/] e[dit] [++opt] [+cmd] {file} ea[rlier] {count} | {N}s | {N}h ec[ho] {expr1} .. echoe[rr] {expr1} .. echoh[l] {expr1} .. echom[sg] {expr1} .. echon {expr1} .. el[se] elsei[f] {expr1} em[enu] {menu} en[dif] endf[unction] endfo[r] endt[ry] endw[hile] ene[w] ex [++opt] [+cmd] [file] exe[cute] {expr1} .. exi[t] [++opt] [file] exu[sage] f[ile] files filet[ype] fin[d] [++opt] [+cmd] {file} fina[lly] fini[sh] fir[st] [++opt] [+cmd] fix[del] fo[ld] foldc[lose] foldd[oopen] {cmd} folddoc[losed] {cmd} foldo[pen] for {var} in {list} fu[nction] {name}([arguments]) [range] [abort] [dict] go[to] [count] gr[ep] [arguments] grepa[dd] [arguments] gu[i] [++opt] [+cmd] [-f|-b] [files...] gv[im] [++opt] [+cmd] [-f|-b] [files...] h[elp] {subject} ha[rdcopy] [arguments] helpf[ind] helpg[rep] {pattern}[@xx] helpt[ags] [++t] {dir} hi[ghlight] [default] {group-name} {key}={arg} .. hid[e] {cmd} his[tory] [{name}] [{first}][, [{last}]] i[nsert] ia[bbrev] [] [lhs] [rhs] iabc[lear] if {expr1} ij[ump] [count] [/]pattern[/] il[ist] [/]pattern[/] im[ap] {lhs} {rhs} imapc[lear] imenu {menu} ino[remap] {lhs} {rhs} inorea[bbrev] [] [lhs] [rhs] inoreme[nu] {menu} int[ro] is[earch] [count] [/]pattern[/] isp[lit] [count] [/]pattern[/] iu[nmap] {lhs} iuna[bbrev] {lhs} iunme[nu] {menu} j[oin] {count} [flags] ju[mps] kee[pmarks] {command} keep[jumps] {command} keepa[lt] {cmd} lN[ext] lNf[ile] l[ist] [count] [flags] la[st] [++opt] [+cmd] lad[dexpr] {expr} laddb[uffer] [bufnr] laddf[ile] [errorfile] lan[guage] {name} | mes[sages] {name} | cty[pe] {name} | tim[e] {name} lat[er] {count} | {N}s | {N}m | {N}h lb[uffer] [bufnr] lc[d] {path} lch[dir] {path} lcl[ose] lcs[cope] add {file|dir} [pre-path] [flags] | find {querytype} {name} | kill {num|partial_name} | help | reset | show le[ft] [indent] lefta[bove] {cmd} let {var-name} = {expr1} lex[pr] {expr} lf[ile] [errorfile] lfir[st] [nr] lg[etfile] [errorfile] lgetb[uffer] [bufnr] lgete[xpr] {expr} lgr[ep] [arguments] lgrepa[dd] [arguments] lh[elpgrep] {pattern}[@xx] ll [nr] lla[st] [nr] lli[st] [from] [, [to]] lm[ap] {lhs} {rhs} lmak[e] [arguments] lmapc[lear] ln[oremap] {lhs} {rhs} lne[xt] lnew[er] [count] lnf[ile] lo[adview] [nr] loadk[eymap] loc[kmarks] {command} lockv[ar] [depth] {name} ... lol[der] [count] lop[en] [height] lp[revious] lpf[ile] lr[ewind] [nr] ls lt[ag] [ident] lua {chunk} | << {endmarker} luado {body} luafile {file} lu[nmap] {lhs} lv[imgrep] /{pattern}/[g][j] {file} ... | {pattern} {file} ... lvimgrepadd /{pattern}/[g][j] {file} ... | {pattern} {file} ... lwindow [height] m[ove] {address} ma[rk] {a-zA-z'} mak[e] [arguments] map {lhs} {rhs} mapc[lear] marks match {group} /{pattern}/ menu {menu} menut[ranslate] clear | {english} {mylang} mes[sages] mk[exrc] [file] mks[ession] [file] mksp[ell] [-ascii] {outname} {inname} ... mkv[imrc] [file] mkvie[w] [file] mod[e] [mode] mz[scheme] {stmt} | << {endmarker} {script} {endmarker} | {file} mzf[ile] {file} n[ext] [++opt] [+cmd] nb[key] key new nm[ap] {lhs} {rhs} nmapc[lear] nmenu {menu} nno[remap] {lhs} {rhs} nnoreme[nu] {menu} no[remap] {lhs} {rhs} noa[utocmd] {cmd} noh[lsearch] norea[bbrev] [] [lhs] [rhs] noreme[nu] {menu} norm[al] {commands} nu[mber] [count] [flags] nun[map] {lhs} nunme[nu] {menu} o[pen] /pattern/ ol[dfiles] om[ap] {lhs} {rhs} omapc[lear] ome[nu] {menu} on[ly] ono[remap] {lhs} {rhs} onoreme[nu] {menu} opt[ions] ou[nmap] {lhs} ounmenu {menu} ownsyntax list {group-name} | list @{cluster-name} p[rint] {count} [flags] pc[lose] pe[rl] {cmd} | << {endpattern} {script} {endpattern} ped[it] [++opt] [+cmd] {file} perld[o] {cmd} po[p] popu[p] {name} pp[op] pre[serve] prev[ious] [count] [++opt] [+cmd] prof[ile] start {fname} | pause | continue | func {pattern} | file {pattern} profd[el] ... promptf[ind] [string] promptr[epl] [string] ps[earch] [count] [/]pattern[/] ptN[ext] pta[g] [tagname] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] [ident] pu[t] [x] pw[d] py[thon] {stmt} | << {endmarker} {script} {endmarker} python3 {stmt} | << {endmarker} {script} {endmarker} pyf[ile] {file} py3f[ile] {file} q[uit] qa[ll] quita[ll] r[ead] [++opt] [name] rec[over] [file] red[o] redi[r] > {file} | >> {file} | @{a-zA-Z} | => {var} | END redr[aw] redraws[tatus] reg[isters] {arg} res[ize] ret[ab] [new_tabstop] retu[rn] [expr] rew[ind] [++opt] [+cmd] ri[ght] [width] rightb[elow] {cmd} rub[y] {cmd} | << {endpattern} {script} {endpattern} rubyd[o] {cmd} rubyf[ile] {file} runtime {file} .. rv[iminfo] [file] sN[ext] [++opt] [+cmd] [N] s[ubstitute] /{pattern}/{string}/[flags] [count] sa[rgument] [++opt] [+cmd] [N] sal[l] san[dbox] {cmd} sav[eas] [++opt] {file} sbN[ext] [N] sb[uffer] {bufname} sba[ll] [N] sbf[irst] sbl[ast] sbm[odified] [N] sbn[ext] [N] sbp[revious] [N] sbr[ewind] scrip[tnames] scripte[ncoding] [encoging] scscope add {file|dir} [pre-path] [flags] | find {querytype} {name} | kill {num|partial_name} | help | reset | show se[t] {option}={value} {option}? | {option} | {option}& setf[iletype] {filetype} setg[lobal] ... setl[ocal] ... sf[ind] [++opt] [+cmd] {file} sfir[st] [++opt] [+cmd] sh[ell] sig[n] define {name} {argument}... | icon={pixmap} | linehl={group} | text={text} | texthl={group} sil[ent] {command} sim[alt] {key} sl[eep] [N] [m] sla[st] [++opt] [+cmd] sm[agic] ... sm[ap] {lhs} {rhs} smapc[lear] sme[nu] {menu} sn[ext] [++opt] [+cmd] [file ..] sni[ff] request [symbol] sno[remap] {lhs} {rhs} snoreme[nu] {menu} so[urce] {file} sor[t] [i][u][r][n][x][o] [/{pattern}/] sp[lit] [++opt] [+cmd] spe[llgood] {word} spelld[ump] spelli[nfo] spellr[epall] spellu[ndo] {word} spellw[rong] {word} spr[evious] [++opt] [+cmd] [N] sre[wind] [++opt] [+cmd] st[op] sta[g] [tagname] star[tinsert] startg[replace] startr[eplace] stj[ump] [ident] stopi[nsert] sts[elect] [ident] sun[hide] [N] sunm[ap] {lhs} sunme[nu] {menu} sus[pend] sv[iew] [++opt] [+cmd] {file} sw[apname] sy[ntax] list {group-name} | list @{cluster-name} sync[bind] t tN[ext] ta[g] {ident} tab {cmd} tabN[ext] tabc[lose] tabd[o] {cmd} tabe[dit] [++opt] [+cmd] {file} tabf[ind] [++opt] [+cmd] {file} tabfir[st] tabl[ast] tabm[ove] [N] tabn[ext] tabnew [++opt] [+cmd] {file} tabo[nly] tabp[revious] tabr[ewind] tabs tags tc[l] {cmd} | {endmarker} {script} {endmarker} tcld[o] {cmd} tclf[ile] {file} te[aroff] {name} tf[irst] th[row] {expr1} tj[ump] [ident] tl[ast] tm[enu] {menu} tn[ext] to[pleft] {cmd} tp[revious] tr[ewind] try tselect tu[nmenu] {menu} u[ndo] {N} una[bbreviate] {lhs} undoj[oin] undol[ist] unh[ide] [N] unl[et] {name} ... unlo[ckvar] [depth] {name} ... unm[ap] {lhs} unme[nu] {menu} uns[ilent] {command} up[date] [++opt] [>>] [file] ve[rsion] verb[ose] {command} vert[ical] {cmd} vg[lobal] /{pattern}/[cmd] vi[sual] [++opt] [+cmd] [file] vie[w] [++opt] [+cmd] file vim[grep] /{pattern}/[g][j] {file} ... | {pattern} {file} ... vimgrepa[dd] /{pattern}/[g][j] {file} ... | {pattern} {file} ... viu[sage] vm[ap] {lhs} {rhs} vmapc[lear] vmenu {menu} vn[oremap] {lhs} {rhs} vne[w] [++opt] [+cmd] [file] vnoremenu {menu} vsp[lit] [++opt] [+cmd] [file] vu[nmap] {lhs} vunmenu {menu} wN[ext] [++opt] [file] w[rite] [++opt] [file] wa[ll] wh[ile] {expr1} win[size] {width} {height} winc[md] {arg} windo {cmd} winp[os] {X} {Y} wn[ext] [++opt] wp[revious] [++opt] [file] wq [++opt] wqa[ll] [++opt] ws[verb] verb wv[iminfo] [file] x[it] [++opt] [file] xa[ll] [++opt] xm[ap] {lhs} {rhs} xmapc[lear] xmenu {menu} xn[oremap] {lhs} {rhs} xnoremenu {menu} xu[nmap] {lhs} xunmenu {menu} y[ank] [x] {count} autoload/neocomplcache/sources/completefunc_complete.vim [[[1 114 "============================================================================= " 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: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"}}} " vim: foldmethod=marker 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/vim_complete/command_replaces.dict [[[1 10 ; the starting line of the command range ; the final line of the command range ; any count supplied (as described for the '-range' and '-count' attributes) ; expands to a ! if the command was executed with a ! modifier ; the optional register, if specified ; the command arguments, exactly as supplied ; a single '<' (Less-Than) character ; the value is quoted in such a way as to make it a valid value for use in an expression ; splits the command arguments at spaces and tabs, quotes each argument individually ; defining a user command in a script autoload/neocomplcache/sources/dictionary_complete.vim [[[1 152 "============================================================================= " FILE: dictionary_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 29 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: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') " 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 "}}} " 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:key = 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:source in neocomplcache#get_sources_list(s:dictionary_list, l:key) let l:list += neocomplcache#dictionary_filter(l:source, a:cur_keyword_str, s:completion_length) endfor return l:list endfunction"}}} function! neocomplcache#sources#dictionary_complete#define()"{{{ return s:source 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 keys(neocomplcache#get_source_filetypes(l:key)) if !has_key(s:dictionary_list, l:filetype) let s:dictionary_list[l:filetype] = s:initialize_dictionary(l:filetype) endif endfor endfunction"}}} function! s:recaching(filetype)"{{{ if a:filetype == '' let l:filetype = neocomplcache#get_context_filetype(1) else let l:filetype = a:filetype endif " Caching. let s:dictionary_list[l:filetype] = s:caching_from_dict(l:filetype) endfunction"}}} function! s:initialize_dictionary(filetype)"{{{ let l:keyword_lists = neocomplcache#cache#index_load_from_cache('dictionary_cache', a:filetype, s:completion_length) if !empty(l:keyword_lists) " Caching from cache. return l:keyword_lists endif return s:caching_from_dict(a:filetype) endfunction"}}} function! s:caching_from_dict(filetype)"{{{ 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 l:keyword_list = [] for l:dictionary in split(l:dictionaries, ',') if filereadable(l:dictionary) let l:keyword_list += neocomplcache#cache#load_from_file(l:dictionary, \neocomplcache#get_keyword_pattern(a:filetype), 'D') endif endfor let l:keyword_dict = {} for l:keyword in l:keyword_list let l:key = tolower(l:keyword.word[: s:completion_length-1]) if !has_key(l:keyword_dict, l:key) let l:keyword_dict[l:key] = [] endif call add(l:keyword_dict[l:key], l:keyword) endfor " Save dictionary cache. call neocomplcache#cache#save_cache('dictionary_cache', a:filetype, neocomplcache#unpack_dictionary(l:keyword_dict)) return l:keyword_dict endfunction"}}} " vim: foldmethod=marker 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/vim_complete/commands.dict [[[1 492 Next ; go to previous file in the argument list Print ; print lines abbreviate ; enter abbreviation abclear ; remove all abbreviations aboveleft ; make split window appear left or above all ; open a window for each file in the argument list amenu ; enter new menu item for all modes anoremenu ; enter a new menu for all modes that will not be remapped append ; append text argadd ; add items to the argument list argdelete ; delete items from the argument list argdo ; do a command on all items in the argument list argedit ; add item to the argument list and edit it argglobal ; define the global argument list arglocal ; define a local argument list args ; print the argument list argument ; go to specific file in the argument list ascii ; print ascii value of character under the cursor augroup ; select the autocommand group to use aunmenu ; remove menu for all modes autocmd ; enter or show autocommands bNext ; go to previous buffer in the buffer list badd ; add buffer to the buffer list ball ; open a window for each buffer in the buffer list bdelete ; remove a buffer from the buffer list behave ; set mouse and selection behavior belowright ; make split window appear right or below bfirst ; go to first buffer in the buffer list blast ; go to last buffer in the buffer list bmodified ; go to next buffer in the buffer list that has been modified bnext ; go to next buffer in the buffer list botright ; make split window appear at bottom or far right bprevious ; go to previous buffer in the buffer list break ; break out of while loop breakadd ; add a debugger breakpoint breakdel ; delete a debugger breakpoint breaklist ; list debugger breakpoints brewind ; go to first buffer in the buffer list browse ; use file selection dialog bufdo ; execute command in each listed buffer buffer ; go to specific buffer in the buffer list buffers ; list all files in the buffer list bunload ; unload a specific buffer bwipeout ; really delete a buffer cNext ; go to previous error cNfile ; go to last error in previous file cabbrev ; like "abbreviate" but for Command-line mode cabclear ; clear all abbreviations for Command-line mode caddbuffer ; add errors from buffer caddexpr ; add errors from expr caddfile ; add error message to current quickfix list call ; call a function catch ; part of a try command cbuffer ; parse error messages and jump to first error cclose ; close quickfix window center ; format lines at the center cexpr ; read errors from expr and jump to first cfile ; read file with error messages and jump to first cfirst ; go to the specified error, default first one cgetbuffer ; get errors from buffer cgetexpr ; get errors from expr cgetfile ; read file with error messages change ; replace a line or series of lines changes ; print the change list chdir ; change directory checkpath ; list included files checktime ; check timestamp of loaded buffers clast ; go to the specified error, default last one clist ; list all errors close ; close current window cmap ; like "map" but for Command-line mode cmapclear ; clear all mappings for Command-line mode cmenu ; add menu for Command-line mode cnewer ; go to newer error list cnext ; go to next error cnfile ; go to first error in next file cnoreabbrev ; like "noreabbrev" but for Command-line mode cnoremap ; like "noremap" but for Command-line mode cnoremenu ; like "noremenu" but for Command-line mode colder ; go to older error list colorscheme ; load a specific color scheme comclear ; clear all user-defined commands command ; create user-defined command compiler ; do settings for a specific compiler confirm ; prompt user when confirmation required continue ; go back to while copen ; open quickfix window copy ; copy lines cpfile ; go to last error in previous file cprevious ; go to previous error cquit ; quit Vim with an error code crewind ; go to the specified error, default first one cscope ; execute cscope command cstag ; use cscope to jump to a tag cunabbrev ; like "unabbrev" but for Command-line mode cunmap ; like "unmap" but for Command-line mode cunmenu ; remove menu for Command-line mode cwindow ; open or close quickfix window debug ; run a command in debugging mode debuggreedy ; read debug mode commands from normal input delcommand ; delete user-defined command delete ; delete lines delfunction ; delete a user function delmarks ; delete marks diffget ; remove differences in current buffer diffoff ; switch off diff mode diffpatch ; apply a patch and show differences diffput ; remove differences in other buffer diffsplit ; show differences with another file diffthis ; make current window a diff window diffupdate ; update 'diff' buffers digraphs ; show or enter digraphs display ; display registers djump ; jump to #define dlist ; list #defines doautoall ; apply autocommands for all loaded buffers doautocmd ; apply autocommands to current buffer drop ; jump to window editing file or edit file in current window dsearch ; list one #define dsplit ; split window and jump to #define earlier ; go to older change, undo echo ; echoes the result of expressions echoerr ; like echo, show like an error and use history echohl ; set highlighting for echo commands echomsg ; same as echo, put message in history echon ; same as echo, but without edit ; edit a file else ; part of an if command elseif ; part of an if command emenu ; execute a menu by name endfor ; end previous for endfunction ; end of a user function endif ; end previous if endtry ; end previous try endwhile ; end previous while enew ; edit a new, unnamed buffer execute ; execute result of expressions exit ; same as "xit" exusage ; overview of Ex commands file ; show or set the current file name files ; list all files in the buffer list filetype ; switch file type detection on/off finally ; part of a try command find ; find file in 'path' and edit it finish ; quit sourcing a Vim script first ; go to the first file in the argument list fixdel ; set key code of fold ; create a fold foldclose ; close folds folddoclosed ; execute command on lines in a closed fold folddoopen ; execute command on lines not in a closed fold foldopen ; open folds for ; for loop function ; define a user function global ; execute commands for matching lines goto ; go to byte in the buffer grep ; run 'grepprg' and jump to first match grepadd ; like grep, but append to current list gui ; start the GUI gvim ; start the GUI hardcopy ; send text to the printer help ; open a help window helpfind ; dialog to open a help window helpgrep ; like "grep" but searches help files helptags ; generate help tags for a directory hide ; hide current buffer for a command highlight ; specify highlighting methods history ; print a history list iabbrev ; like "abbrev" but for Insert mode iabclear ; like "abclear" but for Insert mode ijump ; jump to definition of identifier ilist ; list lines where identifier matches imap ; like "map" but for Insert mode imapclear ; like "mapclear" but for Insert mode imenu ; add menu for Insert mode inoreabbrev ; like "noreabbrev" but for Insert mode inoremap ; like "noremap" but for Insert mode inoremenu ; like "noremenu" but for Insert mode insert ; insert text intro ; print the introductory message isearch ; list one line where identifier matches isplit ; split window and jump to definition of identifier iunabbrev ; like "unabbrev" but for Insert mode iunmap ; like "unmap" but for Insert mode iunmenu ; remove menu for Insert mode join ; join lines jumps ; print the jump list keepalt ; following command keeps the alternate file keepjumps ; following command keeps jumplist and marks keepmarks ; following command keeps marks where they are lNext ; go to previous entry in location list lNfile ; go to last entry in previous file laddbuffer ; add locations from buffer laddexpr ; add locations from expr laddfile ; add locations to current location list language ; set the language (locale) last ; go to the last file in the argument list later ; go to newer change, redo lbuffer ; parse locations and jump to first location lcd ; change directory locally lchdir ; change directory locally lclose ; close location window lcscope ; like "cscope" but uses location list left ; left align lines leftabove ; make split window appear left or above let ; assign a value to a variable or option lexpr ; read locations from expr and jump to first lfile ; read file with locations and jump to first lfirst ; go to the specified location, default first one lgetbuffer ; get locations from buffer lgetexpr ; get locations from expr lgetfile ; read file with locations lgrep ; run 'grepprg' and jump to first match lgrepadd ; like grep, but append to current list lhelpgrep ; like "helpgrep" but uses location list list ; print lines llast ; go to the specified location, default last one llist ; list all locations lmake ; execute external command 'makeprg' and parse error messages lmap ; like "map!" but includes Lang-Arg mode lmapclear ; like "mapclear!" but includes Lang-Arg mode lnewer ; go to newer location list lnext ; go to next location lnfile ; go to first location in next file lnoremap ; like "noremap!" but includes Lang-Arg mode loadkeymap ; load the following keymaps until EOF loadview ; load view for current window from a file lockmarks ; following command keeps marks where they are lockvar ; lock variables lolder ; go to older location list lopen ; open location window lpfile ; go to last location in previous file lprevious ; go to previous location lrewind ; go to the specified location, default first one ltag ; jump to tag and add matching tags to the location list lua ; execute Lua chunk. luado ; execute Lua function. luafile ; execute Lua script in file. lunmap ; like "unmap!" but includes Lang-Arg mode lvimgrep ; search for pattern in files lvimgrepadd ; like vimgrep, but append to current list lwindow ; open or close location window make ; execute external command 'makeprg' and parse error messages map ; show or enter a mapping mapclear ; clear all mappings for Normal and Visual mode mark ; set a mark marks ; list all marks match ; define a match to highlight menu ; enter a new menu item menutranslate ; add a menu translation item messages ; view previously displayed messages mkexrc ; write current mappings and settings to a file mksession ; write session info to a file mkspell ; produce .spl spell file mkview ; write view of current window to a file mkvimrc ; write current mappings and settings to a file mode ; show or change the screen mode move ; move lines mzfile ; execute MzScheme script file mzscheme ; execute MzScheme command nbkey ; pass a key to Netbeans new ; create a new empty window next ; go to next file in the argument list nmap ; like "map" but for Normal mode nmapclear ; clear all mappings for Normal mode nmenu ; add menu for Normal mode nnoremap ; like "noremap" but for Normal mode nnoremenu ; like "noremenu" but for Normal mode noautocmd ; following command don't trigger autocommands nohlsearch ; suspend 'hlsearch' highlighting noreabbrev ; enter an abbreviation that will not be remapped noremap ; enter a mapping that will not be remapped noremenu ; enter a menu that will not be remapped normal ; execute Normal mode commands number ; print lines with line number nunmap ; like "unmap" but for Normal mode nunmenu ; remove menu for Normal mode oldfiles ; list files that have marks in the viminfo file omap ; like "map" but for Operator-pending mode omapclear ; remove all mappings for Operator-pending mode omenu ; add menu for Operator-pending mode only ; close all windows except the current one onoremap ; like "noremap" but for Operator-pending mode onoremenu ; like "noremenu" but for Operator-pending mode open ; start open mode (not implemented) options ; open the options-window ounmap ; like "unmap" but for Operator-pending mode ounmenu ; remove menu for Operator-pending mode ownsyntax ; define Window-local syntax pclose ; close preview window pedit ; edit file in the preview window perl ; execute Perl command perldo ; execute Perl command for each line pop ; jump to older entry in tag stack popup ; popup a menu by name ppop ; "pop" in preview window preserve ; write all text to swap file previous ; go to previous file in argument list print ; print lines profdel ; stop profiling a function or script profile ; profiling functions and scripts promptfind ; open GUI dialog for searching promptrepl ; open GUI dialog for search/replace psearch ; like "ijump" but shows match in preview window ptNext ; tNext in preview window ptag ; show tag in preview window ptfirst ; trewind in preview window ptjump ; tjump and show tag in preview window ptlast ; tlast in preview window ptnext ; tnext in preview window ptprevious ; tprevious in preview window ptrewind ; trewind in preview window ptselect ; tselect and show tag in preview window put ; insert contents of register in the text pwd ; print current directory py3file ; execute Python3 script file pyfile ; execute Python script file python ; execute Python command python3 ; execute Python3 command qall ; quit Vim quit ; quit current window (when one window quit Vim) quitall ; quit Vim read ; read file into the text recover ; recover a file from a swap file redir ; redirect messages to a file or register redo ; redo one undone change redraw ; force a redraw of the display redrawstatus ; force a redraw of the status line(s) registers ; display the contents of registers resize ; change current window height retab ; change tab size return ; return from a user function rewind ; go to the first file in the argument list right ; right align text rightbelow ; make split window appear right or below ruby ; execute Ruby command rubydo ; execute Ruby command for each line rubyfile ; execute Ruby script file runtime ; source vim scripts in 'runtimepath' rviminfo ; read from viminfo file sNext ; split window and go to previous file in argument list sall ; open a window for each file in argument list sandbox ; execute a command in the sandbox sargument ; split window and go to specific file in argument list saveas ; save file under another name. sbNext ; split window and go to previous file in the buffer list sball ; open a window for each file in the buffer list sbfirst ; split window and go to first file in the buffer list sblast ; split window and go to last file in buffer list sbmodified ; split window and go to modified file in the buffer list sbnext ; split window and go to next file in the buffer list sbprevious ; split window and go to previous file in the buffer list sbrewind ; split window and go to first file in the buffer list sbuffer ; split window and go to specific file in the buffer list scriptencoding ; encoding used in sourced Vim script scriptnames ; list names of all sourced Vim scripts scscope ; split window and execute cscope command set ; show or set options setfiletype ; set 'filetype', unless it was set already setglobal ; show global values of options setlocal ; show or set options locally sfind ; split current window and edit file in 'path' sfirst ; split window and go to first file in the argument list shell ; escape to a shell sign ; manipulate signs silent ; run a command silently simalt ; Win32 GUI simulate Windows ALT key slast ; split window and go to last file in the argument list sleep ; do nothing for a few seconds smagic ; substitute with 'magic' smap ; like "map" but for Select mode smapclear ; remove all mappings for Select mode smenu ; add menu for Select mode snext ; split window and go to next file in the argument list sniff ; send request to sniff snomagic ; substitute with 'nomagic' snoremap ; like "noremap" but for Select mode snoremenu ; like "noremenu" but for Select mode sort ; sort lines source ; read Vim or Ex commands from a file spelldump ; split window and fill with all correct words spellgood ; add good word for spelling spellinfo ; show info about loaded spell files spellrepall ; replace all bad words like last z= spellundo ; remove good or bad word spellwrong ; add spelling mistake split ; split current window sprevious ; split window and go to previous file in the argument list srewind ; split window and go to first file in the argument list stag ; split window and jump to a tag startgreplace ; start Virtual Replace mode startinsert ; start Insert mode startreplace ; start Replace mode stjump ; do "tjump" and split window stop ; suspend the editor or escape to a shell stopinsert ; stop Insert mode stselect ; do "tselect" and split window substitute ; find and replace text sunhide ; same as "unhide" sunmap ; like "unmap" but for Select mode sunmenu ; remove menu for Select mode suspend ; same as "stop" sview ; split window and edit file read-only swapname ; show the name of the current swap file syncbind ; sync scroll binding syntax ; syntax highlighting tNext ; jump to previous matching tag tab ; create new tab when opening new window tabNext ; go to previous tab page tabclose ; close current tab page tabdo ; execute command in each tab page tabedit ; edit a file in a new tab page tabfind ; find file in 'path', edit it in a new tab page tabfirst ; got to first tab page tablast ; got to last tab page tabmove ; move tab page to other position tabnew ; edit a file in a new tab page tabnext ; go to next tab page tabonly ; close all tab pages except the current one tabprevious ; go to previous tab page tabrewind ; got to first tab page tabs ; list the tab pages and what they contain tag ; jump to tag tags ; show the contents of the tag stack tcl ; execute Tcl command tcldo ; execute Tcl command for each line tclfile ; execute Tcl script file tearoff ; tear-off a menu tfirst ; jump to first matching tag throw ; throw an exception tjump ; like "tselect", but jump directly when there is only one match tlast ; jump to last matching tag tmenu ; define menu tooltip tnext ; jump to next matching tag topleft ; make split window appear at top or far left tprevious ; jump to previous matching tag trewind ; jump to first matching tag try ; execute commands, abort on error or exception tselect ; list matching tags and select one tunmenu ; remove menu tooltip unabbreviate ; remove abbreviation undo ; undo last change(s) undojoin ; join next change with previous undo block undolist ; list leafs of the undo tree unhide ; open a window for each loaded file in the buffer list unlet ; delete variable unlockvar ; unlock variables unmap ; remove mapping unmenu ; remove menu unsilent ; run a command not silently update ; write buffer if modified verbose ; execute command with 'verbose' set version ; print version number and other info vertical ; make following command split vertically vglobal ; execute commands for not matching lines view ; edit a file read-only vimgrep ; search for pattern in files vimgrepadd ; like vimgrep, but append to current list visual ; same as "edit", but turns off "Ex" mode viusage ; overview of Normal mode commands vmap ; like "map" but for Visual+Select mode vmapclear ; remove all mappings for Visual+Select mode vmenu ; add menu for Visual+Select mode vnew ; create a new empty window, vertically split vnoremap ; like "noremap" but for Visual+Select mode vnoremenu ; like "noremenu" but for Visual+Select mode vsplit ; split current window vertically vunmap ; like "unmap" but for Visual+Select mode vunmenu ; remove menu for Visual+Select mode wNext ; write to a file and go to previous file in argument list wall ; write all (changed) buffers while ; execute loop for as long as condition met wincmd ; execute a Window (CTRL-W) command windo ; execute command in each window winpos ; get or set window position winsize ; get or set window size (obsolete) wnext ; write to a file and go to next file in argument list wprevious ; write to a file and go to previous file in argument list wqall ; write all changed buffers and quit Vim write ; write to a file wsverb ; pass the verb to workshop over IPC wviminfo ; write to viminfo file xall ; same as "wqall" xit ; write if buffer changed and quit window or Vim xmap ; like "map" but for Visual mode xmapclear ; remove all mappings for Visual mode xmenu ; add menu for Visual mode xnoremap ; like "noremap" but for Visual mode xnoremenu ; like "noremenu" but for Visual mode xunmap ; like "unmap" but for Visual mode xunmenu ; remove menu for Visual mode yank ; yank lines into a register autoload/neocomplcache/sources/filename_complete.vim [[[1 179 "============================================================================= " FILE: filename_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 29 Sep 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:source = { \ 'name' : 'filename_complete', \ 'kind' : 'complfunc', \} function! s:source.initialize()"{{{ " Initialize. let s:skip_dir = {} let s:completion_length = neocomplcache#get_auto_completion_length('filename_complete') " 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)"{{{ if &filetype ==# 'vimshell' || neocomplcache#within_comment() return -1 endif let l:is_win = has('win32') || has('win64') " 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) if neocomplcache#is_auto_complete() && len(l:cur_keyword_str) < s:completion_length return -1 endif " Not Filename pattern. if l:is_win && &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:cur_keyword_str = escape(a:cur_keyword_str, '[]') let l:is_win = has('win32') || has('win64') 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 l: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 if a:cur_keyword_str =~ '^\~\h\w*' let l:cur_keyword_str = simplify($HOME . '/../' . l:cur_keyword_str[1:]) endif endif let l:cur_keyword_str = substitute(l:cur_keyword_str, '\\ ', ' ', 'g') " Glob by directory name. let l:cur_keyword_str = substitute(l:cur_keyword_str, '\%(^\.\|/\.\?\)\?\zs[^/]*$', '', '') let l:path = (!neocomplcache#is_auto_complete() && a:cur_keyword_str !~ '^\.\.\?/')? &path : ',' let l:glob = (l:cur_keyword_str !~ '\*$')? l:cur_keyword_str . '*' : l:cur_keyword_str try let l:files = split(substitute(globpath(l:path, l:glob), '\\', '/', 'g'), '\n') catch return [] endtry 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:files = split(substitute(globpath(l:path, l:glob), '\\', '/', 'g'), '\n') catch return [] endtry endif if empty(l:files) || (neocomplcache#is_auto_complete() && len(l:files) > g:neocomplcache_max_list) return [] endif let l:dir_list = [] let l:file_list = [] let l:home_pattern = '^'.substitute($HOME, '\\', '/', 'g').'/' let l:paths = map(split(&path, ','), 'substitute(v:val, "\\\\", "/", "g")') let l:exts = escape(substitute($PATHEXT, ';', '\\|', 'g'), '.') for word in l:files let l:dict = { 'word' : word, 'menu' : '[F]' } let l:cur_keyword_str = $HOME . '/../' . l:cur_keyword_str[1:] 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(word, l:home_pattern, '\~/', '') elseif !neocomplcache#is_auto_complete() && a:cur_keyword_str !~ '^\.\.\?/' " Path search. for path in l:paths if path != '' && neocomplcache#head_match(word, path . '/') let l:dict.word = l:dict.word[len(path)+1 : ] break endif endfor endif let l:abbr = l:dict.word if isdirectory(l:word) let l:abbr .= '/' if g:neocomplcache_enable_auto_delimiter let l:dict.word .= '/' endif elseif l:is_win if '.'.fnamemodify(l:word, ':e') =~ l:exts let l:abbr .= '*' endif elseif executable(l: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:word) ? l:dir_list : l:file_list, l:dict) endfor return neocomplcache#keyword_filter(l:dir_list, a:cur_keyword_str) + neocomplcache#keyword_filter(l:file_list, a:cur_keyword_str) endfunction"}} function! neocomplcache#sources#filename_complete#define()"{{{ return s:source endfunction"}}} " vim: foldmethod=marker 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/vim_complete/features.dict [[[1 148 all_builtin_terms ; Compiled with all builtin terminals enabled. amiga ; Amiga version of Vim. arabic ; Compiled with Arabic support |Arabic|. arp ; Compiled with ARP support (Amiga). autocmd ; Compiled with autocommand support. |autocommand| balloon_eval ; Compiled with |balloon-eval| support. balloon_multiline ; GUI supports multiline balloons. beos ; BeOS version of Vim. browse ; Compiled with |:browse| support, and browse() will work. builtin_terms ; Compiled with some builtin terminals. byte_offset ; Compiled with support for 'o' in 'statusline' cindent ; Compiled with 'cindent' support. clientserver ; Compiled with remote invocation support |clientserver|. clipboard ; Compiled with 'clipboard' support. cmdline_compl ; Compiled with |cmdline-completion| support. cmdline_hist ; Compiled with |cmdline-history| support. cmdline_info ; Compiled with 'showcmd' and 'ruler' support. comments ; Compiled with |'comments'| support. cryptv ; Compiled with encryption support |encryption|. cscope ; Compiled with |cscope| support. compatible ; Compiled to be very Vi compatible. debug ; Compiled with "DEBUG" defined. dialog_con ; Compiled with console dialog support. dialog_gui ; Compiled with GUI dialog support. diff ; Compiled with |vimdiff| and 'diff' support. digraphs ; Compiled with support for digraphs. dnd ; Compiled with support for the "~ register |quote_~|. dos32 ; 32 bits DOS (DJGPP) version of Vim. dos16 ; 16 bits DOS version of Vim. ebcdic ; Compiled on a machine with ebcdic character set. emacs_tags ; Compiled with support for Emacs tags. eval ; Compiled with expression evaluation support. Always true, of course! ex_extra ; Compiled with extra Ex commands |+ex_extra|. extra_search ; Compiled with support for |'incsearch'| and |'hlsearch'| farsi ; Compiled with Farsi support |farsi|. file_in_path ; Compiled with support for |gf| and || filterpipe ; When 'shelltemp' is off pipes are used for shell read/write/filter commands find_in_path ; Compiled with support for include file searches |+find_in_path|. float ; Compiled with support for |Float|. fname_case ; Case in file names matters (for Amiga, MS-DOS, and Windows this is not present). folding ; Compiled with |folding| support. footer ; Compiled with GUI footer support. |gui-footer| fork ; Compiled to use fork()/exec() instead of system(). gettext ; Compiled with message translation |multi-lang| gui ; Compiled with GUI enabled. gui_athena ; Compiled with Athena GUI. gui_gtk ; Compiled with GTK+ GUI (any version). gui_gtk2 ; Compiled with GTK+ 2 GUI (gui_gtk is also defined). gui_gnome ; Compiled with Gnome support (gui_gtk is also defined). gui_mac ; Compiled with Macintosh GUI. gui_motif ; Compiled with Motif GUI. gui_photon ; Compiled with Photon GUI. gui_win32 ; Compiled with MS Windows Win32 GUI. gui_win32s ; idem, and Win32s system being used (Windows 3.1) gui_running ; Vim is running in the GUI, or it will start soon. hangul_input ; Compiled with Hangul input support. |hangul| iconv ; Can use iconv() for conversion. insert_expand ; Compiled with support for CTRL-X expansion commands in Insert mode. jumplist ; Compiled with |jumplist| support. keymap ; Compiled with 'keymap' support. langmap ; Compiled with 'langmap' support. libcall ; Compiled with |libcall()| support. linebreak ; Compiled with 'linebreak', 'breakat' and 'showbreak' support. lispindent ; Compiled with support for lisp indenting. listcmds ; Compiled with commands for the buffer list |:files| and the argument list |arglist|. localmap ; Compiled with local mappings and abbr. |:map-local| mac ; Macintosh version of Vim. macunix ; Macintosh version of Vim, using Unix files (OS-X). menu ; Compiled with support for |:menu|. mksession ; Compiled with support for |:mksession|. modify_fname ; Compiled with file name modifiers. |filename-modifiers| mouse ; Compiled with support mouse. mouseshape ; Compiled with support for 'mouseshape'. mouse_dec ; Compiled with support for Dec terminal mouse. mouse_gpm ; Compiled with support for gpm (Linux console mouse) mouse_netterm ; Compiled with support for netterm mouse. mouse_pterm ; Compiled with support for qnx pterm mouse. mouse_sysmouse ; Compiled with support for sysmouse (*BSD console mouse) mouse_xterm ; Compiled with support for xterm mouse. multi_byte ; Compiled with support for 'encoding' multi_byte_encoding ; 'encoding' is set to a multi-byte encoding. multi_byte_ime ; Compiled with support for IME input method. multi_lang ; Compiled with support for multiple languages. mzscheme ; Compiled with MzScheme interface |mzscheme|. netbeans_intg ; Compiled with support for |netbeans|. netbeans_enabled ; Compiled with support for |netbeans| and it's used. ole ; Compiled with OLE automation support for Win32. os2 ; OS/2 version of Vim. osfiletype ; Compiled with support for osfiletypes |+osfiletype| path_extra ; Compiled with up/downwards search in 'path' and 'tags' perl ; Compiled with Perl interface. postscript ; Compiled with PostScript file printing. printer ; Compiled with |:hardcopy| support. profile ; Compiled with |:profile| support. python ; Compiled with Python interface. qnx ; QNX version of Vim. quickfix ; Compiled with |quickfix| support. reltime ; Compiled with |reltime()| support. rightleft ; Compiled with 'rightleft' support. ruby ; Compiled with Ruby interface |ruby|. scrollbind ; Compiled with 'scrollbind' support. showcmd ; Compiled with 'showcmd' support. signs ; Compiled with |:sign| support. smartindent ; Compiled with 'smartindent' support. sniff ; Compiled with SNiFF interface support. statusline ; Compiled with |--startuptime| support. sun_workshop ; Compiled with support for Sun |workshop|. spell ; Compiled with spell checking support |spell|. syntax ; Compiled with syntax highlighting support |syntax|. syntax_items ; There are active syntax highlighting items for the current buffer. system ; Compiled to use system() instead of fork()/exec(). tag_binary ; Compiled with binary searching in tags files |tag-binary-search|. tag_old_static ; Compiled with support for old static tags |tag-old-static|. tag_any_white ; Compiled with support for any white characters in tags files |tag-any-white|. tcl ; Compiled with Tcl interface. terminfo ; Compiled with terminfo instead of termcap. termresponse ; Compiled with support for |t_RV| and |v:termresponse|. textobjects ; Compiled with support for |text-objects|. tgetent ; Compiled with tgetent support, able to use a termcap or terminfo file. title ; Compiled with window title support |'title'|. toolbar ; Compiled with support for |gui-toolbar|. unix ; Unix version of Vim. user_commands ; User-defined commands. viminfo ; Compiled with viminfo support. vim_starting ; True while initial source'ing takes place. vertsplit ; Compiled with vertically split windows |:vsplit|. virtualedit ; Compiled with 'virtualedit' option. visual ; Compiled with Visual mode. visualextra ; Compiled with extra Visual mode commands. vms ; VMS version of Vim. vreplace ; Compiled with |gR| and |gr| commands. wildignore ; Compiled with 'wildignore' option. wildmenu ; Compiled with 'wildmenu' option. windows ; Compiled with support for more than one window. winaltkeys ; Compiled with 'winaltkeys' option. win16 ; Win16 version of Vim (MS-Windows 3.1). win32 ; Win32 version of Vim (MS-Windows 95/98/ME/NT/2000/XP). win64 ; Win64 version of Vim (MS-Windows 64 bit). win32unix ; Win32 version of Vim, using Unix files (Cygwin) win95 ; Win32 version for MS-Windows 95/98/ME. writebackup ; Compiled with 'writebackup' default on. xfontset ; Compiled with X fontset support |xfontset|. xim ; Compiled with X input method support |xim|. xsmp ; Compiled with X session management support. xsmp_interact ; Compiled with interactive X session management support. xterm_clipboard ; Compiled with support for xterm clipboard. xterm_save ; Compiled with support for saving and restoring the xterm screen. x11 ; Compiled with X11 support. autoload/neocomplcache/sources/include_complete.vim [[[1 382 "============================================================================= " FILE: include_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 30 Sep 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: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: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', 7) augroup neocomplcache " Caching events autocmd FileType * call s:check_buffer_all() autocmd BufWritePost * call s:check_buffer('') augroup END " 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') "}}} " 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:check_buffer() if neocomplcache#exists_echodoc() call echodoc#register('include_complete', s:doc_dict) endif " Initialize check. call s:check_buffer_all() 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 !has_key(s:include_info, bufnr('%')) || neocomplcache#within_comment() return [] endif let l:keyword_list = [] if len(a:cur_keyword_str) < s:completion_length || \neocomplcache#check_match_filter(a:cur_keyword_str, s:completion_length) for l:include in s:include_info[bufnr('%')].include_files if !bufloaded(l:include) let l:keyword_list += neocomplcache#unpack_dictionary(s:include_cache[l:include]) endif endfor else let l:key = tolower(a:cur_keyword_str[: s:completion_length-1]) for l:include in s:include_info[bufnr('%')].include_files if !bufloaded(l:include) && has_key(s:include_cache[l:include], l:key) let l:keyword_list += s:include_cache[l:include][l:key] endif endfor endif 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 s:include_info[bufnr('%')].include_files if has_key(s:include_cache[l:include], l:key) let l:cache = filter(copy(s:include_cache[l:include][l:key]), 'stridx(v:val.word, ' . string(l:word) . ') == 0') if !empty(l:cache) && has_key(l:cache[0], 'kind') && l:cache[0].kind != '' let l:match = match(neocomplcache#escape_match(l:cache[0].abbr), l:word) if l:match >= 0 let l:ret = [] if l:match > 0 call add(l:ret, { 'text' : l:cache[0].abbr[ : l:match-1] }) endif call add(l:ret, { 'text' : l:word, 'highlight' : 'Identifier' }) call add(l:ret, { 'text' : l:cache[0].abbr[l:match+len(l:word) :] }) if l:match > 0 || len(l:ret[-1].text) > 0 return l:ret endif endif endif endif endfor endfor return [] endfunction"}}} "}}} function! s:check_buffer_all()"{{{ let l:bufnumber = 1 " Check buffer. while l:bufnumber <= bufnr('$') if bufloaded(l:bufnumber) && !has_key(s:include_info, l:bufnumber) call s:check_buffer(bufname(l:bufnumber)) endif let l:bufnumber += 1 endwhile endfunction"}}} function! s:check_buffer(bufname)"{{{ let l:bufname = fnamemodify((a:bufname == '' ? bufname('%') : a:bufname), ':p') let l:bufnumber = bufnr(l:bufname) let s:include_info[l:bufnumber] = {} if (g:neocomplcache_disable_caching_buffer_name_pattern == '' || l:bufname !~ g:neocomplcache_disable_caching_buffer_name_pattern) \&& getbufvar(l:bufnumber, '&readonly') == 0 let l:filetype = getbufvar(l:bufnumber, '&filetype') if l:filetype == '' let l:filetype = 'nothing' endif " Check include. let l:include_files = s:get_buffer_include_files(l:bufnumber) for l:filename in l:include_files if !has_key(s:include_cache, l:filename) " Caching. let s:include_cache[l:filename] = s:load_from_tags(l:filename, l:filetype) endif endfor let s:include_info[l:bufnumber].include_files = l:include_files else let s:include_info[l:bufnumber].include_files = [] endif 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' \ && !neocomplcache#is_win() " 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:load_from_tags(filename, filetype)"{{{ " Initialize include list from tags. let l:keyword_lists = s:load_from_cache(a:filename) if !empty(l:keyword_lists) || getfsize(neocomplcache#cache#encode_name('include_cache', a:filename)) == 0 return l:keyword_lists endif if !executable(g:neocomplcache_ctags_program) return s:load_from_file(a:filename, a:filetype) endif 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'] let l:command = has('win32') || has('win64') ? \printf('%s -f - %s %s', g:neocomplcache_ctags_program, l:args, fnamemodify(a:filename, ':p:.')) : \printf('%s -f /dev/stdout 2>/dev/null %s %s', g:neocomplcache_ctags_program, l:args, fnamemodify(a:filename, ':p:.')) let l:lines = split(neocomplcache#system(l:command), '\n') if !empty(l:lines) " Save ctags file. call neocomplcache#cache#writefile('include_tags', a:filename, l:lines) endif let l:keyword_lists = {} for l:keyword in neocomplcache#cache#load_from_tags('include_cache', a:filename, l:lines, 'I', a:filetype) let l:key = tolower(l:keyword.word[: s: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 call neocomplcache#cache#save_cache('include_cache', a:filename, neocomplcache#unpack_dictionary(l:keyword_lists)) if empty(l:keyword_lists) return s:load_from_file(a:filename, a:filetype) endif return l:keyword_lists endfunction"}}} function! s:load_from_file(filename, filetype)"{{{ " Initialize include list from file. let l:keyword_lists = {} let l:loaded_list = neocomplcache#cache#load_from_file(a:filename, neocomplcache#get_keyword_pattern(), 'I') if len(l:loaded_list) > 300 call neocomplcache#cache#save_cache('include_cache', a:filename, l:loaded_list) endif for l:keyword in l:loaded_list let l:key = tolower(l:keyword.word[: s: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! s:load_from_cache(filename)"{{{ let l:keyword_lists = {} for l:keyword in neocomplcache#cache#load_from_cache('include_cache', a:filename) let l:keyword.dup = 1 let l:key = tolower(l:keyword.word[: s: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"}}} " 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 "}}} " vim: foldmethod=marker 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/vim_complete/functions.dict [[[1 252 abs({expr}) acos({expr}) add({list}, {item}) append({lnum}, {list}) append({lnum}, {string}) argc() argidx() argv() argv({nr}) asin({expr}) atan({expr}) atan2({expr1}, {expr2}) browse({save}, {title}, {initdir}, {default}) browsedir({title}, {initdir}) bufexists({expr}) buflisted({expr}) bufloaded({expr}) bufname({expr}) bufnr({expr}) bufwinnr({expr}) byte2line({byte}) byteidx({expr}, {nr}) call({func}, {arglist} [, {dict}]) ceil({expr}) changenr() char2nr({expr}) cindent({lnum}) clearmatches() col({expr}) complete({startcol}, {matches}) complete_add({expr}) complete_check() confirm({msg} [, {choices} [, {default} [, {type}]]]) copy({expr}) cos({expr}) cosh({expr}) count({list}, {expr} [, {start} [, {ic}]]) cscope_connection([{num} , {dbpath} [, {prepend}]]) cursor({list}) cursor({lnum}, {col} [, {coladd}]) deepcopy({expr}) delete({fname}) did_filetype() diff_filler({lnum}) diff_hlID({lnum}, {col}) empty({expr}) escape({string}, {chars}) eval({string}) eventhandler() executable({expr}) exists({expr}) exp({expr}) expand({expr} [, {flag}]) extend({expr1}, {expr2} [, {expr3}]) feedkeys({string} [, {mode}]) filereadable({file}) filewritable({file}) filter({expr}, {string}) finddir({name}[, {path}[, {count}]]) findfile({name}[, {path}[, {count}]]) float2nr({expr}) floor({expr}) fmod({expr1}, {expr2}) fnameescape({fname}) fnamemodify({fname}, {mods}) foldclosed({lnum}) foldclosedend({lnum}) foldlevel({lnum}) foldtext() foldtextresult({lnum}) foreground() function({name}) garbagecollect([at_exit]) get({dict}, {key} [, {def}]) get({list}, {idx} [, {def}]) getbufline({expr}, {lnum} [, {end}]) getbufvar({expr}, {varname}) getchar([expr]) getcharmod() getcmdline() getcmdpos() getcmdtype() getcwd() getfontname([{name}]) getfperm({fname}) getfsize({fname}) getftime({fname}) getftype({fname}) getline({lnum}) getline({lnum}, {end}) getloclist({nr}) getmatches() getpid() getpos({expr}) getqflist() getreg([{regname} [, 1]]) getregtype([{regname}]) gettabvar({tabnr}, {varname}) gettabwinvar({tabnr}, {winnr}, {name}) getwinposx() getwinposy() getwinvar({nr}, {varname}) glob({expr} [, {flag}]) globpath({path}, {expr} [, {flag}]) has({feature}) has_key({dict}, {key}) haslocaldir() hasmapto({what} [, {mode} [, {abbr}]]) histadd({history},{item}) histdel({history} [, {item}]) histget({history} [, {index}]) histnr({history}) hlID({name}) hlexists({name}) hostname() iconv({expr}, {from}, {to}) indent({lnum}) index({list}, {expr} [, {start} [, {ic}]]) input({prompt} [, {text} [, {completion}]]) inputdialog({p} [, {t} [, {c}]]) inputlist({textlist}) inputrestore() inputsave() inputsecret({prompt} [, {text}]) insert({list}, {item} [, {idx}]) isdirectory({directory}) islocked({expr}) items({dict}) join({list} [, {sep}]) keys({dict}) len({expr}) libcall({lib}, {func}, {arg}) libcallnr({lib}, {func}, {arg}) line({expr}) line2byte({lnum}) lispindent({lnum}) localtime() log({expr}) log10({expr}) map({expr}, {string}) maparg({name}[, {mode} [, {abbr}]]) mapcheck({name}[, {mode} [, {abbr}]]) match({expr}, {pat}[, {start}[, {count}]]) matchadd({group}, {pattern}[, {priority}[, {id}]]) matcharg({nr}) matchdelete({id}) matchend({expr}, {pat}[, {start}[, {count}]]) matchlist({expr}, {pat}[, {start}[, {count}]]) matchstr({expr}, {pat}[, {start}[, {count}]]) max({list}) min({list}) mkdir({name} [, {path} [, {prot}]]) mode([expr]) nextnonblank({lnum}) nr2char({expr}) pathshorten({expr}) pow({x}, {y}) prevnonblank({lnum}) printf({fmt}, {expr1}...) pumvisible() range({expr} [, {max} [, {stride}]]) readfile({fname} [, {binary} [, {max}]]) reltime([{start} [, {end}]]) reltimestr({time}) remote_expr({server}, {string} [, {idvar}]) remote_foreground({server}) remote_peek({serverid} [, {retvar}]) remote_read({serverid}) remote_send({server}, {string} [, {idvar}]) remove({dict}, {key}) remove({list}, {idx} [, {end}]) rename({from}, {to}) repeat({expr}, {count}) resolve({filename}) reverse({list}) round({expr}) search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) searchdecl({name} [, {global} [, {thisblock}]]) searchpair({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) searchpairpos({start}, {middle}, {end} [, {flags} [, {skip} [...]]]) searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) server2client({clientid}, {string}) serverlist() setbufvar({expr}, {varname}, {val}) setcmdpos({pos}) setline({lnum}, {line}) setloclist({nr}, {list}[, {action}]) setmatches({list}) setpos({expr}, {list}) setqflist({list}[, {action}]) setreg({n}, {v}[, {opt}]) settabvar({tabnr}, {varname}, {val}) settabwinvar({tabnr}, {winnr}, {varname}, {val}) setwinvar({nr}, {varname}, {val}) shellescape({string} [, {special}]) simplify({filename}) sin({expr}) sinh({expr}) sort({list} [, {func}]) soundfold({word}) spellbadword() spellsuggest({word} [, {max} [, {capital}]]) split({expr} [, {pat} [, {keepempty}]]) sqrt({expr}) str2float({expr}) str2nr({expr} [, {base}]) strchars({expr}) strdisplaywidth({expr}[, {col}]) strftime({format}[, {time}]) stridx({haystack}, {needle}[, {start}]) string({expr}) strlen({expr}) strpart({src}, {start}[, {len}]) strridx({haystack}, {needle} [, {start}]) strtrans({expr}) strwidth({expr}) submatch({nr}) substitute({expr}, {pat}, {sub}, {flags}) synID({lnum}, {col}, {trans}) synIDattr({synID}, {what} [, {mode}]) synIDtrans({synID}) synconcealed({lnum}, {col}) synstack({lnum}, {col}) system({expr} [, {input}]) tabpagebuflist([{arg}]) tabpagenr([{arg}]) tabpagewinnr({tabarg}[, {arg}]) tagfiles() taglist({expr}) tan({expr}) tanh({expr}) tempname() tolower({expr}) toupper({expr}) tr({src}, {fromstr}, {tostr}) trunc({expr} type({name}) undofile({name}) undotree() values({dict}) virtcol({expr}) visualmode([expr]) winbufnr({nr}) wincol() winheight({nr}) winline() winnr([{expr}]) winrestcmd() winrestview({dict}) winsaveview() winwidth({nr}) writefile({list}, {fname} [, {binary}]) autoload/neocomplcache/sources/keyword_complete.vim [[[1 95 "============================================================================= " FILE: keyword_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 20 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:source = { \ 'name' : 'keyword_complete', \ 'kind' : 'complfunc', \} function! s:source.initialize()"{{{ " Set rank. call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'keyword_complete', 5) " Set completion length. call neocomplcache#set_completion_length('keyword_complete', 0) " 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) " 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"}}} " vim: foldmethod=marker autoload/neocomplcache/sources/snippets_complete/rails.snip [[[1 167 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 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/vim_complete/helper.vim [[[1 994 "============================================================================= " FILE: helper.vim " AUTHOR: Shougo Matsushita " Last Modified: 23 Oct 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. " }}} "============================================================================= if !exists('s:internal_candidates_list') let s:internal_candidates_list = {} let s:global_candidates_list = { 'dictionary_variables' : {} } let s:script_candidates_list = {} let s:local_candidates_list = {} endif function! neocomplcache#sources#vim_complete#helper#on_filetype()"{{{ " Caching script candidates. let l:bufnumber = 1 " Check buffer. while l:bufnumber <= bufnr('$') if getbufvar(l:bufnumber, '&filetype') == 'vim' && bufloaded(l:bufnumber) \&& !has_key(s:script_candidates_list, l:bufnumber) let s:script_candidates_list[l:bufnumber] = s:get_script_candidates(l:bufnumber) endif let l:bufnumber += 1 endwhile if neocomplcache#exists_echodoc() call echodoc#register('vim_complete', s:doc_dict) endif endfunction"}}} function! neocomplcache#sources#vim_complete#helper#recaching(bufname)"{{{ " Caching script candidates. let l:bufnumber = a:bufname != '' ? bufnr(a:bufname) : bufnr('%') if getbufvar(l:bufnumber, '&filetype') == 'vim' && bufloaded(l:bufnumber) let s:script_candidates_list[l:bufnumber] = s:get_script_candidates(l:bufnumber) endif let s:global_candidates_list = { 'dictionary_variables' : {} } endfunction"}}} " For echodoc."{{{ let s:doc_dict = { \ 'name' : 'vim_complete', \ 'rank' : 10, \ 'filetypes' : { 'vim' : 1 }, \ } function! s:doc_dict.search(cur_text)"{{{ let l:cur_text = neocomplcache#sources#vim_complete#get_cur_text() " Echo prototype. let l:script_candidates_list = s:get_cached_script_candidates() let l:prototype_name = matchstr(l:cur_text, \'\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\s*(\ze\%([^(]\|(.\{-})\)*$') let l:ret = [] if l:prototype_name != '' if !has_key(s:internal_candidates_list, 'function_prototypes') " No cache. return [] endif " Search function name. call add(l:ret, { 'text' : l:prototype_name, 'highlight' : 'Identifier' }) if has_key(s:internal_candidates_list.function_prototypes, l:prototype_name) call add(l:ret, { 'text' : s:internal_candidates_list.function_prototypes[l:prototype_name] }) elseif has_key(s:global_candidates_list.function_prototypes, l:prototype_name) call add(l:ret, { 'text' : s:global_candidates_list.function_prototypes[l:prototype_name] }) elseif has_key(l:script_candidates_list.function_prototypes, l:prototype_name) call add(l:ret, { 'text' : l:script_candidates_list.function_prototypes[l:prototype_name] }) else " No prototypes. return [] endif else if !has_key(s:internal_candidates_list, 'command_prototypes') " No cache. return [] endif " Search command name. " Skip head digits. let l:prototype_name = neocomplcache#sources#vim_complete#get_command(l:cur_text) call add(l:ret, { 'text' : l:prototype_name, 'highlight' : 'Statement' }) if has_key(s:internal_candidates_list.command_prototypes, l:prototype_name) call add(l:ret, { 'text' : s:internal_candidates_list.command_prototypes[l:prototype_name] }) elseif has_key(s:global_candidates_list.command_prototypes, l:prototype_name) call add(l:ret, { 'text' : s:global_candidates_list.command_prototypes[l:prototype_name] }) else " No prototypes. return [] endif endif return l:ret endfunction"}}} "}}} function! neocomplcache#sources#vim_complete#helper#get_command_completion(command_name, cur_text, cur_keyword_str)"{{{ let l:completion_name = neocomplcache#sources#vim_complete#helper#get_completion_name(a:command_name) if l:completion_name == '' " Not found. return [] endif let l:args = (l:completion_name ==# 'custom' || l:completion_name ==# 'customlist')? \ [a:command_name, a:cur_text, a:cur_keyword_str] : [a:cur_text, a:cur_keyword_str] return call('neocomplcache#sources#vim_complete#helper#'.l:completion_name, l:args) endfunction"}}} function! neocomplcache#sources#vim_complete#helper#get_completion_name(command_name)"{{{ if !has_key(s:internal_candidates_list, 'command_completions') let s:internal_candidates_list.command_completions = s:caching_completion_from_dict('command_completions') endif if !has_key(s:global_candidates_list, 'command_completions') let s:global_candidates_list.commands = s:get_cmdlist() endif if has_key(s:internal_candidates_list.command_completions, a:command_name) \&& exists('*neocomplcache#sources#vim_complete#helper#'.s:internal_candidates_list.command_completions[a:command_name]) return s:internal_candidates_list.command_completions[a:command_name] elseif has_key(s:global_candidates_list.command_completions, a:command_name) \&& exists('*neocomplcache#sources#vim_complete#helper#'.s:global_candidates_list.command_completions[a:command_name]) return s:global_candidates_list.command_completions[a:command_name] else return '' endif endfunction"}}} function! neocomplcache#sources#vim_complete#helper#autocmd_args(cur_text, cur_keyword_str)"{{{ " Caching. if !has_key(s:global_candidates_list, 'augroups') let s:global_candidates_list.augroups = s:get_augrouplist() endif if !has_key(s:internal_candidates_list, 'autocmds') let s:internal_candidates_list.autocmds = s:caching_from_dict('autocmds', '') endif return s:internal_candidates_list.autocmds + s:global_candidates_list.augroups endfunction"}}} function! neocomplcache#sources#vim_complete#helper#augroup(cur_text, cur_keyword_str)"{{{ " Caching. if !has_key(s:global_candidates_list, 'augroups') let s:global_candidates_list.augroups = s:get_augrouplist() endif return s:global_candidates_list.augroups endfunction"}}} function! neocomplcache#sources#vim_complete#helper#buffer(cur_text, cur_keyword_str)"{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#colorscheme_args(cur_text, cur_keyword_str)"{{{ return s:make_completion_list(filter(map(split(globpath(&runtimepath, 'colors/*.vim'), '\n'), \'fnamemodify(v:val, ":t:r")'), 'stridx(v:val, a:cur_keyword_str) == 0'), '[vim] colorscheme', '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#command(cur_text, cur_keyword_str)"{{{ " Caching. if !has_key(s:global_candidates_list, 'commands') let s:global_candidates_list.commands = s:get_cmdlist() endif if !has_key(s:internal_candidates_list, 'commands') let s:internal_candidates_list.commands = s:caching_from_dict('commands', 'c') let s:internal_candidates_list.command_prototypes = s:caching_prototype_from_dict('command_prototypes') endif let l:list = s:internal_candidates_list.commands + s:global_candidates_list.commands if bufname('%') !=# '[Command Line]' let l:list = neocomplcache#keyword_filter(l:list, a:cur_keyword_str) endif if a:cur_keyword_str =~# '^en\%[d]' let l:list += s:get_endlist() endif return l:list endfunction"}}} function! neocomplcache#sources#vim_complete#helper#command_args(cur_text, cur_keyword_str)"{{{ " Caching. if !has_key(s:internal_candidates_list, 'command_args') let s:internal_candidates_list.command_args = s:caching_from_dict('command_args', '') let s:internal_candidates_list.command_replaces = s:caching_from_dict('command_replaces', '') endif return s:internal_candidates_list.command_args + s:internal_candidates_list.command_replaces endfunction"}}} function! neocomplcache#sources#vim_complete#helper#custom(command_name, cur_text, cur_keyword_str)"{{{ if !has_key(g:neocomplcache_vim_completefuncs, a:command_name) return [] endif return s:make_completion_list(split(call(g:neocomplcache_vim_completefuncs[a:command_name], \ [a:cur_keyword_str, getline('.'), len(a:cur_text)]), '\n'), '[vim] custom', '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#customlist(command_name, cur_text, cur_keyword_str)"{{{ if !has_key(g:neocomplcache_vim_completefuncs, a:command_name) return [] endif return s:make_completion_list(call(g:neocomplcache_vim_completefuncs[a:command_name], \ [a:cur_keyword_str, getline('.'), len(a:cur_text)]), '[vim] customlist', '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#dir(cur_text, cur_keyword_str)"{{{ " Check dup. let l:check = {} for keyword in filter(split(substitute(globpath(&cdpath, a:cur_keyword_str . '*'), '\\', '/', 'g'), '\n'), 'isdirectory(v:val)') if !has_key(l:check, keyword) && keyword =~ '/' let l:check[keyword] = keyword endif endfor let l:ret = [] let l:paths = map(split(&cdpath, ','), 'substitute(v:val, "\\\\", "/", "g")') for keyword in keys(l:check) let l:dict = { 'word' : escape(keyword, ' *?[]"={}'), 'abbr' : keyword.'/', 'menu' : '[vim] directory', } " Path search. for path in l:paths if path != '' && neocomplcache#head_match(l:dict.word, path . '/') let l:dict.word = l:dict.word[len(path)+1 : ] break endif endfor call add(l:ret, l:dict) endfor return l:ret endfunction"}}} function! neocomplcache#sources#vim_complete#helper#environment(cur_text, cur_keyword_str)"{{{ " Caching. if !has_key(s:global_candidates_list, 'environments') let s:global_candidates_list.environments = s:get_envlist() endif return s:global_candidates_list.environments endfunction"}}} function! neocomplcache#sources#vim_complete#helper#event(cur_text, cur_keyword_str)"{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#expression(cur_text, cur_keyword_str)"{{{ return neocomplcache#sources#vim_complete#helper#function(a:cur_text, a:cur_keyword_str) \+ neocomplcache#sources#vim_complete#helper#var(a:cur_text, a:cur_keyword_str) endfunction"}}} function! neocomplcache#sources#vim_complete#helper#feature(cur_text, cur_keyword_str)"{{{ if !has_key(s:internal_candidates_list, 'features') let s:internal_candidates_list.features = s:caching_from_dict('features', '') endif return s:internal_candidates_list.features endfunction"}}} function! neocomplcache#sources#vim_complete#helper#file(cur_text, cur_keyword_str)"{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#filetype(cur_text, cur_keyword_str)"{{{ return s:make_completion_list(filter(map(split(globpath(&runtimepath, 'syntax/*.vim'), '\n'), \'fnamemodify(v:val, ":t:r")'), 'stridx(v:val, a:cur_keyword_str) == 0'), '[vim] filetype', '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#function(cur_text, cur_keyword_str)"{{{ " Caching. if !has_key(s:global_candidates_list, 'functions') let s:global_candidates_list.functions = s:get_functionlist() endif if !has_key(s:internal_candidates_list, 'functions') let l:dict = {} for l:function in s:caching_from_dict('functions', 'f') let l:dict[l:function.word] = l:function endfor let s:internal_candidates_list.functions = l:dict let l:function_prototypes = {} for function in values(s:internal_candidates_list.functions) let l:function_prototypes[function.word] = function.abbr endfor let s:internal_candidates_list.function_prototypes = s:caching_prototype_from_dict('functions') endif let l:script_candidates_list = s:get_cached_script_candidates() if a:cur_keyword_str =~ '^s:' let l:list = values(l:script_candidates_list.functions) elseif a:cur_keyword_str =~ '^\a:' let l:functions = deepcopy(values(l:script_candidates_list.functions)) for l:keyword in l:functions let l:keyword.word = '' . l:keyword.word[2:] let l:keyword.abbr = '' . l:keyword.abbr[2:] endfor let l:list = l:functions else let l:list = values(s:internal_candidates_list.functions) + values(s:global_candidates_list.functions) endif return l:list endfunction"}}} function! neocomplcache#sources#vim_complete#helper#help(cur_text, cur_keyword_str)"{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#highlight(cur_text, cur_keyword_str)"{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#let(cur_text, cur_keyword_str)"{{{ if a:cur_text !~ '=' return neocomplcache#sources#vim_complete#helper#var(a:cur_text, a:cur_keyword_str) elseif a:cur_text =~# '\', '', '', '', '', '', '', ''], \ '[vim] expand', '') endfunction"}}} function! s:get_local_variables()"{{{ " Get local variable list. let l:keyword_dict = {} " Search function. let l:line_num = line('.') - 1 let l:end_line = (line('.') > 100) ? line('.') - 100 : 1 while l:line_num >= l:end_line let l:line = getline(l:line_num) if l:line =~ '\' break elseif l:line =~ '\ 100) ? line('.') - 100 : 1 while l:line_num >= l:end_line let l:line = getline(l:line_num) if l:line =~ '\' break endif let l:line_num -= 1 endwhile let l:line_num += 1 let l:end_line = line('.') - 1 let l:keyword_dict = {} let l:var_pattern = a:var_name.'\.\h\w*\%(()\?\)\?' while l:line_num <= l:end_line let l:line = getline(l:line_num) if l:line =~ l:var_pattern while l:line =~ l:var_pattern let l:var_name = matchstr(l:line, '\a:[[:alnum:]_:]*\ze\.\h\w*') if l:var_name =~ '^[btwg]:' let l:candidates = s:global_candidates_list.dictionary_variables if !has_key(l:candidates, l:var_name) let l:candidates[l:var_name] = {} endif let l:candidates_dict = l:candidates[l:var_name] elseif l:var_name =~ '^s:' && has_key(s:script_candidates_list, bufnr('%')) let l:candidates = s:script_candidates_list[bufnr('%')].dictionary_variables if !has_key(l:candidates, l:var_name) let l:candidates[l:var_name] = {} endif let l:candidates_dict = l:candidates[l:var_name] else let l:candidates_dict = l:keyword_dict endif call s:analyze_dictionary_variable_line(l:line, l:candidates_dict, l:var_name) let l:line = l:line[matchend(l:line, l:var_pattern) :] endwhile endif let l:line_num += 1 endwhile return values(l:keyword_dict) endfunction"}}} function! s:get_cached_script_candidates()"{{{ return has_key(s:script_candidates_list, bufnr('%')) && v:version > 700 ? \ s:script_candidates_list[bufnr('%')] : { \ 'functions' : {}, 'variables' : {}, 'function_prototypes' : {}, 'dictionary_variables' : {} } endfunction"}}} function! s:get_script_candidates(bufnumber)"{{{ " Get script candidate list. let l:function_dict = {} let l:variable_dict = {} let l:dictionary_variable_dict = {} let l:function_prototypes = {} let l:var_pattern = '\a:[[:alnum:]_:]*\.\h\w*\%(()\?\)\?' for l:line in getbufline(a:bufnumber, 1, '$') if l:line =~ '\\?\|\h[[:alnum:]_:#\[]*\%([!\]]\+\|()\?\)\?\)' let l:keyword_list = [] for line in readfile(l:dict_files[0]) call add(l:keyword_list, { \ 'word' : substitute(matchstr(line, l:keyword_pattern), '[\[\]]', '', 'g'), \ 'menu' : l:menu_pattern, 'kind' : a:kind, 'abbr' : l:line \}) endfor return l:keyword_list endfunction"}}} function! s:caching_completion_from_dict(dict_name)"{{{ let l:dict_files = split(globpath(&runtimepath, 'autoload/neocomplcache/sources/vim_complete/'.a:dict_name.'.dict'), '\n') if empty(l:dict_files) return {} endif let l:keyword_dict = {} for l:line in readfile(l:dict_files[0]) let l:word = matchstr(l:line, '^[[:alnum:]_\[\]]\+') let l:completion = matchstr(l:line[len(l:word):], '\h\w*') if l:completion != '' if l:word =~ '\[' let [l:word_head, l:word_tail] = split(l:word, '\[') let l:word_tail = ' ' . substitute(l:word_tail, '\]', '', '') else let l:word_head = l:word let l:word_tail = ' ' endif for i in range(len(l:word_tail)) let l:keyword_dict[l:word_head . l:word_tail[1:i]] = l:completion endfor endif endfor return l:keyword_dict endfunction"}}} function! s:caching_prototype_from_dict(dict_name)"{{{ let l:dict_files = split(globpath(&runtimepath, 'autoload/neocomplcache/sources/vim_complete/'.a:dict_name.'.dict'), '\n') if empty(l:dict_files) return {} endif if a:dict_name == 'functions' let l:pattern = '^[[:alnum:]_]\+(' else let l:pattern = '^[[:alnum:]_\[\](]\+' endif let l:keyword_dict = {} for l:line in readfile(l:dict_files[0]) let l:word = matchstr(l:line, l:pattern) let l:rest = l:line[len(l:word):] if l:word =~ '\[' let [l:word_head, l:word_tail] = split(l:word, '\[') let l:word_tail = ' ' . substitute(l:word_tail, '\]', '', '') else let l:word_head = l:word let l:word_tail = ' ' endif for i in range(len(l:word_tail)) let l:keyword_dict[l:word_head . l:word_tail[1:i]] = l:rest endfor endfor return l:keyword_dict endfunction"}}} function! s:get_cmdlist()"{{{ " Get command list. redir => l:redir silent! command redir END let l:keyword_list = [] let l:completions = [ 'augroup', 'buffer', 'command', 'dir', 'environment', \ 'event', 'expression', 'file', 'shellcmd', 'function', \ 'help', 'highlight', 'mapping', 'menu', 'option', 'tag', 'tag_listfiles', \ 'var', 'custom', 'customlist' ] let l:command_prototypes = {} let l:command_completions = {} let l:menu_pattern = '[vim] command' for line in split(l:redir, '\n')[1:] let l:word = matchstr(line, '\a\w*') " Analyze prototype. let l:end = matchend(line, '\a\w*') let l:args = matchstr(line, '[[:digit:]?+*]', l:end) if l:args != '0' let l:prototype = matchstr(line, '\a\w*', l:end) let l:found = 0 for l:comp in l:completions if l:comp == l:prototype let l:command_completions[l:word] = l:prototype let l:found = 1 break endif endfor if !l:found let l:prototype = 'arg' endif if l:args == '*' let l:prototype = '[' . l:prototype . '] ...' elseif l:args == '?' let l:prototype = '[' . l:prototype . ']' elseif l:args == '+' let l:prototype = l:prototype . ' ...' endif let l:command_prototypes[l:word] = ' ' . repeat(' ', 16 - len(l:word)) . l:prototype else let l:command_prototypes[l:word] = '' endif let l:prototype = l:command_prototypes[l:word] call add(l:keyword_list, { \ 'word' : l:word, 'abbr' : l:word . l:prototype, 'menu' : l:menu_pattern, 'kind' : 'c' \}) endfor let s:global_candidates_list.command_prototypes = l:command_prototypes let s:global_candidates_list.command_completions = l:command_completions return l:keyword_list endfunction"}}} function! s:get_variablelist()"{{{ " Get variable list. redir => l:redir silent! let redir END let l:keyword_list = [] let l:menu_pattern = '[vim] variable' let l:kind_dict = ['0', '""', '()', '[]', '{}', '.'] for line in split(l:redir, '\n') let l:word = matchstr(line, '^\a[[:alnum:]_:]*') if l:word !~ '^\a:' let l:word = 'g:' . l:word elseif l:word =~ '[^gv]:' continue endif call add(l:keyword_list, { \ 'word' : l:word, 'menu' : l:menu_pattern, \ 'kind' : exists(l:word)? l:kind_dict[type(eval(l:word))] : '' \}) endfor return l:keyword_list endfunction"}}} function! s:get_functionlist()"{{{ " Get function list. redir => l:redir silent! function redir END let l:keyword_dict = {} let l:function_prototypes = {} let l:menu_pattern = '[vim] function' for l:line in split(l:redir, '\n') let l:line = l:line[9:] if l:line =~ '^' continue endif let l:orig_line = l:line let l:word = matchstr(l:line, '\h[[:alnum:]_:#.]*()\?') if l:word != '' let l:keyword_dict[l:word] = { \ 'word' : l:word, 'abbr' : l:line, 'menu' : l:menu_pattern, \} let l:function_prototypes[l:word] = l:orig_line[len(l:word):] endif endfor let s:global_candidates_list.function_prototypes = l:function_prototypes return l:keyword_dict endfunction"}}} function! s:get_augrouplist()"{{{ " Get function list. redir => l:redir silent! augroup redir END let l:keyword_list = [] let l:menu_pattern = '[vim] augroup' for l:group in split(l:redir . ' END', '\s') call add(l:keyword_list, { 'word' : l:group, 'menu' : l:menu_pattern}) endfor return l:keyword_list endfunction"}}} function! s:get_mappinglist()"{{{ " Get function list. redir => l:redir silent! map redir END let l:keyword_list = [] let l:menu_pattern = '[vim] mapping' for line in split(l:redir, '\n') let l:map = matchstr(line, '^\a*\s*\zs\S\+') if l:map !~ '^<' || l:map =~ '^' continue endif call add(l:keyword_list, { 'word' : l:map, 'menu' : l:menu_pattern }) endfor return l:keyword_list endfunction"}}} function! s:get_envlist()"{{{ " Get environment variable list. let l:keyword_list = [] let l:menu_pattern = '[vim] environment' for line in split(system('set'), '\n') let l:word = '$' . toupper(matchstr(line, '^\h\w*')) call add(l:keyword_list, { 'word' : l:word, 'menu' : l:menu_pattern, 'kind' : 'e' }) endfor return l:keyword_list endfunction"}}} function! s:get_endlist()"{{{ " Get end command list. let l:keyword_dict = {} let l:menu_pattern = '[vim] end' let l:line_num = line('.') - 1 let l:end_line = (line('.') < 100) ? line('.') - 100 : 1 let l:cnt = { \ 'endfor' : 0, 'endfunction' : 0, 'endtry' : 0, \ 'endwhile' : 0, 'endif' : 0 \} let l:word = '' while l:line_num >= l:end_line let l:line = getline(l:line_num) if l:line =~ '\' let l:cnt['endfor'] -= 1 elseif l:line =~ '\' let l:cnt['endfunction'] -= 1 elseif l:line =~ '\' let l:cnt['endtry'] -= 1 elseif l:line =~ '\' let l:cnt['endwhile'] -= 1 elseif l:line =~ '\' let l:cnt['endif'] -= 1 elseif l:line =~ '\' let l:cnt['endfor'] += 1 if l:cnt['endfor'] > 0 let l:word = 'endfor' break endif elseif l:line =~ '\ 0 let l:word = 'endfunction' endif break elseif l:line =~ '\' let l:cnt['endtry'] += 1 if l:cnt['endtry'] > 0 let l:word = 'endtry' break endif elseif l:line =~ '\' let l:cnt['endwhile'] += 1 if l:cnt['endwhile'] > 0 let l:word = 'endwhile' break endif elseif l:line =~ '\' let l:cnt['endif'] += 1 if l:cnt['endif'] > 0 let l:word = 'endif' break endif endif let l:line_num -= 1 endwhile return (l:word == '')? [] : [{'word' : l:word, 'menu' : l:menu_pattern, 'kind' : 'c'}] endfunction"}}} function! s:make_completion_list(list, menu_pattern, kind)"{{{ let l:list = [] for l:item in a:list call add(l:list, { 'word' : l:item, 'menu' : a:menu_pattern, 'kind' : a:kind }) endfor return l:list endfunction"}}} function! s:analyze_function_line(line, keyword_dict, prototype)"{{{ let l:menu_pattern = '[vim] function' " Get script function. let l:line = substitute(matchstr(a:line, '\ " Last Modified: 06 Oct 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: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 "if has('ruby') "try "ruby 1 "call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'ruby', "\'[^. *\t]\.\h\w*\|\h\w*::') "catch "endtry "endif if has('python') try python 1 call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns, 'python', \'[^. \t]\.\w*') catch endtry 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\+\|\%(\h\w*\|)\)\%(\.\|->\)\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*$') "}}} " 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) " Set completion length. call neocomplcache#set_completion_length('omni_complete', 0) 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)"{{{ 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:filetype == 'ruby' && 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:filetype == 'ruby')? '' : l:cur_keyword_str]) if l:filetype == 'ruby' && 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"}}} " vim: foldmethod=marker 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/vim_complete/mappings.dict [[[1 53 ; the mapping will be effective in the current buffer only ; the argument is an expression evaluated to obtain the {rhs} that is used ; define a mapping which uses the "mapleader" variable ; just like , except that it uses "maplocalleader" instead of "mapleader" ; used for an internal mapping, which is not to be matched with any key sequence ${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