Repository: Shougo/neocomplcache Branch: master Commit: f8c1de81908e Files: 58 Total size: 461.7 KB Directory structure: gitextract_6vmgprjt/ ├── .gitignore ├── README.md ├── autoload/ │ ├── neocomplcache/ │ │ ├── async_cache.vim │ │ ├── cache.vim │ │ ├── commands.vim │ │ ├── complete.vim │ │ ├── context_filetype.vim │ │ ├── filters/ │ │ │ ├── converter_abbr.vim │ │ │ ├── converter_case.vim │ │ │ ├── converter_delimiter.vim │ │ │ ├── converter_nothing.vim │ │ │ ├── converter_remove_next_keyword.vim │ │ │ ├── matcher_fuzzy.vim │ │ │ ├── matcher_head.vim │ │ │ ├── matcher_old.vim │ │ │ ├── sorter_length.vim │ │ │ ├── sorter_nothing.vim │ │ │ └── sorter_rank.vim │ │ ├── filters.vim │ │ ├── handler.vim │ │ ├── helper.vim │ │ ├── init.vim │ │ ├── mappings.vim │ │ ├── sources/ │ │ │ ├── buffer_complete.vim │ │ │ ├── dictionary_complete.vim │ │ │ ├── filename_complete.vim │ │ │ ├── filename_include.vim │ │ │ ├── include_complete.vim │ │ │ ├── member_complete.vim │ │ │ ├── omni_complete.vim │ │ │ ├── syntax_complete.vim │ │ │ ├── tags_complete.vim │ │ │ ├── vim_complete/ │ │ │ │ ├── autocmds.dict │ │ │ │ ├── command_args.dict │ │ │ │ ├── command_completions.dict │ │ │ │ ├── command_prototypes.dict │ │ │ │ ├── command_replaces.dict │ │ │ │ ├── commands.dict │ │ │ │ ├── features.dict │ │ │ │ ├── functions.dict │ │ │ │ ├── helper.vim │ │ │ │ ├── mappings.dict │ │ │ │ ├── options.dict │ │ │ │ └── variables.dict │ │ │ └── vim_complete.vim │ │ ├── util.vim │ │ └── variables.vim │ ├── neocomplcache.vim │ └── unite/ │ └── sources/ │ ├── file_include.vim │ └── neocomplcache.vim ├── doc/ │ └── neocomplcache.txt ├── plugin/ │ ├── neocomplcache/ │ │ ├── buffer_complete.vim │ │ ├── dictionary_complete.vim │ │ ├── include_complete.vim │ │ ├── syntax_complete.vim │ │ └── tags_complete.vim │ └── neocomplcache.vim └── vest/ └── test-neocomplcache.vim ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ doc/tags* *.swp ================================================ FILE: README.md ================================================ **neocomplcache** ================= **Note**: The development of this plugin is finished. Accepts minor patches and issues but no new features. [ddc.vim](https://github.com/Shougo/ddc.vim) is the next generation auto completion plugin. Consider migrating to it. Description ----------- neocomplcache is the abbreviation of "neo-completion with cache". It provides keyword completion system by maintaining a cache of keywords in the current buffer. neocomplcache could be customized easily and has a lot more features than the Vim's standard completion feature. If you use Vim 7.3.885 or above with if\_lua feature, you should use neocomplete. It is faster than neocomplcache. https://github.com/Shougo/neocomplete.vim Installation ============ * Extract the file and put files in your Vim directory (usually ~/.vim/ or Program Files/Vim/vimfiles on Windows). * Execute `|:NeoComplCacheEnable|` command or `let g:neocomplcache_enable_at_startup = 1` in your `.vimrc`. Not in `.gvimrc`(`_gvimrc`)! Caution ------- Because all variable names were changed in neocomplcache Ver.5, it is not backwards compatible. If you want to upgrade, you should use the following script from Mr.thinca. http://gist.github.com/422503 Snippets feature(snippets\_complete source) was split from Ver.7. If you used it, please install neosnippet source manually. https://github.com/Shougo/neosnippet Screen shots ============ Original filename completion. ----------- ![Original filename completion.](http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1O5_bOQ2I/AAAAAAAAADE/vHf9Xg_mrTI/s1600/filename_complete.png) Omni completion. ---------------- ![Omni completion.](http://2.bp.blogspot.com/_ci2yBnqzJgM/TD1PTolkTBI/AAAAAAAAADU/knJ3eniuHWI/s1600/omni_complete.png) Completion with vimshell(http://github.com/Shougo/vimshell). ------------------------------------------------------------ ![Completion with vimshell(http://github.com/Shougo/vimshell).](http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1PLfdQrwI/AAAAAAAAADM/2pSFRTHwYOY/s1600/neocomplcache_with_vimshell.png) Vim completion ------------------------------------------------------------ ![Vim completion.](http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1PfKTlwnI/AAAAAAAAADs/nOGWTRLuae8/s1600/vim_complete.png) Setting examples ```vim "Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)! " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Enable heavy features. " Use camel case completion. "let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion. "let g:neocomplcache_enable_underbar_completion = 1 " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword. if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif let g:neocomplcache_keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. inoremap neocomplcache#undo_completion() inoremap neocomplcache#complete_common_string() " Recommended key-mappings. " : close popup and save indent. inoremap =my_cr_function() function! s:my_cr_function() return neocomplcache#smart_close_popup() . "\" " For no inserting key. "return pumvisible() ? neocomplcache#close_popup() : "\" endfunction " : completion. inoremap pumvisible() ? "\" : "\" " , : close popup and delete backword char. inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#close_popup() inoremap neocomplcache#cancel_popup() " Close popup by . "inoremap pumvisible() ? neocomplcache#close_popup() : "\" " For cursor moving in insert mode(Not recommended) "inoremap neocomplcache#close_popup() . "\" "inoremap neocomplcache#close_popup() . "\" "inoremap neocomplcache#close_popup() . "\" "inoremap neocomplcache#close_popup() . "\" " Or set this. "let g:neocomplcache_enable_cursor_hold_i = 1 " Or set this. "let g:neocomplcache_enable_insert_char_pre = 1 " AutoComplPop like behavior. "let g:neocomplcache_enable_auto_select = 1 " Shell like behavior(not recommended). "set completeopt+=longest "let g:neocomplcache_enable_auto_select = 1 "let g:neocomplcache_disable_auto_complete = 1 "inoremap pumvisible() ? "\" : "\\" " Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " Enable heavy omni completion. if !exists('g:neocomplcache_force_omni_patterns') let g:neocomplcache_force_omni_patterns = {} endif let g:neocomplcache_force_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::' let g:neocomplcache_force_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)' let g:neocomplcache_force_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' " For perlomni.vim setting. " https://github.com/c9s/perlomni.vim let g:neocomplcache_force_omni_patterns.perl = '\h\w*->\h\w*\|\h\w*::' ``` ================================================ FILE: autoload/neocomplcache/async_cache.vim ================================================ "============================================================================= " FILE: async_cache.vim " AUTHOR: Shougo Matsushita " Last Modified: 16 Jul 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following condition " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! s:main(argv) "{{{ " args: funcname, outputname filename pattern_file_name mark minlen maxfilename let [funcname, outputname, filename, pattern_file_name, mark, minlen, maxfilename, fileencoding] \ = a:argv if funcname ==# 'load_from_file' let keyword_list = s:load_from_file( \ filename, pattern_file_name, mark, minlen, maxfilename, fileencoding, 1) else let keyword_list = s:load_from_tags( \ filename, pattern_file_name, mark, minlen, maxfilename, fileencoding) endif if empty(keyword_list) return endif " Output cache. call writefile([string(keyword_list)], outputname) endfunction"}}} function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding, is_string) "{{{ if !filereadable(a:filename) || !filereadable(a:pattern_file_name) " File not found. return [] endif let lines = map(readfile(a:filename), \ 's:iconv(v:val, a:fileencoding, &encoding)') let pattern = get(readfile(a:pattern_file_name), 0, '\h\w*') let max_lines = len(lines) let keyword_list = [] let dup_check = {} let keyword_pattern2 = '^\%('.pattern.'\m\)' for line in lines "{{{ let match = match(line, pattern) while match >= 0 "{{{ let match_str = matchstr(line, keyword_pattern2, match) if !has_key(dup_check, match_str) && len(match_str) >= a:minlen " Append list. call add(keyword_list, (a:is_string ? \ match_str : { 'word' : match_str })) let dup_check[match_str] = 1 endif let match += len(match_str) let match = match(line, pattern, match) endwhile"}}} endfor"}}} return keyword_list endfunction"}}} function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding) "{{{ let keyword_lists = [] let dup_check = {} let [pattern, tags_file_name, filter_pattern, filetype] = \ readfile(a:pattern_file_name)[: 4] if tags_file_name !=# '$dummy$' " Check output. let tags_list = [] let i = 0 while i < 2 if filereadable(tags_file_name) " Use filename. let tags_list = map(readfile(tags_file_name), \ 's:iconv(v:val, a:fileencoding, &encoding)') break endif sleep 500m let i += 1 endwhile else if !filereadable(a:filename) return [] endif " Use filename. let tags_list = map(readfile(a:filename), \ 's:iconv(v:val, a:fileencoding, &encoding)') endif if empty(tags_list) " File caching. return s:load_from_file(a:filename, a:pattern_file_name, \ a:mark, a:minlen, a:maxfilename, a:fileencoding, 0) endif for line in tags_list "{{{ let tag = split(substitute(line, "\", '', 'g'), '\t', 1) " Add keywords. if line =~ '^!' || len(tag) < 3 || len(tag[0]) < a:minlen \ || has_key(dup_check, tag[0]) continue endif let opt = join(tag[2:], "\") let cmd = matchstr(opt, '.*/;"') let option = { \ 'cmd' : substitute(substitute(substitute(cmd, \'^\%([/?]\^\?\)\?\s*\|\%(\$\?[/?]\)\?;"$', '', 'g'), \ '\\\\', '\\', 'g'), '\\/', '/', 'g'), \ 'kind' : '' \} if option.cmd =~ '\d\+' let option.cmd = tag[0] endif for opt in split(opt[len(cmd):], '\t', 1) let key = matchstr(opt, '^\h\w*\ze:') if key == '' let option['kind'] = opt else let option[key] = matchstr(opt, '^\h\w*:\zs.*') endif endfor if has_key(option, 'file') \ || (has_key(option, 'access') && option.access != 'public') continue endif let abbr = has_key(option, 'signature')? tag[0] . option.signature : \ (option['kind'] == 'd' || option['cmd'] == '') ? \ tag[0] : option['cmd'] let abbr = substitute(abbr, '\s\+', ' ', 'g') " Substitute "namespace foobar" to "foobar ". let abbr = substitute(abbr, \'^\(namespace\|class\|struct\|enum\|union\)\s\+\(.*\)$', \'\2 <\1>', '') " Substitute typedef. let abbr = substitute(abbr, \'^typedef\s\+\(.*\)\s\+\(\h\w*\%(::\w*\)*\);\?$', \'\2 ', 'g') let keyword = { \ 'word' : tag[0], 'abbr' : abbr, \ 'kind' : option['kind'], 'dup' : 1, \ } if has_key(option, 'struct') let keyword.menu = option.struct elseif has_key(option, 'class') let keyword.menu = option.class elseif has_key(option, 'enum') let keyword.menu = option.enum elseif has_key(option, 'union') let keyword.menu = option.union endif call add(keyword_lists, keyword) let dup_check[tag[0]] = 1 endfor"}}} if filter_pattern != '' call filter(keyword_lists, filter_pattern) endif return keyword_lists endfunction"}}} function! s:truncate(str, width) "{{{ " Original function is from mattn. " http://github.com/mattn/googlereader-vim/tree/master if a:str =~# '^[\x00-\x7f]*$' return len(a:str) < a:width ? \ printf('%-'.a:width.'s', a:str) : strpart(a:str, 0, a:width) endif let ret = a:str let width = s:wcswidth(a:str) if width > a:width let ret = s:strwidthpart(ret, a:width) let width = s:wcswidth(ret) endif if width < a:width let ret .= repeat(' ', a:width - width) endif return ret endfunction"}}} function! s:strwidthpart(str, width) "{{{ let ret = a:str let width = s:wcswidth(a:str) while width > a:width let char = matchstr(ret, '.$') let ret = ret[: -1 - len(char)] let width -= s:wcwidth(char) endwhile return ret endfunction"}}} function! s:iconv(expr, from, to) if a:from == '' || a:to == '' || a:from ==? a:to return a:expr endif let result = iconv(a:expr, a:from, a:to) return result != '' ? result : a:expr endfunction if v:version >= 703 " Use builtin function. function! s:wcswidth(str) "{{{ return strdisplaywidth(a:str) endfunction"}}} function! s:wcwidth(str) "{{{ return strwidth(a:str) endfunction"}}} else function! s:wcswidth(str) "{{{ if a:str =~# '^[\x00-\x7f]*$' return strlen(a:str) end let mx_first = '^\(.\)' let str = a:str let width = 0 while 1 let ucs = char2nr(substitute(str, mx_first, '\1', '')) if ucs == 0 break endif let width += s:wcwidth(ucs) let str = substitute(str, mx_first, '', '') endwhile return width endfunction"}}} " UTF-8 only. function! s:wcwidth(ucs) "{{{ let ucs = a:ucs if (ucs >= 0x1100 \ && (ucs <= 0x115f \ || ucs == 0x2329 \ || ucs == 0x232a \ || (ucs >= 0x2e80 && ucs <= 0xa4cf \ && ucs != 0x303f) \ || (ucs >= 0xac00 && ucs <= 0xd7a3) \ || (ucs >= 0xf900 && ucs <= 0xfaff) \ || (ucs >= 0xfe30 && ucs <= 0xfe6f) \ || (ucs >= 0xff00 && ucs <= 0xff60) \ || (ucs >= 0xffe0 && ucs <= 0xffe6) \ || (ucs >= 0x20000 && ucs <= 0x2fffd) \ || (ucs >= 0x30000 && ucs <= 0x3fffd) \ )) return 2 endif return 1 endfunction"}}} endif if argc() == 8 && \ (argv(0) ==# 'load_from_file' || argv(0) ==# 'load_from_tags') try call s:main(argv()) catch call writefile([v:throwpoint, v:exception], \ fnamemodify(argv(1), ':h:h').'/async_error_log') endtry qall! else function! neocomplcache#async_cache#main(argv) "{{{ call s:main(a:argv) endfunction"}}} endif let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/cache.vim ================================================ "============================================================================= " FILE: cache.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditionneocomplcache#cache# " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Cache loader. function! neocomplcache#cache#check_cache_list(cache_dir, key, async_cache_dictionary, index_keyword_list, ...) "{{{ if !has_key(a:async_cache_dictionary, a:key) return endif let is_string = get(a:000, 0, 0) let keyword_list = [] let cache_list = a:async_cache_dictionary[a:key] for cache in cache_list if filereadable(cache.cachename) let keyword_list += neocomplcache#cache#load_from_cache( \ a:cache_dir, cache.filename, is_string) endif endfor call neocomplcache#cache#list2index(keyword_list, a:index_keyword_list, is_string) call filter(cache_list, '!filereadable(v:val.cachename)') if empty(cache_list) " Delete from dictionary. call remove(a:async_cache_dictionary, a:key) endif endfunction"}}} function! neocomplcache#cache#check_cache(cache_dir, key, async_cache_dictionary, keyword_list_dictionary, ...) "{{{ let is_string = get(a:000, 0, 0) " Caching. if !has_key(a:keyword_list_dictionary, a:key) let a:keyword_list_dictionary[a:key] = {} endif return neocomplcache#cache#check_cache_list( \ a:cache_dir, a:key, a:async_cache_dictionary, \ a:keyword_list_dictionary[a:key], is_string) endfunction"}}} function! neocomplcache#cache#load_from_cache(cache_dir, filename, ...) "{{{ let is_string = get(a:000, 0, 0) try let list = eval(get(neocomplcache#cache#readfile( \ a:cache_dir, a:filename), 0, '[]')) if !empty(list) && is_string && type(list[0]) != type('') " Type check. throw 'Type error' endif return list catch " Delete old cache file. let cache_name = \ neocomplcache#cache#encode_name(a:cache_dir, a:filename) if filereadable(cache_name) call delete(cache_name) endif return [] endtry endfunction"}}} function! neocomplcache#cache#index_load_from_cache(cache_dir, filename, ...) "{{{ let is_string = get(a:000, 0, 0) let keyword_lists = {} let completion_length = 2 for keyword in neocomplcache#cache#load_from_cache( \ a:cache_dir, a:filename, is_string) let key = tolower( \ (is_string ? keyword : keyword.word)[: completion_length-1]) if !has_key(keyword_lists, key) let keyword_lists[key] = [] endif call add(keyword_lists[key], keyword) endfor return keyword_lists endfunction"}}} function! neocomplcache#cache#list2index(list, dictionary, is_string) "{{{ let completion_length = 2 for keyword in a:list let word = a:is_string ? keyword : keyword.word let key = tolower(word[: completion_length-1]) if !has_key(a:dictionary, key) let a:dictionary[key] = {} endif let a:dictionary[key][word] = keyword endfor return a:dictionary endfunction"}}} function! neocomplcache#cache#save_cache(cache_dir, filename, keyword_list) "{{{ if neocomplcache#util#is_sudo() return endif call neocomplcache#cache#writefile( \ a:cache_dir, a:filename, [string(a:keyword_list)]) endfunction"}}} function! neocomplcache#cache#save_cache_old(cache_dir, filename, keyword_list) "{{{ if neocomplcache#util#is_sudo() return endif " Create dictionary key. for keyword in a:keyword_list if !has_key(keyword, 'abbr') let keyword.abbr = keyword.word endif if !has_key(keyword, 'kind') let keyword.kind = '' endif if !has_key(keyword, 'menu') let keyword.menu = '' endif endfor " Output cache. let word_list = [] for keyword in a:keyword_list call add(word_list, printf('%s|||%s|||%s|||%s', \keyword.word, keyword.abbr, keyword.menu, keyword.kind)) endfor call neocomplcache#cache#writefile( \ a:cache_dir, a:filename, word_list) endfunction"}}} " Cache helper. function! neocomplcache#cache#getfilename(cache_dir, filename) "{{{ let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir return s:_encode_name(cache_dir, a:filename) endfunction"}}} function! neocomplcache#cache#filereadable(cache_dir, filename) "{{{ let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir let cache_name = s:_encode_name(cache_dir, a:filename) return filereadable(cache_name) endfunction"}}} function! neocomplcache#cache#readfile(cache_dir, filename) "{{{ let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir let cache_name = s:_encode_name(cache_dir, a:filename) return filereadable(cache_name) ? readfile(cache_name) : [] endfunction"}}} function! neocomplcache#cache#writefile(cache_dir, filename, list) "{{{ if neocomplcache#util#is_sudo() return endif let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir let cache_name = s:_encode_name(cache_dir, a:filename) call writefile(a:list, cache_name) endfunction"}}} function! neocomplcache#cache#encode_name(cache_dir, filename) let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir return s:_encode_name(cache_dir, a:filename) endfunction function! neocomplcache#cache#check_old_cache(cache_dir, filename) "{{{ let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir " Check old cache file. let cache_name = s:_encode_name(cache_dir, a:filename) let ret = getftime(cache_name) == -1 \ || getftime(cache_name) <= getftime(a:filename) if ret && filereadable(cache_name) " Delete old cache. call delete(cache_name) endif return ret endfunction"}}} let s:sdir = neocomplcache#util#substitute_path_separator( \ fnamemodify(expand(''), ':p:h')) function! neocomplcache#cache#async_load_from_file(cache_dir, filename, pattern, mark) "{{{ if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename) \ || neocomplcache#util#is_sudo() return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif let pattern_file_name = \ neocomplcache#cache#encode_name('keyword_patterns', a:filename) let cache_name = \ neocomplcache#cache#encode_name(a:cache_dir, a:filename) " Create pattern file. call neocomplcache#cache#writefile( \ 'keyword_patterns', a:filename, [a:pattern]) " args: funcname, outputname, filename pattern mark " minlen maxlen encoding let fileencoding = \ &fileencoding == '' ? &encoding : &fileencoding let argv = [ \ 'load_from_file', cache_name, a:filename, pattern_file_name, a:mark, \ g:neocomplcache_min_keyword_length, \ g:neocomplcache_max_menu_width, fileencoding \ ] return s:async_load(argv, a:cache_dir, a:filename) endfunction"}}} function! neocomplcache#cache#async_load_from_tags(cache_dir, filename, filetype, mark, is_create_tags) "{{{ if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename) \ || neocomplcache#util#is_sudo() return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif let cache_name = \ neocomplcache#cache#encode_name(a:cache_dir, a:filename) let pattern_file_name = \ neocomplcache#cache#encode_name('tags_pattens', a:filename) if a:is_create_tags if !executable(g:neocomplcache_ctags_program) echoerr 'Create tags error! Please install ' \ . g:neocomplcache_ctags_program . '.' return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endif " Create tags file. let tags_file_name = \ neocomplcache#cache#encode_name('tags_output', a:filename) let default = get(g:neocomplcache_ctags_arguments_list, '_', '') let args = get(g:neocomplcache_ctags_arguments_list, a:filetype, default) if has('win32') || has('win64') let filename = \ neocomplcache#util#substitute_path_separator(a:filename) let command = printf('%s -f "%s" %s "%s" ', \ g:neocomplcache_ctags_program, tags_file_name, args, filename) else let command = printf('%s -f ''%s'' 2>/dev/null %s ''%s''', \ g:neocomplcache_ctags_program, tags_file_name, args, a:filename) endif if neocomplcache#has_vimproc() call vimproc#system_bg(command) else call system(command) endif else let tags_file_name = '$dummy$' endif let filter_pattern = \ get(g:neocomplcache_tags_filter_patterns, a:filetype, '') call neocomplcache#cache#writefile('tags_pattens', a:filename, \ [neocomplcache#get_keyword_pattern(), \ tags_file_name, filter_pattern, a:filetype]) " args: funcname, outputname, filename pattern mark " minlen maxlen encoding let fileencoding = &fileencoding == '' ? &encoding : &fileencoding let argv = [ \ 'load_from_tags', cache_name, a:filename, pattern_file_name, a:mark, \ g:neocomplcache_min_keyword_length, \ g:neocomplcache_max_menu_width, fileencoding \ ] return s:async_load(argv, a:cache_dir, a:filename) endfunction"}}} function! s:async_load(argv, cache_dir, filename) "{{{ " if 0 if neocomplcache#has_vimproc() let paths = vimproc#get_command_name(v:progname, $PATH, -1) if empty(paths) if has('gui_macvim') " MacVim check. if !executable('/Applications/MacVim.app/Contents/MacOS/Vim') call neocomplcache#print_error( \ 'You installed MacVim in not default directory!'. \ ' You must add MacVim installed path in $PATH.') let g:neocomplcache_use_vimproc = 0 return endif let vim_path = '/Applications/MacVim.app/Contents/MacOS/Vim' else call neocomplcache#print_error( \ printf('Vim path : "%s" is not found.'. \ ' You must add "%s" installed path in $PATH.', \ v:progname, v:progname)) let g:neocomplcache_use_vimproc = 0 return endif else let base_path = neocomplcache#util#substitute_path_separator( \ fnamemodify(paths[0], ':p:h')) let vim_path = base_path . \ (neocomplcache#util#is_windows() ? '/vim.exe' : '/vim') endif if !executable(vim_path) && neocomplcache#util#is_mac() " Note: Search "Vim" instead of vim. let vim_path = base_path. '/Vim' endif if !executable(vim_path) call neocomplcache#print_error( \ printf('Vim path : "%s" is not executable.', vim_path)) let g:neocomplcache_use_vimproc = 0 return endif let args = [vim_path, '-u', 'NONE', '-i', 'NONE', '-n', \ '-N', '-S', s:sdir.'/async_cache.vim'] \ + a:argv call vimproc#system_bg(args) " call vimproc#system(args) " call system(join(args)) else call neocomplcache#async_cache#main(a:argv) endif return neocomplcache#cache#encode_name(a:cache_dir, a:filename) endfunction"}}} function! s:_encode_name(cache_dir, filename) " Check cache directory. if !isdirectory(a:cache_dir) call mkdir(a:cache_dir, 'p') endif let cache_dir = a:cache_dir if cache_dir !~ '/$' let cache_dir .= '/' endif return cache_dir . s:_create_hash(cache_dir, a:filename) endfunction " Check md5. try call md5#md5() let s:exists_md5 = 1 catch let s:exists_md5 = 0 endtry function! s:_create_hash(dir, str) if len(a:dir) + len(a:str) < 150 let hash = substitute(substitute( \ a:str, ':', '=-', 'g'), '[/\\]', '=+', 'g') elseif s:exists_md5 " Use md5.vim. let hash = md5#md5(a:str) else " Use simple hash. let sum = 0 for i in range(len(a:str)) let sum += char2nr(a:str[i]) * (i + 1) endfor let hash = printf('%x', sum) endif return hash endfunction let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/commands.vim ================================================ "============================================================================= " FILE: commands.vim " AUTHOR: Shougo Matsushita " Last Modified: 12 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#commands#_initialize() "{{{ command! -nargs=? Neco call s:display_neco() command! -nargs=1 NeoComplCacheAutoCompletionLength \ call s:set_auto_completion_length() endfunction"}}} function! neocomplcache#commands#_toggle_lock() "{{{ if neocomplcache#get_current_neocomplcache().lock echo 'neocomplcache is unlocked!' call neocomplcache#commands#_unlock() else echo 'neocomplcache is locked!' call neocomplcache#commands#_lock() endif endfunction"}}} function! neocomplcache#commands#_lock() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.lock = 1 endfunction"}}} function! neocomplcache#commands#_unlock() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.lock = 0 endfunction"}}} function! neocomplcache#commands#_lock_source(source_name) "{{{ if !neocomplcache#is_enabled() call neocomplcache#print_warning( \ 'neocomplcache is disabled! This command is ignored.') return endif let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.lock_sources[a:source_name] = 1 endfunction"}}} function! neocomplcache#commands#_unlock_source(source_name) "{{{ if !neocomplcache#is_enabled() call neocomplcache#print_warning( \ 'neocomplcache is disabled! This command is ignored.') return endif let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.lock_sources[a:source_name] = 1 endfunction"}}} function! neocomplcache#commands#_clean() "{{{ " Delete cache files. for directory in filter(neocomplcache#util#glob( \ g:neocomplcache_temporary_dir.'/*'), 'isdirectory(v:val)') for filename in filter(neocomplcache#util#glob(directory.'/*'), \ '!isdirectory(v:val)') call delete(filename) endfor endfor echo 'Cleaned cache files in: ' . g:neocomplcache_temporary_dir endfunction"}}} function! neocomplcache#commands#_set_file_type(filetype) "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.filetype = a:filetype endfunction"}}} function! s:display_neco(number) "{{{ let cmdheight_save = &cmdheight let 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 number = (a:number != '') ? a:number : len(animation) let anim = get(animation, number, animation[s:rand(len(animation) - 1)]) let &cmdheight = len(anim[0]) for frame in anim echo repeat("\n", &cmdheight-2) redraw echon join(frame, "\n") sleep 300m endfor redraw let &cmdheight = cmdheight_save endfunction"}}} function! s:rand(max) "{{{ if !has('reltime') " Same value. return 0 endif let time = reltime()[1] return (time < 0 ? -time : time)% (a:max + 1) endfunction"}}} function! s:set_auto_completion_length(len) "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.completion_length = a:len endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/complete.vim ================================================ "============================================================================= " FILE: complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 06 Jun 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#complete#manual_complete(findstart, base) "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() if a:findstart let cur_text = neocomplcache#get_cur_text() if !neocomplcache#is_enabled() \ || neocomplcache#helper#is_omni_complete(cur_text) call neocomplcache#helper#clear_result() let &l:completefunc = 'neocomplcache#complete#manual_complete' return (neocomplcache#is_prefetch() \ || g:neocomplcache_enable_insert_char_pre) ? \ -1 : -3 endif " Get complete_pos. if neocomplcache#is_prefetch() && !empty(neocomplcache.complete_results) " Use prefetch results. else let neocomplcache.complete_results = \ neocomplcache#complete#_get_results(cur_text) endif let complete_pos = \ neocomplcache#complete#_get_complete_pos(neocomplcache.complete_results) if complete_pos < 0 call neocomplcache#helper#clear_result() let neocomplcache = neocomplcache#get_current_neocomplcache() let complete_pos = (neocomplcache#is_prefetch() || \ g:neocomplcache_enable_insert_char_pre || \ neocomplcache#get_current_neocomplcache().skipped) ? -1 : -3 let neocomplcache.skipped = 0 endif return complete_pos else let complete_pos = neocomplcache#complete#_get_complete_pos( \ neocomplcache.complete_results) let neocomplcache.candidates = neocomplcache#complete#_get_words( \ neocomplcache.complete_results, complete_pos, a:base) let neocomplcache.complete_str = a:base if v:version > 703 || v:version == 703 && has('patch418') let dict = { 'words' : neocomplcache.candidates } if (g:neocomplcache_enable_cursor_hold_i \ || v:version > 703 || v:version == 703 && has('patch561')) \ && len(a:base) < g:neocomplcache_auto_completion_start_length " Note: If Vim is less than 7.3.561, it have broken register "." problem. let dict.refresh = 'always' endif return dict else return neocomplcache.candidates endif endif endfunction"}}} function! neocomplcache#complete#sources_manual_complete(findstart, base) "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() if a:findstart if !neocomplcache#is_enabled() call neocomplcache#helper#clear_result() return -2 endif " Get complete_pos. let complete_results = neocomplcache#complete#_get_results( \ neocomplcache#get_cur_text(1), neocomplcache.manual_sources) let neocomplcache.complete_pos = \ neocomplcache#complete#_get_complete_pos(complete_results) if neocomplcache.complete_pos < 0 call neocomplcache#helper#clear_result() return -2 endif let neocomplcache.complete_results = complete_results return neocomplcache.complete_pos endif let neocomplcache.complete_pos = \ neocomplcache#complete#_get_complete_pos( \ neocomplcache.complete_results) let candidates = neocomplcache#complete#_get_words( \ neocomplcache.complete_results, \ neocomplcache.complete_pos, a:base) let neocomplcache.candidates = candidates let neocomplcache.complete_str = a:base return candidates endfunction"}}} function! neocomplcache#complete#unite_complete(findstart, base) "{{{ " Dummy. return a:findstart ? -1 : [] endfunction"}}} function! neocomplcache#complete#auto_complete(findstart, base) "{{{ return neocomplcache#complete#manual_complete(a:findstart, a:base) endfunction"}}} function! neocomplcache#complete#_get_results(cur_text, ...) "{{{ if g:neocomplcache_enable_debug echomsg 'start get_complete_results' endif let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.start_time = reltime() let complete_results = call( \ 'neocomplcache#complete#_set_results_pos', [a:cur_text] + a:000) call neocomplcache#complete#_set_results_words(complete_results) return filter(complete_results, \ '!empty(v:val.neocomplcache__context.candidates)') endfunction"}}} function! neocomplcache#complete#_get_complete_pos(sources) "{{{ if empty(a:sources) return -1 endif return min([col('.')] + map(copy(a:sources), \ 'v:val.neocomplcache__context.complete_pos')) endfunction"}}} function! neocomplcache#complete#_get_words(sources, complete_pos, complete_str) "{{{ let frequencies = neocomplcache#variables#get_frequencies() if exists('*neocomplcache#sources#buffer_complete#get_frequencies') let frequencies = extend(copy( \ neocomplcache#sources#buffer_complete#get_frequencies()), \ frequencies) endif " Append prefix. let candidates = [] let len_words = 0 for source in sort(filter(copy(a:sources), \ '!empty(v:val.neocomplcache__context.candidates)'), \ 's:compare_source_rank') let context = source.neocomplcache__context let words = \ type(context.candidates[0]) == type('') ? \ map(copy(context.candidates), "{'word': v:val}") : \ deepcopy(context.candidates) let context.candidates = words call neocomplcache#helper#call_hook( \ source, 'on_post_filter', {}) if context.complete_pos > a:complete_pos let prefix = a:complete_str[: context.complete_pos \ - a:complete_pos - 1] for candidate in words let candidate.word = prefix . candidate.word endfor endif for candidate in words if !has_key(candidate, 'menu') && has_key(source, 'mark') " Set default menu. let candidate.menu = source.mark endif if has_key(frequencies, candidate.word) let candidate.rank = frequencies[candidate.word] endif endfor let words = neocomplcache#helper#call_filters( \ source.sorters, source, {}) if source.max_candidates > 0 let words = words[: len(source.max_candidates)-1] endif let words = neocomplcache#helper#call_filters( \ source.converters, source, {}) let candidates += words let len_words += len(words) if g:neocomplcache_max_list > 0 \ && len_words > g:neocomplcache_max_list break endif if neocomplcache#complete_check() return [] endif endfor if g:neocomplcache_max_list > 0 let candidates = candidates[: g:neocomplcache_max_list] endif " Check dup and set icase. let icase = g:neocomplcache_enable_ignore_case && \!(g:neocomplcache_enable_smart_case && a:complete_str =~ '\u') \ && !neocomplcache#is_text_mode() for candidate in candidates if has_key(candidate, 'kind') && candidate.kind == '' " Remove kind key. call remove(candidate, 'kind') endif let candidate.icase = icase endfor if neocomplcache#complete_check() return [] endif return candidates endfunction"}}} function! neocomplcache#complete#_set_results_pos(cur_text, ...) "{{{ " Set context filetype. call neocomplcache#context_filetype#set() " Initialize sources. let neocomplcache = neocomplcache#get_current_neocomplcache() for source in filter(values(neocomplcache#variables#get_sources()), \ '!v:val.loaded && (empty(v:val.filetypes) || \ get(v:val.filetypes, \ neocomplcache.context_filetype, 0))') call neocomplcache#helper#call_hook(source, 'on_init', {}) let source.loaded = 1 endfor let sources = filter(copy(get(a:000, 0, \ neocomplcache#helper#get_sources_list())), 'v:val.loaded') if a:0 < 1 call filter(sources, '!neocomplcache#is_plugin_locked(v:key)') endif " Try source completion. "{{{ let complete_sources = [] for source in values(sources) let context = source.neocomplcache__context let context.input = a:cur_text let context.complete_pos = -1 let context.complete_str = '' let context.candidates = [] let pos = winsaveview() try let complete_pos = \ has_key(source, 'get_keyword_pos') ? \ source.get_keyword_pos(context.input) : \ has_key(source, 'get_complete_position') ? \ source.get_complete_position(context) : \ neocomplcache#match_word(context.input)[0] catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error( \ 'Error occurred in source''s get_complete_position()!') call neocomplcache#print_error( \ 'Source name is ' . source.name) return complete_sources finally if winsaveview() != pos call winrestview(pos) endif endtry if complete_pos < 0 continue endif let complete_str = context.input[complete_pos :] if neocomplcache#is_auto_complete() && \ neocomplcache#util#mb_strlen(complete_str) \ < neocomplcache#get_completion_length(source.name) " Skip. continue endif let context.complete_pos = complete_pos let context.complete_str = complete_str call add(complete_sources, source) endfor "}}} return complete_sources endfunction"}}} function! neocomplcache#complete#_set_results_words(sources) "{{{ " Try source completion. for source in a:sources if neocomplcache#complete_check() return endif " Save options. let ignorecase_save = &ignorecase let context = source.neocomplcache__context if neocomplcache#is_text_mode() let &ignorecase = 1 elseif g:neocomplcache_enable_smart_case \ && context.complete_str =~ '\u' let &ignorecase = 0 else let &ignorecase = g:neocomplcache_enable_ignore_case endif let pos = winsaveview() try let context.candidates = has_key(source, 'get_keyword_list') ? \ source.get_keyword_list(context.complete_str) : \ has_key(source, 'get_complete_words') ? \ source.get_complete_words( \ context.complete_pos, context.complete_str) : \ source.gather_candidates(context) catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error( \ 'Source name is ' . source.name) call neocomplcache#print_error( \ 'Error occurred in source''s gather_candidates()!') return finally if winsaveview() != pos call winrestview(pos) endif endtry if g:neocomplcache_enable_debug echomsg source.name endif let &ignorecase = ignorecase_save endfor endfunction"}}} " Source rank order. "{{{ function! s:compare_source_rank(i1, i2) return a:i2.rank - a:i1.rank endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/context_filetype.vim ================================================ "============================================================================= " FILE: context_filetype.vim " AUTHOR: Shougo Matsushita " Last Modified: 18 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#context_filetype#initialize() "{{{ " Initialize context filetype lists. call neocomplcache#util#set_default( \ 'g:neocomplcache_context_filetype_lists', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'c,cpp', [ \ {'filetype' : 'masm', \ 'start' : '_*asm_*\s\+\h\w*', 'end' : '$'}, \ {'filetype' : 'masm', \ 'start' : '_*asm_*\s*\%(\n\s*\)\?{', 'end' : '}'}, \ {'filetype' : 'gas', \ 'start' : '_*asm_*\s*\%(_*volatile_*\s*\)\?(', 'end' : ');'}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'd', [ \ {'filetype' : 'masm', \ 'start' : 'asm\s*\%(\n\s*\)\?{', 'end' : '}'}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'perl6', [ \ {'filetype' : 'pir', 'start' : 'Q:PIR\s*{', 'end' : '}'}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'vimshell', [ \ {'filetype' : 'vim', \ 'start' : 'vexe \([''"]\)', 'end' : '\\\@'}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'vim', [ \ {'filetype' : 'python', \ 'start' : '^\s*py\%[thon\]3\? <<\s*\(\h\w*\)', 'end' : '^\1'}, \ {'filetype' : 'ruby', \ 'start' : '^\s*rub\%[y\] <<\s*\(\h\w*\)', 'end' : '^\1'}, \ {'filetype' : 'lua', \ 'start' : '^\s*lua <<\s*\(\h\w*\)', 'end' : '^\1'}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'html,xhtml', [ \ {'filetype' : 'javascript', 'start' : \']*\)\? type="text/javascript"\%( [^>]*\)\?>', \ 'end' : ''}, \ {'filetype' : 'coffee', 'start' : \']*\)\? type="text/coffeescript"\%( [^>]*\)\?>', \ 'end' : ''}, \ {'filetype' : 'css', 'start' : \']*\)\? type="text/css"\%( [^>]*\)\?>', \ 'end' : ''}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'python', [ \ {'filetype' : 'vim', \ 'start' : 'vim.command\s*(\([''"]\)', 'end' : '\\\@', 'end' : '^<'}, \]) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_context_filetype_lists', \ 'nyaos,int-nyaos', [ \ {'filetype' : 'lua', \ 'start' : '\ new filetype graph. let dup_check[old_filetype] = new_filetype let old_filetype = new_filetype endwhile return neocomplcache.context_filetype endfunction"}}} function! neocomplcache#context_filetype#get(filetype) "{{{ " Default. let filetype = a:filetype if filetype == '' let filetype = 'nothing' endif " Default range. let neocomplcache = neocomplcache#get_current_neocomplcache() let pos = [line('.'), col('.')] for include in get(g:neocomplcache_context_filetype_lists, filetype, []) let start_backward = searchpos(include.start, 'bneW') " Check pos > start. if start_backward[0] == 0 || s:compare_pos(start_backward, pos) > 0 continue endif let end_pattern = include.end if end_pattern =~ '\\1' let match_list = matchlist(getline(start_backward[0]), include.start) let end_pattern = substitute(end_pattern, '\\1', '\=match_list[1]', 'g') endif let end_forward = searchpos(end_pattern, 'nW') if end_forward[0] == 0 let end_forward = [line('$'), len(getline('$'))+1] endif " Check end > pos. if s:compare_pos(pos, end_forward) > 0 continue endif let end_backward = searchpos(end_pattern, 'bnW') " Check start <= end. if s:compare_pos(start_backward, end_backward) < 0 continue endif if start_backward[1] == len(getline(start_backward[0])) " Next line. let start_backward[0] += 1 let start_backward[1] = 1 endif if end_forward[1] == 1 " Previous line. let end_forward[0] -= 1 let end_forward[1] = len(getline(end_forward[0])) endif let neocomplcache.context_filetype_range = \ [ start_backward, end_forward ] return include.filetype endfor return filetype endfunction"}}} 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" let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/converter_abbr.vim ================================================ "============================================================================= " FILE: converter_abbr.vim " AUTHOR: Shougo Matsushita " Last Modified: 06 Jun 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#converter_abbr#define() "{{{ return s:converter endfunction"}}} let s:converter = { \ 'name' : 'converter_abbr', \ 'description' : 'abbr converter', \} function! s:converter.filter(context) "{{{ if g:neocomplcache_max_keyword_width < 0 return a:context.candidates endif for candidate in a:context.candidates let abbr = get(candidate, 'abbr', candidate.word) if len(abbr) > g:neocomplcache_max_keyword_width let len = neocomplcache#util#wcswidth(abbr) if len > g:neocomplcache_max_keyword_width let candidate.abbr = neocomplcache#util#truncate_smart( \ abbr, g:neocomplcache_max_keyword_width, \ g:neocomplcache_max_keyword_width/2, '..') endif endif endfor return a:context.candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/converter_case.vim ================================================ "============================================================================= " FILE: converter_case.vim " AUTHOR: Shougo Matsushita " Last Modified: 02 Jun 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#converter_case#define() "{{{ return s:converter endfunction"}}} let s:converter = { \ 'name' : 'converter_case', \ 'description' : 'case converter', \} function! s:converter.filter(context) "{{{ if !neocomplcache#is_text_mode() && !neocomplcache#within_comment() return a:context.candidates endif let convert_candidates = filter(copy(a:context.candidates), \ "get(v:val, 'neocomplcache__convertable', 1) \ && v:val.word =~ '^[a-zA-Z0-9_''-]\\+$'") if a:context.complete_str =~ '^\l\+$' for candidate in convert_candidates let candidate.word = tolower(candidate.word) if has_key(candidate, 'abbr') let candidate.abbr = tolower(candidate.abbr) endif endfor elseif a:context.complete_str =~ '^\u\+$' for candidate in convert_candidates let candidate.word = toupper(candidate.word) if has_key(candidate, 'abbr') let candidate.abbr = toupper(candidate.abbr) endif endfor elseif a:context.complete_str =~ '^\u\l\+$' for candidate in convert_candidates let candidate.word = toupper(candidate.word[0]). \ tolower(candidate.word[1:]) if has_key(candidate, 'abbr') let candidate.abbr = toupper(candidate.abbr[0]). \ tolower(candidate.abbr[1:]) endif endfor endif return a:context.candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/converter_delimiter.vim ================================================ "============================================================================= " FILE: converter_delimiter.vim " AUTHOR: Shougo Matsushita " Last Modified: 06 Jun 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#converter_delimiter#define() "{{{ return s:converter endfunction"}}} let s:converter = { \ 'name' : 'converter_delimiter', \ 'description' : 'delimiter converter', \} function! s:converter.filter(context) "{{{ if g:neocomplcache_max_keyword_width < 0 return a:context.candidates endif " Delimiter check. let filetype = neocomplcache#get_context_filetype() let next_keyword = neocomplcache#filters# \converter_remove_next_keyword#get_next_keyword(a:context.source_name) for delimiter in ['/'] + \ get(g:neocomplcache_delimiter_patterns, filetype, []) " Count match. let delim_cnt = 0 let matchend = matchend(a:context.complete_str, delimiter) while matchend >= 0 let matchend = matchend(a:context.complete_str, \ delimiter, matchend) let delim_cnt += 1 endwhile for candidate in a:context.candidates let split_list = split(candidate.word, delimiter.'\ze.', 1) if len(split_list) > 1 let delimiter_sub = substitute( \ delimiter, '\\\([.^$]\)', '\1', 'g') let candidate.word = join(split_list[ : delim_cnt], delimiter_sub) let candidate.abbr = join( \ split(get(candidate, 'abbr', candidate.word), \ delimiter.'\ze.', 1)[ : delim_cnt], \ delimiter_sub) if g:neocomplcache_max_keyword_width >= 0 \ && len(candidate.abbr) > g:neocomplcache_max_keyword_width let candidate.abbr = substitute(candidate.abbr, \ '\(\h\)\w*'.delimiter, '\1'.delimiter_sub, 'g') endif if delim_cnt+1 < len(split_list) let candidate.abbr .= delimiter_sub . '~' let candidate.dup = 0 if g:neocomplcache_enable_auto_delimiter && next_keyword == '' let candidate.word .= delimiter_sub endif endif endif endfor endfor return a:context.candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/converter_nothing.vim ================================================ "============================================================================= " FILE: converter_nothing.vim " AUTHOR: Shougo Matsushita " Last Modified: 24 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#converter_nothing#define() "{{{ return s:converter endfunction"}}} let s:converter = { \ 'name' : 'converter_nothing', \ 'description' : 'nothing converter', \} function! s:converter.filter(context) "{{{ " Nothing. return a:context.candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/converter_remove_next_keyword.vim ================================================ "============================================================================= " FILE: converter_remove_next_keyword.vim " AUTHOR: Shougo Matsushita " Last Modified: 31 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#converter_remove_next_keyword#define() "{{{ return s:converter endfunction"}}} let s:converter = { \ 'name' : 'converter_remove_next_keyword', \ 'description' : 'remove next keyword converter', \} function! s:converter.filter(context) "{{{ " Remove next keyword. let next_keyword = neocomplcache#filters# \converter_remove_next_keyword#get_next_keyword(a:context.source_name) if next_keyword == '' return a:context.candidates endif let next_keyword = substitute( \ substitute(escape(next_keyword, \ '~" \.^$*[]'), "'", "''", 'g'), ')$', '', '').'$' " No ignorecase. let ignorecase_save = &ignorecase let &ignorecase = 0 try for r in a:context.candidates let pos = match(r.word, next_keyword) if pos >= 0 if !has_key(r, 'abbr') let r.abbr = r.word endif let r.word = r.word[: pos-1] endif endfor finally let &ignorecase = ignorecase_save endtry return a:context.candidates endfunction"}}} function! neocomplcache#filters#converter_remove_next_keyword#get_next_keyword(source_name) "{{{ let pattern = '^\%(' . \ ((a:source_name ==# 'filename_complete' || \ a:source_name ==# 'filename_complete') ? \ neocomplcache#get_next_keyword_pattern('filename') : \ neocomplcache#get_next_keyword_pattern()) . '\m\)' let next_keyword = matchstr('a'. \ getline('.')[len(neocomplcache#get_cur_text(1)) :], pattern)[1:] return next_keyword endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/matcher_fuzzy.vim ================================================ "============================================================================= " FILE: matcher_fuzzy.vim " AUTHOR: Shougo Matsushita " Last Modified: 24 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#matcher_fuzzy#define() "{{{ return s:matcher endfunction"}}} let s:matcher = { \ 'name' : 'matcher_fuzzy', \ 'description' : 'fuzzy matcher', \} function! s:matcher.filter(context) "{{{ " Todo: return [] endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/matcher_head.vim ================================================ "============================================================================= " FILE: matcher_head.vim " AUTHOR: Shougo Matsushita " Last Modified: 25 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#matcher_head#define() "{{{ return s:matcher endfunction"}}} let s:matcher = { \ 'name' : 'matcher_head', \ 'description' : 'head matcher', \} function! s:matcher.filter(context) "{{{ " Todo: return [] endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/matcher_old.vim ================================================ "============================================================================= " FILE: matcher_old.vim " AUTHOR: Shougo Matsushita " Last Modified: 25 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#matcher_old#define() "{{{ return s:matcher endfunction"}}} let s:matcher = { \ 'name' : 'matcher_old', \ 'description' : 'old matcher', \} function! s:matcher.filter(candidates, context) "{{{ if a:context.input == '' return neocomplcache#util#filter_matcher( \ a:candidates, '', a:context) endif let candidates = a:candidates for input in a:context.input_list let candidates = neocomplcache#filters#matcher_old#glob_matcher( \ candidates, input, a:context) endfor return candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/sorter_length.vim ================================================ "============================================================================= " FILE: sorter_length.vim " AUTHOR: Shougo Matsushita " Last Modified: 09 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#sorter_length#define() "{{{ return s:sorter endfunction"}}} let s:sorter = { \ 'name' : 'sorter_length', \ 'description' : 'sort by length order', \} function! s:sorter.filter(context) "{{{ return sort(a:context.candidates, 's:compare') endfunction"}}} function! s:compare(i1, i2) let diff = len(a:i1.word) - len(a:i2.word) if !diff let diff = (a:i1.word ># a:i2.word) ? 1 : -1 endif return diff endfunction let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/sorter_nothing.vim ================================================ "============================================================================= " FILE: sorter_nothing.vim " AUTHOR: Shougo Matsushita " Last Modified: 24 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#sorter_nothing#define() "{{{ return s:sorter endfunction"}}} let s:sorter = { \ 'name' : 'sorter_nothing', \ 'description' : 'nothing sorter', \} function! s:sorter.filter(context) "{{{ " Nothing. return a:candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters/sorter_rank.vim ================================================ "============================================================================= " FILE: sorter_rank.vim " AUTHOR: Shougo Matsushita " Last Modified: 09 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#sorter_rank#define() "{{{ return s:sorter endfunction"}}} let s:sorter = { \ 'name' : 'sorter_rank', \ 'description' : 'sort by matched rank order', \} function! s:sorter.filter(context) "{{{ return sort(a:context.candidates, 's:compare') endfunction"}}} function! s:compare(i1, i2) let diff = (get(a:i2, 'rank', 0) - get(a:i1, 'rank', 0)) return (diff != 0) ? diff : (a:i1.word ># a:i2.word) ? 1 : -1 endfunction" let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/filters.vim ================================================ "============================================================================= " FILE: filters.vim " AUTHOR: Shougo Matsushita " Last Modified: 28 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#filters#keyword_filter(list, complete_str) "{{{ let complete_str = a:complete_str if g:neocomplcache_enable_debug echomsg len(a:list) endif " Delimiter check. let filetype = neocomplcache#get_context_filetype() for delimiter in get(g:neocomplcache_delimiter_patterns, filetype, []) let complete_str = substitute(complete_str, \ delimiter, '*' . delimiter, 'g') endfor if complete_str == '' || \ &l:completefunc ==# 'neocomplcache#complete#unite_complete' || \ empty(a:list) return a:list elseif neocomplcache#check_match_filter(complete_str) " Match filter. let word = type(a:list[0]) == type('') ? 'v:val' : 'v:val.word' let expr = printf('%s =~ %s', \ word, string('^' . \ neocomplcache#keyword_escape(complete_str))) if neocomplcache#is_auto_complete() " Don't complete cursor word. let expr .= printf(' && %s !=? a:complete_str', word) endif " Check head character. if complete_str[0] != '\' && complete_str[0] != '.' let expr = word.'[0] == ' . \ string(complete_str[0]) .' && ' . expr endif call neocomplcache#print_debug(expr) return filter(a:list, expr) else " Use fast filter. return s:head_filter(a:list, complete_str) endif endfunction"}}} function! s:head_filter(list, complete_str) "{{{ let word = type(a:list[0]) == type('') ? 'v:val' : 'v:val.word' if &ignorecase let expr = printf('!stridx(tolower(%s), %s)', \ word, string(tolower(a:complete_str))) else let expr = printf('!stridx(%s, %s)', \ word, string(a:complete_str)) endif if neocomplcache#is_auto_complete() " Don't complete cursor word. let expr .= printf(' && %s !=? a:complete_str', word) endif return filter(a:list, expr) endfunction"}}} function! neocomplcache#filters#dictionary_filter(dictionary, complete_str) "{{{ if empty(a:dictionary) return [] endif let completion_length = 2 if len(a:complete_str) < completion_length || \ neocomplcache#check_completion_length_match( \ a:complete_str, completion_length) || \ &l:completefunc ==# 'neocomplcache#cunite_complete' return neocomplcache#keyword_filter( \ neocomplcache#unpack_dictionary(a:dictionary), a:complete_str) endif let key = tolower(a:complete_str[: completion_length-1]) if !has_key(a:dictionary, key) return [] endif let list = a:dictionary[key] if type(list) == type({}) " Convert dictionary dictionary. unlet list let list = values(a:dictionary[key]) else let list = copy(list) endif return (len(a:complete_str) == completion_length && &ignorecase \ && !neocomplcache#check_completion_length_match( \ a:complete_str, completion_length)) ? \ list : neocomplcache#keyword_filter(list, a:complete_str) endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/handler.vim ================================================ "============================================================================= " FILE: handler.vim " AUTHOR: Shougo Matsushita " Last Modified: 02 Oct 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#handler#_on_moved_i() "{{{ " Get cursor word. let cur_text = neocomplcache#get_cur_text(1) call s:close_preview_window() endfunction"}}} function! neocomplcache#handler#_on_insert_enter() "{{{ if &l:foldmethod ==# 'expr' && foldlevel('.') != 0 foldopen endif endfunction"}}} function! neocomplcache#handler#_on_insert_leave() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.cur_text = '' let neocomplcache.old_cur_text = '' call s:close_preview_window() endfunction"}}} function! neocomplcache#handler#_on_write_post() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() " Restore foldinfo. for winnr in filter(range(1, winnr('$')), \ "!empty(getwinvar(v:val, 'neocomplcache_foldinfo'))") let neocomplcache_foldinfo = \ getwinvar(winnr, 'neocomplcache_foldinfo') call setwinvar(winnr, '&foldmethod', \ neocomplcache_foldinfo.foldmethod) call setwinvar(winnr, '&foldexpr', \ neocomplcache_foldinfo.foldexpr) call setwinvar(winnr, \ 'neocomplcache_foldinfo', {}) endfor endfunction"}}} function! neocomplcache#handler#_on_complete_done() "{{{ " Get cursor word. let [_, candidate] = neocomplcache#match_word( \ neocomplcache#get_cur_text(1)) if candidate == '' return endif let frequencies = neocomplcache#variables#get_frequencies() if !has_key(frequencies, candidate) let frequencies[candidate] = 20 else let frequencies[candidate] += 20 endif endfunction"}}} function! neocomplcache#handler#_change_update_time() "{{{ if &updatetime > g:neocomplcache_cursor_hold_i_time " Change updatetime. let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.update_time_save = &updatetime let &updatetime = g:neocomplcache_cursor_hold_i_time endif endfunction"}}} function! neocomplcache#handler#_restore_update_time() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() if &updatetime < neocomplcache.update_time_save " Restore updatetime. let &updatetime = neocomplcache.update_time_save endif endfunction"}}} function! neocomplcache#handler#_do_auto_complete(event) "{{{ if s:check_in_do_auto_complete() return endif let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.skipped = 0 let neocomplcache.event = a:event let cur_text = neocomplcache#get_cur_text(1) if g:neocomplcache_enable_debug echomsg 'cur_text = ' . cur_text endif " Prevent infinity loop. if s:is_skip_auto_complete(cur_text) " Make cache. if cur_text =~ '^\s*$\|\s\+$' if neocomplcache#is_enabled_source('buffer_complete') " Caching current cache line. call neocomplcache#sources#buffer_complete#caching_current_line() endif if neocomplcache#is_enabled_source('member_complete') " Caching current cache line. call neocomplcache#sources#member_complete#caching_current_line() endif endif if g:neocomplcache_enable_debug echomsg 'Skipped.' endif call neocomplcache#helper#clear_result() return endif let neocomplcache.old_cur_text = cur_text if neocomplcache#helper#is_omni_complete(cur_text) call feedkeys("\(neocomplcache_start_omni_complete)") return endif " Check multibyte input or eskk. if neocomplcache#is_eskk_enabled() \ || neocomplcache#is_multibyte_input(cur_text) if g:neocomplcache_enable_debug echomsg 'Skipped.' endif return endif " Check complete position. let complete_results = neocomplcache#complete#_set_results_pos(cur_text) if empty(complete_results) if g:neocomplcache_enable_debug echomsg 'Skipped.' endif return endif let &l:completefunc = 'neocomplcache#complete#auto_complete' if neocomplcache#is_prefetch() " Do prefetch. let neocomplcache.complete_results = \ neocomplcache#complete#_get_results(cur_text) if empty(neocomplcache.complete_results) if g:neocomplcache_enable_debug echomsg 'Skipped.' endif " Skip completion. let &l:completefunc = 'neocomplcache#complete#manual_complete' call neocomplcache#helper#clear_result() return endif endif call s:save_foldinfo() " Set options. set completeopt-=menu set completeopt-=longest set completeopt+=menuone " Start auto complete. call feedkeys(&l:formatoptions !~ 'a' ? \ "\(neocomplcache_start_auto_complete)": \ "\(neocomplcache_start_auto_complete_no_select)") endfunction"}}} function! s:save_foldinfo() "{{{ " Save foldinfo. let winnrs = filter(range(1, winnr('$')), \ "winbufnr(v:val) == bufnr('%')") " Note: for foldmethod=expr or syntax. call filter(winnrs, " \ (getwinvar(v:val, '&foldmethod') ==# 'expr' || \ getwinvar(v:val, '&foldmethod') ==# 'syntax') && \ getwinvar(v:val, '&modifiable')") for winnr in winnrs call setwinvar(winnr, 'neocomplcache_foldinfo', { \ 'foldmethod' : getwinvar(winnr, '&foldmethod'), \ 'foldexpr' : getwinvar(winnr, '&foldexpr') \ }) call setwinvar(winnr, '&foldmethod', 'manual') call setwinvar(winnr, '&foldexpr', 0) endfor endfunction"}}} function! s:check_in_do_auto_complete() "{{{ if neocomplcache#is_locked() return 1 endif if &l:completefunc == '' let &l:completefunc = 'neocomplcache#complete#manual_complete' endif " Detect completefunc. if &l:completefunc !~# '^neocomplcache#' if &l:buftype =~ 'nofile' return 1 endif if g:neocomplcache_force_overwrite_completefunc " Set completefunc. let &l:completefunc = 'neocomplcache#complete#manual_complete' else " Warning. redir => output 99verbose setl completefunc? redir END call neocomplcache#print_error(output) call neocomplcache#print_error( \ 'Another plugin set completefunc! Disabled neocomplcache.') NeoComplCacheLock return 1 endif endif " Detect AutoComplPop. if exists('g:acp_enableAtStartup') && g:acp_enableAtStartup call neocomplcache#print_error( \ 'Detected enabled AutoComplPop! Disabled neocomplcache.') NeoComplCacheLock return 1 endif endfunction"}}} function! s:is_skip_auto_complete(cur_text) "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() if a:cur_text =~ '^\s*$\|\s\+$' \ || a:cur_text == neocomplcache.old_cur_text \ || (g:neocomplcache_lock_iminsert && &l:iminsert) \ || (&l:formatoptions =~# '[tc]' && &l:textwidth > 0 \ && neocomplcache#util#wcswidth(a:cur_text) >= &l:textwidth) return 1 endif if !neocomplcache.skip_next_complete return 0 endif " Check delimiter pattern. let is_delimiter = 0 let filetype = neocomplcache#get_context_filetype() for delimiter in ['/', '\.'] + \ get(g:neocomplcache_delimiter_patterns, filetype, []) if a:cur_text =~ delimiter . '$' let is_delimiter = 1 break endif endfor if is_delimiter && neocomplcache.skip_next_complete == 2 let neocomplcache.skip_next_complete = 0 return 0 endif let neocomplcache.skip_next_complete = 0 let neocomplcache.cur_text = '' let neocomplcache.old_cur_text = '' return 1 endfunction"}}} function! s:close_preview_window() "{{{ if g:neocomplcache_enable_auto_close_preview && \ bufname('%') !=# '[Command Line]' && \ winnr('$') != 1 && !&l:previewwindow " Close preview window. pclose! endif endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/helper.vim ================================================ "============================================================================= " FILE: helper.vim " AUTHOR: Shougo Matsushita " Last Modified: 20 Aug 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#helper#get_cur_text() "{{{ let cur_text = \ (mode() ==# 'i' ? (col('.')-1) : col('.')) >= len(getline('.')) ? \ getline('.') : \ matchstr(getline('.'), \ '^.*\%' . col('.') . 'c' . (mode() ==# 'i' ? '' : '.')) if cur_text =~ '^.\{-}\ze\S\+$' let complete_str = matchstr(cur_text, '\S\+$') let cur_text = matchstr(cur_text, '^.\{-}\ze\S\+$') else let complete_str = '' endif let neocomplcache = neocomplcache#get_current_neocomplcache() if neocomplcache.event ==# 'InsertCharPre' let complete_str .= v:char endif let filetype = neocomplcache#get_context_filetype() let wildcard = get(g:neocomplcache_wildcard_characters, filetype, \ get(g:neocomplcache_wildcard_characters, '_', '*')) if g:neocomplcache_enable_wildcard && \ wildcard !=# '*' && len(wildcard) == 1 " Substitute wildcard character. while 1 let index = stridx(complete_str, wildcard) if index <= 0 break endif let complete_str = complete_str[: index-1] \ . '*' . complete_str[index+1: ] endwhile endif let neocomplcache.cur_text = cur_text . complete_str " Save cur_text. return neocomplcache.cur_text endfunction"}}} function! neocomplcache#helper#keyword_escape(complete_str) "{{{ " Fuzzy completion. let keyword_len = len(a:complete_str) let keyword_escape = s:keyword_escape(a:complete_str) if g:neocomplcache_enable_fuzzy_completion \ && (g:neocomplcache_fuzzy_completion_start_length \ <= keyword_len && keyword_len < 20) let pattern = keyword_len >= 8 ? \ '\0\\w*' : '\\%(\0\\w*\\|\U\0\E\\l*\\)' let start = g:neocomplcache_fuzzy_completion_start_length if start <= 1 let keyword_escape = \ substitute(keyword_escape, '\w', pattern, 'g') elseif keyword_len < 8 let keyword_escape = keyword_escape[: start - 2] \ . substitute(keyword_escape[start-1 :], '\w', pattern, 'g') else let keyword_escape = keyword_escape[: 3] . \ substitute(keyword_escape[4:12], '\w', \ pattern, 'g') . keyword_escape[13:] endif else " Underbar completion. "{{{ if g:neocomplcache_enable_underbar_completion \ && keyword_escape =~ '[^_]_\|^_' let keyword_escape = substitute(keyword_escape, \ '\%(^\|[^_]\)\zs_', '[^_]*_', 'g') endif if g:neocomplcache_enable_underbar_completion \ && '-' =~ '\k' && keyword_escape =~ '[^-]-' let keyword_escape = substitute(keyword_escape, \ '[^-]\zs-', '[^-]*-', 'g') endif "}}} " Camel case completion. "{{{ if g:neocomplcache_enable_camel_case_completion \ && keyword_escape =~ '\u\?\U*' let keyword_escape = \ substitute(keyword_escape, \ '\u\?\zs\U*', \ '\\%(\0\\l*\\|\U\0\E\\u*_\\?\\)', 'g') endif "}}} endif call neocomplcache#print_debug(keyword_escape) return keyword_escape endfunction"}}} function! neocomplcache#helper#is_omni_complete(cur_text) "{{{ " Check eskk complete length. if neocomplcache#is_eskk_enabled() \ && exists('g:eskk#start_completion_length') if !neocomplcache#is_eskk_convertion(a:cur_text) \ || !neocomplcache#is_multibyte_input(a:cur_text) return 0 endif let complete_pos = call(&l:omnifunc, [1, '']) let complete_str = a:cur_text[complete_pos :] return neocomplcache#util#mb_strlen(complete_str) >= \ g:eskk#start_completion_length endif let filetype = neocomplcache#get_context_filetype() let omnifunc = get(g:neocomplcache_omni_functions, \ filetype, &l:omnifunc) if neocomplcache#check_invalid_omnifunc(omnifunc) return 0 endif let syn_name = neocomplcache#helper#get_syn_name(1) if syn_name ==# 'Comment' || syn_name ==# 'String' " Skip omni_complete in string literal. return 0 endif if has_key(g:neocomplcache_force_omni_patterns, omnifunc) let pattern = g:neocomplcache_force_omni_patterns[omnifunc] elseif filetype != '' && \ get(g:neocomplcache_force_omni_patterns, filetype, '') != '' let pattern = g:neocomplcache_force_omni_patterns[filetype] else return 0 endif if a:cur_text !~# '\%(' . pattern . '\m\)$' return 0 endif " Set omnifunc. let &omnifunc = omnifunc return 1 endfunction"}}} function! neocomplcache#helper#is_enabled_source(source_name) "{{{ if neocomplcache#is_disabled_source(a:source_name) return 0 endif let neocomplcache = neocomplcache#get_current_neocomplcache() if !has_key(neocomplcache, 'sources') call neocomplcache#helper#get_sources_list() endif return index(keys(neocomplcache.sources), a:source_name) >= 0 endfunction"}}} function! neocomplcache#helper#get_source_filetypes(filetype) "{{{ let filetype = (a:filetype == '') ? 'nothing' : a:filetype let filetype_dict = {} let filetypes = [filetype] if filetype =~ '\.' if exists('g:neocomplcache_ignore_composite_filetype_lists') \ && has_key(g:neocomplcache_ignore_composite_filetype_lists, filetype) let filetypes = [g:neocomplcache_ignore_composite_filetype_lists[filetype]] else " Set composite filetype. let filetypes += split(filetype, '\.') endif endif if exists('g:neocomplcache_same_filetype_lists') for ft in copy(filetypes) let filetypes += split(get(g:neocomplcache_same_filetype_lists, ft, \ get(g:neocomplcache_same_filetype_lists, '_', '')), ',') endfor endif return neocomplcache#util#uniq(filetypes) endfunction"}}} function! neocomplcache#helper#get_completion_length(plugin_name) "{{{ " Todo. endfunction"}}} function! neocomplcache#helper#complete_check() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() if g:neocomplcache_enable_debug echomsg split(reltimestr(reltime(neocomplcache.start_time)))[0] endif let ret = (!neocomplcache#is_prefetch() && complete_check()) \ || (neocomplcache#is_auto_complete() \ && g:neocomplcache_skip_auto_completion_time != '' \ && split(reltimestr(reltime(neocomplcache.start_time)))[0] > \ g:neocomplcache_skip_auto_completion_time) if ret let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.skipped = 1 redraw echo 'Skipped.' endif return ret endfunction"}}} function! neocomplcache#helper#get_syn_name(is_trans) "{{{ return len(getline('.')) < 200 ? \ synIDattr(synIDtrans(synID(line('.'), mode() ==# 'i' ? \ col('.')-1 : col('.'), a:is_trans)), 'name') : '' endfunction"}}} function! neocomplcache#helper#match_word(cur_text, ...) "{{{ let pattern = a:0 >= 1 ? a:1 : neocomplcache#get_keyword_pattern_end() " Check wildcard. let complete_pos = s:match_wildcard( \ a:cur_text, pattern, match(a:cur_text, pattern)) let complete_str = (complete_pos >=0) ? \ a:cur_text[complete_pos :] : '' return [complete_pos, complete_str] endfunction"}}} function! neocomplcache#helper#filetype_complete(arglead, cmdline, cursorpos) "{{{ " Dup check. let ret = {} for item in map( \ split(globpath(&runtimepath, 'syntax/*.vim'), '\n') + \ split(globpath(&runtimepath, 'indent/*.vim'), '\n') + \ split(globpath(&runtimepath, 'ftplugin/*.vim'), '\n') \ , 'fnamemodify(v:val, ":t:r")') if !has_key(ret, item) && item =~ '^'.a:arglead let ret[item] = 1 endif endfor return sort(keys(ret)) endfunction"}}} function! neocomplcache#helper#unite_patterns(pattern_var, filetype) "{{{ let keyword_patterns = [] let dup_check = {} " Composite filetype. for ft in split(a:filetype, '\.') if has_key(a:pattern_var, ft) && !has_key(dup_check, ft) let dup_check[ft] = 1 call add(keyword_patterns, a:pattern_var[ft]) endif " Same filetype. if exists('g:neocomplcache_same_filetype_lists') \ && has_key(g:neocomplcache_same_filetype_lists, ft) for ft in split(g:neocomplcache_same_filetype_lists[ft], ',') if has_key(a:pattern_var, ft) && !has_key(dup_check, ft) let dup_check[ft] = 1 call add(keyword_patterns, a:pattern_var[ft]) endif endfor endif endfor if empty(keyword_patterns) let default = get(a:pattern_var, '_', get(a:pattern_var, 'default', '')) if default != '' call add(keyword_patterns, default) endif endif return join(keyword_patterns, '\m\|') endfunction"}}} function! neocomplcache#helper#ftdictionary2list(dictionary, filetype) "{{{ let list = [] for filetype in neocomplcache#get_source_filetypes(a:filetype) if has_key(a:dictionary, filetype) call add(list, a:dictionary[filetype]) endif endfor return list endfunction"}}} function! neocomplcache#helper#get_sources_list(...) "{{{ let filetype = neocomplcache#get_context_filetype() let source_names = exists('b:neocomplcache_sources_list') ? \ b:neocomplcache_sources_list : \ get(a:000, 0, \ get(g:neocomplcache_sources_list, filetype, \ get(g:neocomplcache_sources_list, '_', ['_']))) let disabled_sources = get( \ g:neocomplcache_disabled_sources_list, filetype, \ get(g:neocomplcache_disabled_sources_list, '_', [])) call neocomplcache#init#_sources(source_names) let all_sources = neocomplcache#available_sources() let sources = {} for source_name in source_names if source_name ==# '_' " All sources. let sources = all_sources break endif if !has_key(all_sources, source_name) call neocomplcache#print_warning(printf( \ 'Invalid source name "%s" is given.', source_name)) continue endif let sources[source_name] = all_sources[source_name] endfor let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.sources = filter(sources, " \ index(disabled_sources, v:val.name) < 0 && \ (empty(v:val.filetypes) || \ get(v:val.filetypes, neocomplcache.context_filetype, 0))") return neocomplcache.sources endfunction"}}} function! neocomplcache#helper#clear_result() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.complete_str = '' let neocomplcache.candidates = [] let neocomplcache.complete_results = [] let neocomplcache.complete_pos = -1 endfunction"}}} function! neocomplcache#helper#call_hook(sources, hook_name, context) "{{{ for source in neocomplcache#util#convert2list(a:sources) try if !has_key(source.hooks, a:hook_name) if a:hook_name ==# 'on_init' && has_key(source, 'initialize') call source.initialize() elseif a:hook_name ==# 'on_final' && has_key(source, 'finalize') call source.finalize() endif else call call(source.hooks[a:hook_name], \ [extend(source.neocomplcache__context, a:context)], \ source.hooks) endif catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error( \ '[unite.vim] Error occurred in calling hook "' . a:hook_name . '"!') call neocomplcache#print_error( \ '[unite.vim] Source name is ' . source.name) endtry endfor endfunction"}}} function! neocomplcache#helper#call_filters(filters, source, context) "{{{ let context = extend(a:source.neocomplcache__context, a:context) let _ = [] for filter in neocomplcache#init#_filters( \ neocomplcache#util#convert2list(a:filters)) try let context.candidates = call(filter.filter, [context], filter) catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error( \ '[unite.vim] Error occurred in calling filter ' \ . filter.name . '!') call neocomplcache#print_error( \ '[unite.vim] Source name is ' . a:source.name) endtry endfor return context.candidates endfunction"}}} function! s:match_wildcard(cur_text, pattern, complete_pos) "{{{ let complete_pos = a:complete_pos while complete_pos > 1 && a:cur_text[complete_pos - 1] == '*' let left_text = a:cur_text[: complete_pos - 2] if left_text == '' || left_text !~ a:pattern break endif let complete_pos = match(left_text, a:pattern) endwhile return complete_pos endfunction"}}} function! s:keyword_escape(complete_str) "{{{ let keyword_escape = escape(a:complete_str, '~" \.^$[]') if g:neocomplcache_enable_wildcard let keyword_escape = substitute( \ substitute(keyword_escape, '.\zs\*', '.*', 'g'), \ '\%(^\|\*\)\zs\*', '\\*', 'g') else let keyword_escape = escape(keyword_escape, '*') endif return keyword_escape endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/init.vim ================================================ "============================================================================= " FILE: init.vim " AUTHOR: Shougo Matsushita " Last Modified: 25 Oct 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim if !exists('s:is_enabled') let s:is_enabled = 0 endif function! neocomplcache#init#lazy() "{{{ if !exists('s:lazy_progress') let s:lazy_progress = 0 endif if s:lazy_progress == 0 call neocomplcache#init#_others() let s:is_enabled = 0 elseif s:lazy_progress == 1 call neocomplcache#init#_sources(get(g:neocomplcache_sources_list, \ neocomplcache#get_context_filetype(), ['_'])) else call neocomplcache#init#_autocmds() let s:is_enabled = 1 endif let s:lazy_progress += 1 endfunction"}}} function! neocomplcache#init#enable() "{{{ if neocomplcache#is_enabled() return endif call neocomplcache#init#_autocmds() call neocomplcache#init#_others() call neocomplcache#init#_sources(get(g:neocomplcache_sources_list, \ neocomplcache#get_context_filetype(), ['_'])) let s:is_enabled = 1 endfunction"}}} function! neocomplcache#init#disable() "{{{ if !neocomplcache#is_enabled() call neocomplcache#print_warning( \ 'neocomplcache is disabled! This command is ignored.') return endif let s:is_enabled = 0 augroup neocomplcache autocmd! augroup END delcommand NeoComplCacheDisable call neocomplcache#helper#call_hook(filter(values( \ neocomplcache#variables#get_sources()), 'v:val.loaded'), \ 'on_final', {}) endfunction"}}} function! neocomplcache#init#is_enabled() "{{{ return s:is_enabled endfunction"}}} function! neocomplcache#init#_autocmds() "{{{ augroup neocomplcache autocmd! autocmd InsertEnter * \ call neocomplcache#handler#_on_insert_enter() autocmd InsertLeave * \ call neocomplcache#handler#_on_insert_leave() autocmd CursorMovedI * \ call neocomplcache#handler#_on_moved_i() autocmd BufWritePost * \ call neocomplcache#handler#_on_write_post() augroup END if g:neocomplcache_enable_insert_char_pre \ && (v:version > 703 || v:version == 703 && has('patch418')) autocmd neocomplcache InsertCharPre * \ call neocomplcache#handler#_do_auto_complete('InsertCharPre') elseif g:neocomplcache_enable_cursor_hold_i augroup neocomplcache autocmd CursorHoldI * \ call neocomplcache#handler#_do_auto_complete('CursorHoldI') autocmd InsertEnter * \ call neocomplcache#handler#_change_update_time() autocmd InsertLeave * \ call neocomplcache#handler#_restore_update_time() augroup END else autocmd neocomplcache CursorMovedI * \ call neocomplcache#handler#_do_auto_complete('CursorMovedI') endif if (v:version > 703 || v:version == 703 && has('patch598')) autocmd neocomplcache CompleteDone * \ call neocomplcache#handler#_on_complete_done() endif endfunction"}}} function! neocomplcache#init#_others() "{{{ call neocomplcache#init#_variables() call neocomplcache#context_filetype#initialize() call neocomplcache#commands#_initialize() " Save options. let s:completefunc_save = &completefunc let s:completeopt_save = &completeopt " Set completefunc. let completefunc_save = &l:completefunc let &completefunc = 'neocomplcache#complete#manual_complete' if completefunc_save != '' let &l:completefunc = completefunc_save endif " For auto complete keymappings. call neocomplcache#mappings#define_default_mappings() " Detect set paste. if &paste redir => output 99verbose set paste redir END call neocomplcache#print_error(output) call neocomplcache#print_error( \ 'Detected set paste! Disabled neocomplcache.') endif command! -nargs=0 -bar NeoComplCacheDisable \ call neocomplcache#init#disable() endfunction"}}} function! neocomplcache#init#_variables() "{{{ " Initialize keyword patterns. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_keyword_patterns', {}) call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'_', \'\k\+') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_keyword_patterns', \'filename', \ neocomplcache#util#is_windows() ? \'\%(\a\+:/\)\?\%([/[:alnum:]()$+_~.\x80-\xff-]\|[^[:print:]]\|\\.\)\+' : \'\%([/\[\][:alnum:]()$+_~.-]\|[^[:print:]]\|\\.\)\+') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'lisp,scheme,clojure,int-gosh,int-clisp,int-clj', \'[[:alpha:]+*/@$_=.!?-][[:alnum:]+*/@$_:=.!?-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'ruby,int-irb', \'^=\%(b\%[egin]\|e\%[nd]\)\|\%(@@\|[$@]\)\h\w*\|\h\w*\%(::\w*\)*[!?]\?') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'php,int-php', \'\)\?'. \'\|\$\h\w*\|\h\w*\%(\%(\\\|::\)\w*\)*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'perl,int-perlsh', \'<\h\w*>\?\|[$@%&*]\h\w*\|\h\w*\%(::\w*\)*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'perl6,int-perl6', \'<\h\w*>\?\|[$@%&][!.*?]\?\h[[:alnum:]_-]*'. \'\|\h[[:alnum:]_-]*\%(::[[:alnum:]_-]*\)*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'pir', \'[$@%.=]\?\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'pasm', \'[=]\?\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'vim,help', \'-\h[[:alnum:]-]*=\?\|\c\[:\%(\h\w*:\]\)\?\|&\h[[:alnum:]_:]*\|'. \'\%(\h\w*\)\?\|([^)]*)\?'. \'\|<\h[[:alnum:]_-]*>\?\|\h[[:alnum:]_:#]*!\?\|$\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'tex', \'\\\a{\a\{1,2}}\|\\[[:alpha:]@][[:alnum:]@]*'. \'\%({\%([[:alnum:]:_]\+\*\?}\?\)\?\)\?\|\a[[:alnum:]:_]*\*\?') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'sh,zsh,int-zsh,int-bash,int-sh', \'[[:alpha:]_.-][[:alnum:]_.-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'vimshell', \'\$\$\?\w*\|[[:alpha:]_.\\/~-][[:alnum:]_.\\/~-]*\|\d\+\%(\.\d\+\)\+') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'ps1,int-powershell', \'\[\h\%([[:alnum:]_.]*\]::\)\?\|[$%@.]\?[[:alpha:]_.:-][[:alnum:]_.:-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'c', \'^\s*#\s*\h\w*\|\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'cpp', \'^\s*#\s*\h\w*\|\h\w*\%(::\w*\)*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'objc', \'^\s*#\s*\h\w*\|\h\w*\|@\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'objcpp', \'^\s*#\s*\h\w*\|\h\w*\%(::\w*\)*\|@\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'objj', \'\h\w*\|@\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'d', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'python,int-python,int-ipython', \'[@]\?\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'cs', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'java', \'[@]\?\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'javascript,actionscript,int-js,int-kjs,int-rhino', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'coffee,int-coffee', \'[@]\?\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'awk', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'haskell,int-ghci', \'\%(\u\w*\.\)\+[[:alnum:]_'']*\|[[:alpha:]_''][[:alnum:]_'']*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'ml,ocaml,int-ocaml,int-sml,int-smlsharp', \'[''`#.]\?\h[[:alnum:]_'']*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'erlang,int-erl', \'^\s*-\h\w*\|\%(\h\w*:\)*\h\w*\|\h[[:alnum:]_@]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'html,xhtml,xml,markdown,eruby', \'\)\?\|&\h\%(\w*;\)\?'. \'\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'css,stylus,scss,less', \'[@#.]\?[[:alpha:]_:-][[:alnum:]_:-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'tags', \'^[^!][^/[:blank:]]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'pic', \'^\s*#\h\w*\|\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'arm', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'asmh8300', \'[[:alpha:]_.][[:alnum:]_.]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'masm', \'\.\h\w*\|[[:alpha:]_@?$][[:alnum:]_@?$]*\|\h\w*:\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'nasm', \'^\s*\[\h\w*\|[%.]\?\h\w*\|\%(\.\.@\?\|%[%$!]\)\%(\h\w*\)\?\|\h\w*:\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'asm', \'[%$.]\?\h\w*\%(\$\h\w*\)\?') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'gas', \'[$.]\?\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'gdb,int-gdb', \'$\h\w*\|[[:alnum:]:._-]\+') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'make', \'[[:alpha:]_.-][[:alnum:]_.-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'scala,int-scala', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'int-termtter', \'\h[[:alnum:]_/-]*\|\$\a\+\|#\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'int-earthquake', \'[:#$]\h\w*\|\h[[:alnum:]_/-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'dosbatch,int-cmdproxy', \'\$\w+\|[[:alpha:]_./-][[:alnum:]_.-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'vb', \'\h\w*\|#\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'lua', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \ 'zimbu', \'\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'konoha', \'[*$@%]\h\w*\|\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'cobol', \'\a[[:alnum:]-]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'coq', \'\h[[:alnum:]_'']*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'tcl', \'[.-]\h\w*\|\h\w*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_keyword_patterns', \'nyaos,int-nyaos', \'\h\w*') "}}} " Initialize next keyword patterns. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_next_keyword_patterns', {}) call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_next_keyword_patterns', 'perl', \'\h\w*>') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_next_keyword_patterns', 'perl6', \'\h\w*>') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_next_keyword_patterns', 'vim,help', \'\w*()\?\|\w*:\]\|[[:alnum:]_-]*[)>=]') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_next_keyword_patterns', 'python', \'\w*()\?') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_next_keyword_patterns', 'tex', \'[[:alnum:]:_]\+[*[{}]') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_next_keyword_patterns', 'html,xhtml,xml,mkd', \'[^"]*"\|[[:alnum:]_:-]*>') "}}} " Initialize same file type lists. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_same_filetype_lists', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'c', 'cpp') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'cpp', 'c') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'erb', 'ruby,html,xhtml') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'html,xml', 'xhtml') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'html,xhtml', 'css,stylus,less') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'css', 'scss') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'scss', 'css') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'stylus', 'css') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'less', 'css') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'xhtml', 'html,xml') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'help', 'vim') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'tex', 'bib,plaintex') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'plaintex', 'bib,tex') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'lingr-say', 'lingr-messages,lingr-members') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'J6uil_say', 'J6uil') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'vimconsole', 'vim') " Interactive filetypes. call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-irb', 'ruby') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-ghci,int-hugs', 'haskell') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-python,int-ipython', 'python') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-gosh', 'scheme') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-clisp', 'lisp') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-erl', 'erlang') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-zsh', 'zsh') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-bash', 'bash') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-sh', 'sh') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-cmdproxy', 'dosbatch') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-powershell', 'powershell') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-perlsh', 'perl') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-perl6', 'perl6') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-ocaml', 'ocaml') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-clj', 'clojure') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-sml,int-smlsharp', 'sml') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-js,int-kjs,int-rhino', 'javascript') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-coffee', 'coffee') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-gdb', 'gdb') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-scala', 'scala') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-nyaos', 'nyaos') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_same_filetype_lists', \ 'int-php', 'php') "}}} " Initialize delimiter patterns. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_delimiter_patterns', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'vim,help', ['#']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'erlang,lisp,int-clisp', [':']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'lisp,int-clisp', ['/', ':']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'clojure,int-clj', ['/', '\.']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'perl,cpp', ['::']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'php', ['\', '::']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'java,d,javascript,actionscript,'. \ 'ruby,eruby,haskell,int-ghci,coffee,zimbu,konoha', \ ['\.']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'lua', ['\.', ':']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_delimiter_patterns', \ 'perl6', ['\.', '::']) "}}} " Initialize ctags arguments. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_ctags_arguments_list', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_ctags_arguments_list', \ '_', '') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_ctags_arguments_list', 'vim', \ '--extra=fq --fields=afmiKlnsStz ' . \ "--regex-vim='/function!? ([a-z#:_0-9A-Z]+)/\\1/function/'") if neocomplcache#util#is_mac() call neocomplcache#util#set_default_dictionary( \ '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#util#set_default_dictionary( \ 'g:neocomplcache_ctags_arguments_list', 'c', \ '-R --sort=1 --c-kinds=+p --fields=+iaS --extra=+q ' . \ '-I __wur,__THROW,__attribute_malloc__,__nonnull+,'. \ '__attribute_pure__,__attribute_warn_unused_result__,__attribute__+') endif call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_ctags_arguments_list', 'cpp', \ '--language-force=C++ -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q '. \ '-I __wur,__THROW,__attribute_malloc__,__nonnull+,'. \ '__attribute_pure__,__attribute_warn_unused_result__,__attribute__+') "}}} " Initialize text mode filetypes. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_text_mode_filetypes', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_text_mode_filetypes', \ 'hybrid,text,help,tex,gitcommit,gitrebase,vcs-commit,markdown,'. \ 'textile,creole,org,rdoc,mediawiki,rst,asciidoc,pod', 1) "}}} " Initialize tags filter patterns. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_tags_filter_patterns', {}) call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_tags_filter_patterns', 'c,cpp', \'v:val.word !~ ''^[~_]''') "}}} " Initialize force omni completion pattern. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_force_omni_patterns', {}) call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_force_omni_patterns', 'objc', \'\h\w\+\|[^.[:digit:] *\t]\%(\.\|->\)') "}}} " Initialize ignore composite filetypes call neocomplcache#util#set_default( \ 'g:neocomplcache_ignore_composite_filetype_lists', {}) " 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 " Initialize omni function list. "{{{ if !exists('g:neocomplcache_omni_functions') let g:neocomplcache_omni_functions = {} endif "}}} " Set custom. call s:set_default_custom() endfunction"}}} function! neocomplcache#init#_current_neocomplcache() "{{{ let b:neocomplcache = { \ 'context' : { \ 'input' : '', \ 'complete_pos' : -1, \ 'complete_str' : '', \ 'candidates' : [], \ }, \ 'lock' : 0, \ 'skip_next_complete' : 0, \ 'filetype' : '', \ 'context_filetype' : '', \ 'context_filetype_range' : \ [[1, 1], [line('$'), len(getline('$'))+1]], \ 'completion_length' : -1, \ 'update_time_save' : &updatetime, \ 'foldinfo' : [], \ 'lock_sources' : {}, \ 'skipped' : 0, \ 'event' : '', \ 'cur_text' : '', \ 'old_cur_text' : '', \ 'complete_str' : '', \ 'complete_pos' : -1, \ 'candidates' : [], \ 'complete_results' : [], \ 'complete_sources' : [], \ 'manual_sources' : [], \ 'start_time' : reltime(), \} endfunction"}}} function! neocomplcache#init#_sources(names) "{{{ if !exists('s:loaded_source_files') " Initialize. let s:loaded_source_files = {} let s:loaded_all_sources = 0 let s:runtimepath_save = '' endif " Initialize sources table. if s:loaded_all_sources && &runtimepath ==# s:runtimepath_save return endif let runtimepath_save = neocomplcache#util#split_rtp(s:runtimepath_save) let runtimepath = neocomplcache#util#join_rtp( \ filter(neocomplcache#util#split_rtp(), \ 'index(runtimepath_save, v:val) < 0')) let sources = neocomplcache#variables#get_sources() for name in filter(copy(a:names), '!has_key(sources, v:val)') " Search autoload. for source_name in map(split(globpath(runtimepath, \ 'autoload/neocomplcache/sources/*.vim'), '\n'), \ "fnamemodify(v:val, ':t:r')") if has_key(s:loaded_source_files, source_name) continue endif let s:loaded_source_files[source_name] = 1 let source = neocomplcache#sources#{source_name}#define() if empty(source) " Ignore. continue endif call neocomplcache#define_source(source) endfor if name == '_' let s:loaded_all_sources = 1 let s:runtimepath_save = &runtimepath endif endfor endfunction"}}} function! neocomplcache#init#_source(source) "{{{ let default = { \ 'max_candidates' : 0, \ 'filetypes' : {}, \ 'hooks' : {}, \ 'matchers' : ['matcher_old'], \ 'sorters' : ['sorter_rank'], \ 'converters' : [ \ 'converter_remove_next_keyword', \ 'converter_delimiter', \ 'converter_case', \ 'converter_abbr', \ ], \ 'neocomplcache__context' : copy(neocomplcache#get_context()), \ } let source = extend(copy(default), a:source) " Overwritten by user custom. let custom = neocomplcache#variables#get_custom().sources let source = extend(source, get(custom, source.name, \ get(custom, '_', {}))) let source.loaded = 0 " Source kind convertion. if source.kind ==# 'plugin' || \ (!has_key(source, 'gather_candidates') && \ !has_key(source, 'get_complete_words')) let source.kind = 'keyword' elseif source.kind ==# 'ftplugin' || source.kind ==# 'complfunc' " For compatibility. let source.kind = 'manual' else let source.kind = 'manual' endif if !has_key(source, 'rank') " Set default rank. let source.rank = (source.kind ==# 'keyword') ? 5 : \ empty(source.filetypes) ? 10 : 100 endif if !has_key(source, 'min_pattern_length') " Set min_pattern_length. let source.min_pattern_length = (source.kind ==# 'keyword') ? \ g:neocomplcache_auto_completion_start_length : 0 endif let source.neocomplcache__context.source_name = source.name " Note: This routine is for compatibility of old sources implementation. " Initialize sources. if empty(source.filetypes) && has_key(source, 'initialize') try call source.initialize() catch call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) call neocomplcache#print_error( \ 'Error occurred in source''s initialize()!') call neocomplcache#print_error( \ 'Source name is ' . source.name) endtry let source.loaded = 1 endif return source endfunction"}}} function! neocomplcache#init#_filters(names) "{{{ let _ = [] let filters = neocomplcache#variables#get_filters() for name in a:names if !has_key(filters, name) " Search autoload. for filter_name in map(split(globpath(&runtimepath, \ 'autoload/neocomplcache/filters/'. \ substitute(name, \'^\%(matcher\|sorter\|converter\)_[^/_-]\+\zs[/_-].*$', '', '') \ .'*.vim'), '\n'), "fnamemodify(v:val, ':t:r')") let filter = neocomplcache#filters#{filter_name}#define() if empty(filter) " Ignore. continue endif call neocomplcache#define_filter(filter) endfor if !has_key(filters, name) " Not found. call neocomplcache#print_error( \ printf('filter name : %s is not found.', string(name))) continue endif endif if has_key(filters, name) call add(_, filters[name]) endif endfor return _ endfunction"}}} function! neocomplcache#init#_filter(filter) "{{{ let default = { \ } let filter = extend(default, a:filter) if !has_key(filter, 'kind') let filter.kind = \ (filter.name =~# '^matcher_') ? 'matcher' : \ (filter.name =~# '^sorter_') ? 'sorter' : 'converter' endif return filter endfunction"}}} function! s:set_default_custom() "{{{ let custom = neocomplcache#variables#get_custom().sources " Initialize completion length. for [source_name, length] in items( \ g:neocomplcache_source_completion_length) if !has_key(custom, source_name) let custom[source_name] = {} endif let custom[source_name].min_pattern_length = length endfor " Initialize rank. for [source_name, rank] in items( \ g:neocomplcache_source_rank) if !has_key(custom, source_name) let custom[source_name] = {} endif let custom[source_name].rank = rank endfor endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/mappings.vim ================================================ "============================================================================= " FILE: mappings.vim " AUTHOR: Shougo Matsushita " Last Modified: 19 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim function! neocomplcache#mappings#define_default_mappings() "{{{ inoremap (neocomplcache_start_unite_complete) \ unite#sources#neocomplcache#start_complete() inoremap (neocomplcache_start_unite_quick_match) \ unite#sources#neocomplcache#start_quick_match() inoremap (neocomplcache_start_auto_complete) \ =neocomplcache#mappings#popup_post() inoremap (neocomplcache_start_auto_complete_no_select) \ " \ inoremap (neocomplcache_start_omni_complete) \ endfunction"}}} function! neocomplcache#mappings#smart_close_popup() "{{{ return g:neocomplcache_enable_auto_select ? \ neocomplcache#mappings#cancel_popup() : \ neocomplcache#mappings#close_popup() endfunction "}}} function! neocomplcache#mappings#close_popup() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.complete_str = '' let neocomplcache.skip_next_complete = 2 let neocomplcache.candidates = [] return pumvisible() ? "\" : '' endfunction "}}} function! neocomplcache#mappings#cancel_popup() "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let neocomplcache.skip_next_complete = 1 call neocomplcache#helper#clear_result() return pumvisible() ? "\" : '' endfunction "}}} function! neocomplcache#mappings#popup_post() "{{{ return !pumvisible() ? "" : \ g:neocomplcache_enable_auto_select ? "\\" : \ "\" endfunction"}}} function! neocomplcache#mappings#undo_completion() "{{{ if !exists(':NeoComplCacheDisable') return '' endif let neocomplcache = neocomplcache#get_current_neocomplcache() " Get cursor word. let [complete_pos, complete_str] = \ neocomplcache#match_word(neocomplcache#get_cur_text(1)) let old_keyword_str = neocomplcache.complete_str let neocomplcache.complete_str = complete_str return (!pumvisible() ? '' : \ complete_str ==# old_keyword_str ? "\" : "\") \. repeat("\", len(complete_str)) . old_keyword_str endfunction"}}} function! neocomplcache#mappings#complete_common_string() "{{{ if !exists(':NeoComplCacheDisable') return '' endif " Save options. let ignorecase_save = &ignorecase " Get cursor word. let [complete_pos, complete_str] = \ neocomplcache#match_word(neocomplcache#get_cur_text(1)) if neocomplcache#is_text_mode() let &ignorecase = 1 elseif g:neocomplcache_enable_smart_case && complete_str =~ '\u' let &ignorecase = 0 else let &ignorecase = g:neocomplcache_enable_ignore_case endif let is_fuzzy = g:neocomplcache_enable_fuzzy_completion try let g:neocomplcache_enable_fuzzy_completion = 0 let neocomplcache = neocomplcache#get_current_neocomplcache() let candidates = neocomplcache#keyword_filter( \ copy(neocomplcache.candidates), complete_str) finally let g:neocomplcache_enable_fuzzy_completion = is_fuzzy endtry if empty(candidates) let &ignorecase = ignorecase_save return '' endif let common_str = candidates[0].word for keyword in candidates[1:] while !neocomplcache#head_match(keyword.word, common_str) let common_str = common_str[: -2] endwhile endfor if &ignorecase let common_str = tolower(common_str) endif let &ignorecase = ignorecase_save if common_str == '' return '' endif return (pumvisible() ? "\" : '') \ . repeat("\", len(complete_str)) . common_str endfunction"}}} " Manual complete wrapper. function! neocomplcache#mappings#start_manual_complete(...) "{{{ if !neocomplcache#is_enabled() return '' endif " Set context filetype. call neocomplcache#context_filetype#set() let neocomplcache = neocomplcache#get_current_neocomplcache() let sources = get(a:000, 0, \ keys(neocomplcache#available_sources())) let neocomplcache.manual_sources = neocomplcache#helper#get_sources_list( \ neocomplcache#util#convert2list(sources)) " Set function. let &l:completefunc = 'neocomplcache#complete#sources_manual_complete' " Start complete. return "\\\" endfunction"}}} function! neocomplcache#mappings#start_manual_complete_list(complete_pos, complete_str, candidates) "{{{ let neocomplcache = neocomplcache#get_current_neocomplcache() let [neocomplcache.complete_pos, \ neocomplcache.complete_str, neocomplcache.candidates] = \ [a:complete_pos, a:complete_str, a:candidates] " Set function. let &l:completefunc = 'neocomplcache#complete#auto_complete' " Start complete. return "\\\" endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/buffer_complete.vim ================================================ "============================================================================= " FILE: buffer_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Important variables. if !exists('s:buffer_sources') let s:buffer_sources = {} let s:async_dictionary_list = {} endif let s:source = { \ 'name' : 'buffer_complete', \ 'kind' : 'manual', \ 'mark' : '[B]', \ 'rank' : 5, \ 'min_pattern_length' : \ g:neocomplcache_auto_completion_start_length, \ 'hooks' : {}, \} function! s:source.hooks.on_init(context) "{{{ let s:buffer_sources = {} augroup neocomplcache "{{{ " Caching events autocmd BufEnter,BufRead,BufWinEnter * \ call s:check_source() autocmd CursorHold,CursorHoldI * \ call s:check_cache() autocmd BufWritePost * \ call s:check_recache() autocmd InsertEnter,InsertLeave * \ call neocomplcache#sources#buffer_complete#caching_current_line() augroup END"}}} " Create cache directory. if !isdirectory(neocomplcache#get_temporary_directory() . '/buffer_cache') \ && !neocomplcache#util#is_sudo() call mkdir(neocomplcache#get_temporary_directory() . '/buffer_cache', 'p') endif " Initialize script variables. "{{{ let s:buffer_sources = {} let s:cache_line_count = 70 let s:rank_cache_count = 1 let s:disable_caching_list = {} let s:async_dictionary_list = {} "}}} call s:check_source() endfunction "}}} function! s:source.hooks.on_final(context) "{{{ delcommand NeoComplCacheCachingBuffer delcommand NeoComplCachePrintSource delcommand NeoComplCacheOutputKeyword delcommand NeoComplCacheDisableCaching delcommand NeoComplCacheEnableCaching let s:buffer_sources = {} endfunction"}}} function! s:source.gather_candidates(context) "{{{ call s:check_source() let keyword_list = [] for [key, source] in s:get_sources_list() call neocomplcache#cache#check_cache_list('buffer_cache', \ source.path, s:async_dictionary_list, source.keyword_cache, 1) let keyword_list += neocomplcache#dictionary_filter( \ source.keyword_cache, a:context.complete_str) if key == bufnr('%') let source.accessed_time = localtime() endif endfor return keyword_list endfunction"}}} function! neocomplcache#sources#buffer_complete#define() "{{{ return s:source endfunction"}}} function! neocomplcache#sources#buffer_complete#get_frequencies() "{{{ " Current line caching. return get(get(s:buffer_sources, bufnr('%'), {}), 'frequencies', {}) endfunction"}}} function! neocomplcache#sources#buffer_complete#caching_current_line() "{{{ " Current line caching. return s:caching_current_buffer( \ max([1, line('.') - 10]), min([line('.') + 10, line('$')])) endfunction"}}} function! neocomplcache#sources#buffer_complete#caching_current_block() "{{{ " Current line caching. return s:caching_current_buffer( \ max([1, line('.') - 500]), min([line('.') + 500, line('$')])) endfunction"}}} function! s:caching_current_buffer(start, end) "{{{ " Current line caching. if !s:exists_current_source() call s:word_caching(bufnr('%')) endif let source = s:buffer_sources[bufnr('%')] let keyword_pattern = source.keyword_pattern let keyword_pattern2 = '^\%('.keyword_pattern.'\m\)' let keywords = source.keyword_cache let completion_length = 2 let line = join(getline(a:start, a:end)) let match = match(line, keyword_pattern) while match >= 0 "{{{ let match_str = matchstr(line, keyword_pattern2, match) " Ignore too short keyword. if len(match_str) >= g:neocomplcache_min_keyword_length "{{{ " Check dup. let key = tolower(match_str[: completion_length-1]) if !has_key(keywords, key) let keywords[key] = {} endif if !has_key(keywords[key], match_str) " Append list. let keywords[key][match_str] = match_str let source.frequencies[match_str] = 30 endif endif"}}} " Next match. let match = match(line, keyword_pattern, match + len(match_str)) endwhile"}}} endfunction"}}} function! s:get_sources_list() "{{{ let sources_list = [] let filetypes_dict = {} for filetype in neocomplcache#get_source_filetypes( \ neocomplcache#get_context_filetype()) let filetypes_dict[filetype] = 1 endfor for [key, source] in items(s:buffer_sources) if has_key(filetypes_dict, source.filetype) \ || has_key(filetypes_dict, '_') \ || bufnr('%') == key \ || (source.name ==# '[Command Line]' && bufnr('#') == key) call add(sources_list, [key, source]) endif endfor return sources_list endfunction"}}} function! s:initialize_source(srcname) "{{{ let path = fnamemodify(bufname(a:srcname), ':p') let filename = fnamemodify(path, ':t') if filename == '' let filename = '[No Name]' let path .= '/[No Name]' endif let ft = getbufvar(a:srcname, '&filetype') if ft == '' let ft = 'nothing' endif let buflines = getbufline(a:srcname, 1, '$') let keyword_pattern = neocomplcache#get_keyword_pattern(ft) let s:buffer_sources[a:srcname] = { \ 'keyword_cache' : {}, \ 'frequencies' : {}, \ 'name' : filename, 'filetype' : ft, \ 'keyword_pattern' : keyword_pattern, \ 'end_line' : len(buflines), \ 'accessed_time' : 0, \ 'cached_time' : 0, \ 'path' : path, 'loaded_cache' : 0, \ 'cache_name' : neocomplcache#cache#encode_name( \ 'buffer_cache', path), \} endfunction"}}} function! s:word_caching(srcname) "{{{ " Initialize source. call s:initialize_source(a:srcname) let source = s:buffer_sources[a:srcname] if !filereadable(source.path) \ || getbufvar(a:srcname, '&buftype') =~ 'nofile' return endif let source.cache_name = \ neocomplcache#cache#async_load_from_file( \ 'buffer_cache', source.path, \ source.keyword_pattern, 'B') let source.cached_time = localtime() let source.end_line = len(getbufline(a:srcname, 1, '$')) let s:async_dictionary_list[source.path] = [{ \ 'filename' : source.path, \ 'cachename' : source.cache_name, \ }] endfunction"}}} function! s:check_changed_buffer(bufnumber) "{{{ let source = s:buffer_sources[a:bufnumber] let ft = getbufvar(a:bufnumber, '&filetype') if ft == '' let ft = 'nothing' endif let filename = fnamemodify(bufname(a:bufnumber), ':t') if filename == '' let filename = '[No Name]' endif return s:buffer_sources[a:bufnumber].name != filename \ || s:buffer_sources[a:bufnumber].filetype != ft endfunction"}}} function! s:check_source() "{{{ if !s:exists_current_source() call neocomplcache#sources#buffer_complete#caching_current_block() return endif for bufnumber in range(1, bufnr('$')) " Check new buffer. let bufname = fnamemodify(bufname(bufnumber), ':p') if (!has_key(s:buffer_sources, bufnumber) \ || s:check_changed_buffer(bufnumber)) \ && !has_key(s:disable_caching_list, bufnumber) \ && (!neocomplcache#is_locked(bufnumber) || \ g:neocomplcache_disable_auto_complete) \ && !getwinvar(bufwinnr(bufnumber), '&previewwindow') \ && getfsize(bufname) < \ g:neocomplcache_caching_limit_file_size " Caching. call s:word_caching(bufnumber) endif if has_key(s:buffer_sources, bufnumber) let source = s:buffer_sources[bufnumber] call neocomplcache#cache#check_cache_list('buffer_cache', \ source.path, s:async_dictionary_list, source.keyword_cache, 1) endif endfor endfunction"}}} function! s:check_cache() "{{{ let release_accessd_time = \ localtime() - g:neocomplcache_release_cache_time for [key, source] in items(s:buffer_sources) " Check deleted buffer and access time. if !bufloaded(str2nr(key)) \ || (source.accessed_time > 0 && \ source.accessed_time < release_accessd_time) " Remove item. call remove(s:buffer_sources, key) endif endfor endfunction"}}} function! s:check_recache() "{{{ if !s:exists_current_source() return endif let release_accessd_time = \ localtime() - g:neocomplcache_release_cache_time let source = s:buffer_sources[bufnr('%')] " Check buffer access time. if (source.cached_time > 0 && source.cached_time < release_accessd_time) \ || (neocomplcache#util#has_vimproc() && line('$') != source.end_line) " Buffer recache. if g:neocomplcache_enable_debug echomsg 'Caching buffer: ' . bufname('%') endif call neocomplcache#sources#buffer_complete#caching_current_block() endif endfunction"}}} function! s:exists_current_source() "{{{ return has_key(s:buffer_sources, bufnr('%')) endfunction"}}} " Command functions. "{{{ function! neocomplcache#sources#buffer_complete#caching_buffer(name) "{{{ if a:name == '' let number = bufnr('%') else let number = bufnr(a:name) if number < 0 let bufnr = bufnr('%') " No swap warning. let save_shm = &shortmess set shortmess+=A " Open new buffer. execute 'silent! edit' fnameescape(a:name) let &shortmess = save_shm if bufnr('%') != bufnr setlocal nobuflisted execute 'buffer' bufnr endif endif let number = bufnr(a:name) endif " Word recaching. call s:word_caching(number) call s:caching_current_buffer(1, line('$')) endfunction"}}} function! neocomplcache#sources#buffer_complete#print_source(name) "{{{ if a:name == '' let number = bufnr('%') else let number = bufnr(a:name) if number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif if !has_key(s:buffer_sources, number) return endif silent put=printf('Print neocomplcache %d source.', number) for key in keys(s:buffer_sources[number]) silent put =printf('%s => %s', key, string(s:buffer_sources[number][key])) endfor endfunction"}}} function! neocomplcache#sources#buffer_complete#output_keyword(name) "{{{ if a:name == '' let number = bufnr('%') else let number = bufnr(a:name) if number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif if !has_key(s:buffer_sources, number) return endif " Output buffer. for keyword in neocomplcache#unpack_dictionary( \ s:buffer_sources[number].keyword_cache) silent put=string(keyword) endfor endfunction "}}} function! neocomplcache#sources#buffer_complete#disable_caching(name) "{{{ if a:name == '' let number = bufnr('%') else let number = bufnr(a:name) if number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif let s:disable_caching_list[number] = 1 if has_key(s:buffer_sources, number) " Delete source. call remove(s:buffer_sources, number) endif endfunction"}}} function! neocomplcache#sources#buffer_complete#enable_caching(name) "{{{ if a:name == '' let number = bufnr('%') else let number = bufnr(a:name) if number < 0 call neocomplcache#print_error('Invalid buffer name.') return endif endif if has_key(s:disable_caching_list, number) call remove(s:disable_caching_list, number) endif endfunction"}}} "}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/dictionary_complete.vim ================================================ "============================================================================= " FILE: dictionary_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Important variables. if !exists('s:dictionary_list') let s:dictionary_list = {} let s:async_dictionary_list = {} endif function! neocomplcache#sources#dictionary_complete#define() "{{{ return s:source endfunction"}}} let s:source = { \ 'name' : 'dictionary_complete', \ 'kind' : 'keyword', \ 'mark' : '[D]', \ 'rank' : 4, \} function! s:source.initialize() "{{{ " Initialize dictionary. "{{{ if !exists('g:neocomplcache_dictionary_filetype_lists') let g:neocomplcache_dictionary_filetype_lists = {} endif if !has_key(g:neocomplcache_dictionary_filetype_lists, 'default') let g:neocomplcache_dictionary_filetype_lists['default'] = '' endif "}}} " Initialize dictionary completion pattern. "{{{ if !exists('g:neocomplcache_dictionary_patterns') let g:neocomplcache_dictionary_patterns = {} endif "}}} " Set caching event. autocmd neocomplcache FileType * call s:caching() " Create cache directory. if !isdirectory(neocomplcache#get_temporary_directory() . '/dictionary_cache') \ && !neocomplcache#util#is_sudo() call mkdir(neocomplcache#get_temporary_directory() . '/dictionary_cache') endif " Initialize check. call s:caching() endfunction"}}} function! s:source.finalize() "{{{ delcommand NeoComplCacheCachingDictionary endfunction"}}} function! s:source.get_keyword_list(complete_str) "{{{ let list = [] let filetype = neocomplcache#is_text_mode() ? \ 'text' : neocomplcache#get_context_filetype() if !has_key(s:dictionary_list, filetype) " Caching. call s:caching() endif for ft in neocomplcache#get_source_filetypes(filetype) call neocomplcache#cache#check_cache('dictionary_cache', ft, \ s:async_dictionary_list, s:dictionary_list, 1) for dict in neocomplcache#get_sources_list(s:dictionary_list, ft) let list += neocomplcache#dictionary_filter(dict, a:complete_str) endfor endfor return list endfunction"}}} function! s:caching() "{{{ if !bufloaded(bufnr('%')) return endif let key = neocomplcache#is_text_mode() ? \ 'text' : neocomplcache#get_context_filetype() for filetype in neocomplcache#get_source_filetypes(key) if !has_key(s:dictionary_list, filetype) \ && !has_key(s:async_dictionary_list, filetype) call neocomplcache#sources#dictionary_complete#recaching(filetype) endif endfor endfunction"}}} function! s:caching_dictionary(filetype) let filetype = a:filetype if filetype == '' let filetype = neocomplcache#get_context_filetype(1) endif if has_key(s:async_dictionary_list, filetype) \ && filereadable(s:async_dictionary_list[filetype].cache_name) " Delete old cache. call delete(s:async_dictionary_list[filetype].cache_name) endif call neocomplcache#sources#dictionary_complete#recaching(filetype) endfunction function! neocomplcache#sources#dictionary_complete#recaching(filetype) "{{{ if !exists('g:neocomplcache_dictionary_filetype_lists') call neocomplcache#initialize() endif let filetype = a:filetype if filetype == '' let filetype = neocomplcache#get_context_filetype(1) endif " Caching. let dictionaries = get( \ g:neocomplcache_dictionary_filetype_lists, filetype, '') if dictionaries == '' if filetype != &filetype && \ &l:dictionary != '' && &l:dictionary !=# &g:dictionary let dictionaries .= &l:dictionary endif endif let s:async_dictionary_list[filetype] = [] let pattern = get(g:neocomplcache_dictionary_patterns, filetype, \ neocomplcache#get_keyword_pattern(filetype)) for dictionary in split(dictionaries, ',') let dictionary = neocomplcache#util#substitute_path_separator( \ fnamemodify(dictionary, ':p')) if filereadable(dictionary) call neocomplcache#print_debug('Caching dictionary: ' . dictionary) call add(s:async_dictionary_list[filetype], { \ 'filename' : dictionary, \ 'cachename' : neocomplcache#cache#async_load_from_file( \ 'dictionary_cache', dictionary, pattern, 'D') \ }) endif endfor endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/filename_complete.vim ================================================ "============================================================================= " FILE: filename_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 20 Jun 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim let s:source = { \ 'name' : 'filename_complete', \ 'kind' : 'manual', \ 'mark' : '[F]', \ 'rank' : 3, \ 'min_pattern_length' : \ g:neocomplcache_auto_completion_start_length, \} function! s:source.initialize() "{{{ endfunction"}}} function! s:source.finalize() "{{{ endfunction"}}} function! s:source.get_keyword_pos(cur_text) "{{{ let filetype = neocomplcache#get_context_filetype() if filetype ==# 'vimshell' || filetype ==# 'unite' || filetype ==# 'int-ssh' return -1 endif " Filename pattern. let pattern = neocomplcache#get_keyword_pattern_end('filename') let [complete_pos, complete_str] = \ neocomplcache#match_word(a:cur_text, pattern) if complete_str =~ '//' || \ (neocomplcache#is_auto_complete() && \ (complete_str !~ '/' || \ complete_str =~# \ '\\[^ ;*?[]"={}'']\|\.\.\+$\|/c\%[ygdrive/]$')) " Not filename pattern. return -1 endif if neocomplcache#is_sources_complete() && complete_pos < 0 let complete_pos = len(a:cur_text) endif return complete_pos endfunction"}}} function! s:source.get_complete_words(complete_pos, complete_str) "{{{ return s:get_glob_files(a:complete_str, '') endfunction"}}} let s:cached_files = {} function! s:get_glob_files(complete_str, path) "{{{ let path = ',,' . substitute(a:path, '\.\%(,\|$\)\|,,', '', 'g') let complete_str = neocomplcache#util#substitute_path_separator( \ substitute(a:complete_str, '\\\(.\)', '\1', 'g')) let glob = (complete_str !~ '\*$')? \ complete_str . '*' : complete_str if a:path == '' && complete_str !~ '/' if !has_key(s:cached_files, getcwd()) call s:caching_current_files() endif let files = copy(s:cached_files[getcwd()]) else let ftype = getftype(glob) if ftype != '' && ftype !=# 'dir' " Note: If glob() device files, Vim may freeze! return [] endif if a:path == '' let files = neocomplcache#util#glob(glob) else try let globs = globpath(path, glob) catch return [] endtry let files = split(substitute(globs, '\\', '/', 'g'), '\n') endif endif let files = neocomplcache#keyword_filter(map( \ files, '{ \ "word" : fnamemodify(v:val, ":t"), \ "orig" : v:val, \ }'), \ fnamemodify(complete_str, ':t')) if neocomplcache#is_auto_complete() \ && len(files) > g:neocomplcache_max_list let files = files[: g:neocomplcache_max_list - 1] endif let files = map(files, '{ \ "word" : substitute(v:val.orig, "//", "/", "g"), \ }') if a:complete_str =~ '^\$\h\w*' let env = matchstr(a:complete_str, '^\$\h\w*') let env_ev = eval(env) if neocomplcache#is_windows() let env_ev = substitute(env_ev, '\\', '/', 'g') endif let len_env = len(env_ev) else let len_env = 0 endif let home_pattern = '^'. \ neocomplcache#util#substitute_path_separator( \ expand('~')).'/' let exts = escape(substitute($PATHEXT, ';', '\\|', 'g'), '.') let dir_list = [] let file_list = [] for dict in files call add(isdirectory(dict.word) ? \ dir_list : file_list, dict) let dict.orig = dict.word if len_env != 0 && dict.word[: len_env-1] == env_ev let dict.word = env . dict.word[len_env :] endif let abbr = dict.word if isdirectory(dict.word) && dict.word !~ '/$' let abbr .= '/' if g:neocomplcache_enable_auto_delimiter let dict.word .= '/' endif elseif neocomplcache#is_windows() if '.'.fnamemodify(dict.word, ':e') =~ exts let abbr .= '*' endif elseif executable(dict.word) let abbr .= '*' endif let dict.abbr = abbr if a:complete_str =~ '^\~/' let dict.word = substitute(dict.word, home_pattern, '\~/', '') let dict.abbr = substitute(dict.abbr, home_pattern, '\~/', '') endif " Escape word. let dict.word = escape(dict.word, ' ;*?[]"={}''') endfor return dir_list + file_list endfunction"}}} function! s:caching_current_files() "{{{ let s:cached_files[getcwd()] = neocomplcache#util#glob('*') if !exists('vimproc#readdir') let s:cached_files[getcwd()] += neocomplcache#util#glob('.*') endif endfunction"}}} function! neocomplcache#sources#filename_complete#define() "{{{ return s:source endfunction"}}} function! neocomplcache#sources#filename_complete#get_complete_words(complete_str, path) "{{{ if !neocomplcache#is_enabled() return [] endif return s:get_glob_files(a:complete_str, a:path) endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/filename_include.vim ================================================ "============================================================================= " FILE: filename_include.vim " AUTHOR: Shougo Matsushita " Last Modified: 29 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Global options definition. "{{{ if !exists('g:neocomplcache_include_patterns') let g:neocomplcache_include_patterns = {} endif if !exists('g:neocomplcache_include_exprs') let g:neocomplcache_include_exprs = {} endif if !exists('g:neocomplcache_include_paths') let g:neocomplcache_include_paths = {} endif if !exists('g:neocomplcache_include_suffixes') let g:neocomplcache_include_suffixes = {} endif "}}} let s:source = { \ 'name' : 'filename_include', \ 'kind' : 'manual', \ 'mark' : '[FI]', \ 'rank' : 10, \ 'min_pattern_length' : \ g:neocomplcache_auto_completion_start_length, \} function! s:source.initialize() "{{{ " Initialize. " Initialize filename include expr. "{{{ let g:neocomplcache_filename_include_exprs = \ get(g:, 'neocomplcache_filename_include_exprs', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_filename_include_exprs', \ 'perl', \ 'fnamemodify(substitute(v:fname, "/", "::", "g"), ":r")') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_filename_include_exprs', \ 'ruby,python,java,d', \ 'fnamemodify(substitute(v:fname, "/", ".", "g"), ":r")') "}}} " Initialize filename include extensions. "{{{ let g:neocomplcache_filename_include_exts = \ get(g:, 'neocomplcache_filename_include_exts', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_filename_include_exts', \ 'c', ['h']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_filename_include_exts', \ 'cpp', ['', 'h', 'hpp', 'hxx']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_filename_include_exts', \ 'perl', ['pm']) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_filename_include_exts', \ 'java', ['java']) "}}} endfunction"}}} function! s:source.finalize() "{{{ endfunction"}}} function! s:source.get_keyword_pos(cur_text) "{{{ let filetype = neocomplcache#get_context_filetype() " Not Filename pattern. if exists('g:neocomplcache_include_patterns') let pattern = get(g:neocomplcache_include_patterns, filetype, \ &l:include) else let pattern = '' endif if neocomplcache#is_auto_complete() \ && (pattern == '' || a:cur_text !~ pattern) \ && a:cur_text =~ '\*$\|\.\.\+$\|/c\%[ygdrive/]$' " Skip filename completion. return -1 endif " Check include pattern. let pattern = get(g:neocomplcache_include_patterns, filetype, \ &l:include) if pattern == '' || a:cur_text !~ pattern return -1 endif let match_end = matchend(a:cur_text, pattern) let complete_str = matchstr(a:cur_text[match_end :], '\f\+') let expr = get(g:neocomplcache_include_exprs, filetype, \ &l:includeexpr) if expr != '' let cur_text = \ substitute(eval(substitute(expr, \ 'v:fname', string(complete_str), 'g')), \ '\.\w*$', '', '') endif let complete_pos = len(a:cur_text) - len(complete_str) if neocomplcache#is_sources_complete() && complete_pos < 0 let complete_pos = len(a:cur_text) endif return complete_pos endfunction"}}} function! s:source.get_complete_words(complete_pos, complete_str) "{{{ return s:get_include_files(a:complete_str) endfunction"}}} function! s:get_include_files(complete_str) "{{{ let filetype = neocomplcache#get_context_filetype() let path = neocomplcache#util#substitute_path_separator( \ get(g:neocomplcache_include_paths, filetype, \ &l:path)) let pattern = get(g:neocomplcache_include_patterns, filetype, \ &l:include) let expr = get(g:neocomplcache_include_exprs, filetype, \ &l:includeexpr) let reverse_expr = get(g:neocomplcache_filename_include_exprs, filetype, \ '') let exts = get(g:neocomplcache_filename_include_exts, filetype, \ []) let line = neocomplcache#get_cur_text() if line =~ '^\s*\' && &filetype =~# 'ruby' " For require_relative. let path = '.' endif let match_end = matchend(line, pattern) let complete_str = matchstr(line[match_end :], '\f\+') if expr != '' let complete_str = \ substitute(eval(substitute(expr, \ 'v:fname', string(complete_str), 'g')), '\.\w*$', '', '') endif " Path search. let glob = (complete_str !~ '\*$')? \ complete_str . '*' : complete_str let cwd = getcwd() let bufdirectory = neocomplcache#util#substitute_path_separator( \ fnamemodify(expand('%'), ':p:h')) let dir_list = [] let file_list = s:get_default_include_files(filetype) for subpath in split(path, '[,;]') let dir = (subpath == '.') ? bufdirectory : subpath if !isdirectory(dir) continue endif execute 'lcd' fnameescape(dir) for word in split( \ neocomplcache#util#substitute_path_separator( \ glob(glob)), '\n') let dict = { 'word' : word } call add(isdirectory(word) ? dir_list : file_list, dict) let abbr = dict.word if isdirectory(word) let abbr .= '/' if g:neocomplcache_enable_auto_delimiter let dict.word .= '/' endif elseif !empty(exts) && \ index(exts, fnamemodify(dict.word, ':e')) < 0 " Skip. continue endif let dict.abbr = abbr if reverse_expr != '' " Convert filename. let dict.word = eval(substitute(reverse_expr, \ 'v:fname', string(dict.word), 'g')) let dict.abbr = eval(substitute(reverse_expr, \ 'v:fname', string(dict.abbr), 'g')) else " Escape word. let dict.word = escape(dict.word, ' ;*?[]"={}''') endif endfor endfor execute 'lcd' fnameescape(cwd) return neocomplcache#keyword_filter(dir_list, a:complete_str) \ + neocomplcache#keyword_filter(file_list, a:complete_str) endfunction"}}} function! s:get_default_include_files(filetype) "{{{ let files = [] if a:filetype ==# 'python' || a:filetype ==# 'python3' let files = ['sys'] endif return map(files, "{ 'word' : v:val }") endfunction"}}} function! neocomplcache#sources#filename_include#define() "{{{ return s:source endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/include_complete.vim ================================================ "============================================================================= " FILE: include_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim let s:source = { \ 'name' : 'include_complete', \ 'kind' : 'keyword', \ 'rank' : 8, \} function! s:source.initialize() "{{{ call s:initialize_variables() if neocomplcache#has_vimproc() augroup neocomplcache " Caching events autocmd BufWritePost * call s:check_buffer('', 0) autocmd CursorHold * call s:check_cache() augroup END endif call neocomplcache#util#set_default( \ 'g:neocomplcache_include_max_processes', 20) " Create cache directory. if !isdirectory(neocomplcache#get_temporary_directory() . '/include_cache') \ && !neocomplcache#util#is_sudo() call mkdir(neocomplcache#get_temporary_directory() \ . '/include_cache', 'p') endif if neocomplcache#exists_echodoc() call echodoc#register('include_complete', s:doc_dict) endif endfunction"}}} function! s:source.finalize() "{{{ delcommand NeoComplCacheCachingInclude if neocomplcache#exists_echodoc() call echodoc#unregister('include_complete') endif endfunction"}}} function! s:source.get_keyword_list(complete_str) "{{{ if neocomplcache#within_comment() return [] endif if !has_key(s:include_info, bufnr('%')) " Auto caching. call s:check_buffer('', 0) endif let keyword_list = [] " Check caching. for include in s:include_info[bufnr('%')].include_files call neocomplcache#cache#check_cache( \ 'include_cache', include, s:async_include_cache, s:include_cache) if has_key(s:include_cache, include) let s:cache_accessed_time[include] = localtime() let keyword_list += neocomplcache#dictionary_filter( \ s:include_cache[include], a:complete_str) endif endfor return neocomplcache#keyword_filter( \ neocomplcache#dup_filter(keyword_list), a:complete_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 copy(s:include_info[a:bufnumber].include_files) else return s:get_buffer_include_files(a:bufnumber) endif endfunction"}}} function! neocomplcache#sources#include_complete#get_include_tags(bufnumber) "{{{ return filter(map( \ neocomplcache#sources#include_complete#get_include_files(a:bufnumber), \ "neocomplcache#cache#encode_name('tags_output', v:val)"), \ 'filereadable(v:val)') endfunction"}}} " For Debug. function! neocomplcache#sources#include_complete#get_current_include_files() "{{{ return s:get_buffer_include_files(bufnr('%')) 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 let completion_length = 2 " Collect words. let words = [] let i = 0 while i >= 0 let word = matchstr(a:cur_text, '\k\+', i) if len(word) >= completion_length call add(words, word) endif let i = matchend(a:cur_text, '\k\+', i) endwhile for word in reverse(words) let key = tolower(word[: completion_length-1]) for include in filter(copy(s:include_info[bufnr('%')].include_files), \ 'has_key(s:include_cache, v:val) && has_key(s:include_cache[v:val], key)') for matched in filter(values(s:include_cache[include][key]), \ 'v:val.word ==# word && has_key(v:val, "kind") && v:val.kind != ""') let ret = [] let match = match(matched.abbr, neocomplcache#escape_match(word)) if match > 0 call add(ret, { 'text' : matched.abbr[ : match-1] }) endif call add(ret, { 'text' : word, 'highlight' : 'Identifier' }) call add(ret, { 'text' : matched.abbr[match+len(word) :] }) if match > 0 || len(ret[-1].text) > 0 return ret endif endfor endfor endfor return [] endfunction"}}} "}}} function! s:check_buffer(bufnumber, is_force) "{{{ if !neocomplcache#is_enabled_source('include_complete') return endif let bufnumber = (a:bufnumber == '') ? bufnr('%') : a:bufnumber let filename = fnamemodify(bufname(bufnumber), ':p') if !has_key(s:include_info, bufnumber) " Initialize. let s:include_info[bufnumber] = { \ 'include_files' : [], 'lines' : [], \ 'async_files' : {}, \ } endif if !executable(g:neocomplcache_ctags_program) \ || (!a:is_force && !neocomplcache#has_vimproc()) return endif let include_info = s:include_info[bufnumber] if a:is_force || include_info.lines !=# getbufline(bufnumber, 1, 100) let include_info.lines = getbufline(bufnumber, 1, 100) " Check include files contained bufname. let include_files = s:get_buffer_include_files(bufnumber) " Check include files from function. let filetype = getbufvar(a:bufnumber, '&filetype') let function = get(g:neocomplcache_include_functions, filetype, '') if function != '' && getbufvar(bufnumber, '&buftype') !~ 'nofile' let path = get(g:neocomplcache_include_paths, filetype, \ getbufvar(a:bufnumber, '&path')) let include_files += call(function, \ [getbufline(bufnumber, 1, (a:is_force ? '$' : 1000)), path]) endif if getbufvar(bufnumber, '&buftype') !~ 'nofile' \ && filereadable(filename) call add(include_files, filename) endif let include_info.include_files = neocomplcache#util#uniq(include_files) endif if g:neocomplcache_include_max_processes <= 0 return endif let filetype = getbufvar(bufnumber, '&filetype') if filetype == '' let filetype = 'nothing' endif for filename in include_info.include_files if (a:is_force || !has_key(include_info.async_files, filename)) \ && !has_key(s:include_cache, filename) if !a:is_force && has_key(s:async_include_cache, filename) \ && len(s:async_include_cache[filename]) \ >= g:neocomplcache_include_max_processes break endif " Caching. let s:async_include_cache[filename] \ = [ s:initialize_include(filename, filetype) ] let include_info.async_files[filename] = 1 endif endfor endfunction"}}} function! s:get_buffer_include_files(bufnumber) "{{{ let filetype = getbufvar(a:bufnumber, '&filetype') if filetype == '' return [] endif if (filetype ==# 'python' || filetype ==# 'python3') \ && (executable('python') || executable('python3')) " Initialize python path pattern. let path = '' if executable('python3') let path .= ',' . neocomplcache#system('python3 -', \ 'import sys;sys.stdout.write(",".join(sys.path))') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_paths', 'python3', path) endif if executable('python') let path .= ',' . neocomplcache#system('python -', \ 'import sys;sys.stdout.write(",".join(sys.path))') endif let path = join(neocomplcache#util#uniq(filter( \ split(path, ',', 1), "v:val != ''")), ',') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_paths', 'python', path) elseif filetype ==# 'cpp' && isdirectory('/usr/include/c++') " Add cpp path. call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_paths', 'cpp', \ getbufvar(a:bufnumber, '&path') . \ ','.join(split(glob('/usr/include/c++/*'), '\n'), ',')) endif let pattern = get(g:neocomplcache_include_patterns, filetype, \ getbufvar(a:bufnumber, '&include')) if pattern == '' return [] endif let path = get(g:neocomplcache_include_paths, filetype, \ getbufvar(a:bufnumber, '&path')) let expr = get(g:neocomplcache_include_exprs, filetype, \ getbufvar(a:bufnumber, '&includeexpr')) if has_key(g:neocomplcache_include_suffixes, filetype) let suffixes = &l:suffixesadd endif " Change current directory. let cwd_save = getcwd() let buffer_dir = fnamemodify(bufname(a:bufnumber), ':p:h') if isdirectory(buffer_dir) execute 'lcd' fnameescape(buffer_dir) endif let include_files = s:get_include_files(0, \ getbufline(a:bufnumber, 1, 100), filetype, pattern, path, expr) if isdirectory(buffer_dir) execute 'lcd' fnameescape(cwd_save) endif " Restore option. if has_key(g:neocomplcache_include_suffixes, filetype) let &l:suffixesadd = suffixes endif return include_files endfunction"}}} function! s:get_include_files(nestlevel, lines, filetype, pattern, path, expr) "{{{ let include_files = [] for line in a:lines "{{{ if line =~ a:pattern let match_end = matchend(line, a:pattern) if a:expr != '' let eval = substitute(a:expr, 'v:fname', \ string(matchstr(line[match_end :], '\f\+')), 'g') let filename = fnamemodify(findfile(eval(eval), a:path), ':p') else let filename = fnamemodify(findfile( \ matchstr(line[match_end :], '\f\+'), a:path), ':p') endif if filereadable(filename) call add(include_files, filename) if (a:filetype == 'c' || a:filetype == 'cpp') && a:nestlevel < 1 let include_files += s:get_include_files( \ a:nestlevel + 1, readfile(filename)[:100], \ a:filetype, a:pattern, a:path, a:expr) endif elseif isdirectory(filename) && a:filetype ==# 'java' " For Java import with *. " Ex: import lejos.nxt.* let include_files += \ neocomplcache#util#glob(filename . '/*.java') endif endif endfor"}}} return include_files endfunction"}}} function! s:check_cache() "{{{ if neocomplcache#is_disabled_source('include_complete') return endif let release_accessd_time = localtime() - g:neocomplcache_release_cache_time for key in keys(s:include_cache) if has_key(s:cache_accessed_time, key) \ && s:cache_accessed_time[key] < release_accessd_time call remove(s:include_cache, key) endif endfor endfunction"}}} function! s:initialize_include(filename, filetype) "{{{ " Initialize include list from tags. return { \ 'filename' : a:filename, \ 'cachename' : neocomplcache#cache#async_load_from_tags( \ 'include_cache', a:filename, a:filetype, 'I', 1) \ } endfunction"}}} function! neocomplcache#sources#include_complete#caching_include(bufname) "{{{ let bufnumber = (a:bufname == '') ? bufnr('%') : bufnr(a:bufname) if has_key(s:async_include_cache, bufnumber) \ && filereadable(s:async_include_cache[bufnumber].cache_name) " Delete old cache. call delete(s:async_include_cache[bufnumber].cache_name) endif " Initialize. if has_key(s:include_info, bufnumber) call remove(s:include_info, bufnumber) endif call s:check_buffer(bufnumber, 1) endfunction"}}} " Analyze include files functions. function! neocomplcache#sources#include_complete#analyze_vim_include_files(lines, path) "{{{ let include_files = [] let dup_check = {} for line in a:lines if line =~ '\<\h\w*#' && line !~ '\' let filename = 'autoload/' . substitute(matchstr(line, '\<\%(\h\w*#\)*\h\w*\ze#'), \ '#', '/', 'g') . '.vim' if filename == '' || has_key(dup_check, filename) continue endif let dup_check[filename] = 1 let filename = fnamemodify(findfile(filename, &runtimepath), ':p') if filereadable(filename) call add(include_files, filename) endif endif endfor return include_files endfunction"}}} function! neocomplcache#sources#include_complete#analyze_ruby_include_files(lines, path) "{{{ let include_files = [] let dup_check = {} for line in a:lines if line =~ '\' let args = split(line, ',') if len(args) < 2 continue endif let filename = substitute(matchstr(args[1], '["'']\zs\f\+\ze["'']'), \ '\.', '/', 'g') . '.rb' if filename == '' || has_key(dup_check, filename) continue endif let dup_check[filename] = 1 let filename = fnamemodify(findfile(filename, a:path), ':p') if filereadable(filename) call add(include_files, filename) endif endif endfor return include_files endfunction"}}} function! s:initialize_variables() "{{{ let s:include_info = {} let s:include_cache = {} let s:cache_accessed_time = {} let s:async_include_cache = {} let s:cached_pattern = {} " Initialize include pattern. "{{{ let g:neocomplcache_include_patterns = \ get(g:, 'neocomplcache_include_patterns', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_patterns', \ 'java,haskell', '^\s*\') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_patterns', \ 'c,cpp', '^\s*#\s*include') "}}} " Initialize expr pattern. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_include_exprs', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_exprs', \ 'haskell,cs', \ "substitute(v:fname, '\\.', '/', 'g')") "}}} " Initialize path pattern. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_include_paths', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_paths', 'c,cpp', \ &path) "}}} " Initialize include suffixes. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_include_suffixes', {}) call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_suffixes', \ 'haskell', '.hs') "}}} " Initialize include functions. "{{{ call neocomplcache#util#set_default( \ 'g:neocomplcache_include_functions', {}) " call neocomplcache#util#set_default_dictionary( " \ 'g:neocomplcache_include_functions', 'vim', " \ 'neocomplcache#sources#include_complete#analyze_vim_include_files') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_include_functions', 'ruby', \ 'neocomplcache#sources#include_complete#analyze_ruby_include_files') "}}} endfunction"}}} if !exists('s:include_info') call s:initialize_variables() endif let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/member_complete.vim ================================================ "============================================================================= " FILE: member_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 01 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Important variables. if !exists('s:member_sources') let s:member_sources = {} endif let s:source = { \ 'name' : 'member_complete', \ 'kind' : 'manual', \ 'mark' : '[M]', \ 'rank' : 5, \ 'min_pattern_length' : 0, \} function! s:source.initialize() "{{{ augroup neocomplcache "{{{ " Caching events autocmd CursorHold * call s:caching_current_buffer(line('.')-10, line('.')+10) autocmd InsertEnter,InsertLeave * \ call neocomplcache#sources#member_complete#caching_current_line() augroup END"}}} " Initialize member prefix patterns. "{{{ if !exists('g:neocomplcache_member_prefix_patterns') let g:neocomplcache_member_prefix_patterns = {} endif call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_member_prefix_patterns', \ 'c,cpp,objc,objcpp', '\.\|->') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_member_prefix_patterns', \ 'perl,php', '->') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_member_prefix_patterns', \ 'cs,java,javascript,d,vim,ruby,python,perl6,scala,vb', '\.') call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_member_prefix_patterns', \ 'lua', '\.\|:') "}}} " Initialize member patterns. "{{{ if !exists('g:neocomplcache_member_patterns') let g:neocomplcache_member_patterns = {} endif call neocomplcache#util#set_default_dictionary( \ 'g:neocomplcache_member_patterns', \'default', '\h\w*\%(()\|\[\h\w*\]\)\?') "}}} " Initialize script variables. "{{{ let s:member_sources = {} "}}} endfunction "}}} function! s:source.get_keyword_pos(cur_text) "{{{ " Check member prefix pattern. let filetype = neocomplcache#get_context_filetype() if !has_key(g:neocomplcache_member_prefix_patterns, filetype) \ || g:neocomplcache_member_prefix_patterns[filetype] == '' return -1 endif let member = s:get_member_pattern(filetype) let prefix = g:neocomplcache_member_prefix_patterns[filetype] let complete_pos = matchend(a:cur_text, \ '\%(' . member . '\%(' . prefix . '\m\)\)\+\ze\w*$') return complete_pos endfunction"}}} function! s:source.get_complete_words(complete_pos, complete_str) "{{{ " Check member prefix pattern. let filetype = neocomplcache#get_context_filetype() if !has_key(g:neocomplcache_member_prefix_patterns, filetype) \ || g:neocomplcache_member_prefix_patterns[filetype] == '' return [] endif let cur_text = neocomplcache#get_cur_text() let var_name = matchstr(cur_text, \ '\%(' . s:get_member_pattern(filetype) . '\%(' . \ g:neocomplcache_member_prefix_patterns[filetype] . '\m\)\)\+\ze\w*$') if var_name == '' return [] endif return neocomplcache#keyword_filter( \ copy(s:get_member_list(cur_text, var_name)), a:complete_str) endfunction"}}} function! neocomplcache#sources#member_complete#define() "{{{ return s:source endfunction"}}} function! neocomplcache#sources#member_complete#caching_current_line() "{{{ " Current line caching. return s:caching_current_buffer(line('.')-1, line('.')+1) endfunction"}}} function! neocomplcache#sources#member_complete#caching_current_buffer() "{{{ " Current line caching. return s:caching_current_buffer(1, line('$')) endfunction"}}} function! s:caching_current_buffer(start, end) "{{{ " Current line caching. if !has_key(s:member_sources, bufnr('%')) call s:initialize_source(bufnr('%')) endif let filetype = neocomplcache#get_context_filetype(1) if !has_key(g:neocomplcache_member_prefix_patterns, filetype) \ || g:neocomplcache_member_prefix_patterns[filetype] == '' return endif let source = s:member_sources[bufnr('%')] let keyword_pattern = \ '\%(' . s:get_member_pattern(filetype) . '\%(' \ . g:neocomplcache_member_prefix_patterns[filetype] \ . '\m\)\)\+' . s:get_member_pattern(filetype) let keyword_pattern2 = '^'.keyword_pattern let member_pattern = s:get_member_pattern(filetype) . '$' " Cache member pattern. let [line_num, max_lines] = [a:start, a:end] for line in getline(a:start, a:end) let match = match(line, keyword_pattern) while match >= 0 "{{{ let match_str = matchstr(line, keyword_pattern2, match) " Next match. let match = matchend(line, keyword_pattern, match + len(match_str)) while match_str != '' let member_name = matchstr(match_str, member_pattern) if member_name == '' break endif let var_name = match_str[ : -len(member_name)-1] if !has_key(source.member_cache, var_name) let source.member_cache[var_name] = {} endif if !has_key(source.member_cache[var_name], member_name) let source.member_cache[var_name][member_name] = member_name endif let match_str = matchstr(var_name, keyword_pattern2) endwhile endwhile"}}} endfor endfunction"}}} function! s:get_member_list(cur_text, var_name) "{{{ let keyword_list = [] for [key, source] in filter(s:get_sources_list(), \ 'has_key(v:val[1].member_cache, a:var_name)') let keyword_list += \ values(source.member_cache[a:var_name]) endfor return keyword_list endfunction"}}} function! s:get_sources_list() "{{{ let sources_list = [] let filetypes_dict = {} for filetype in neocomplcache#get_source_filetypes( \ neocomplcache#get_context_filetype()) let filetypes_dict[filetype] = 1 endfor for [key, source] in items(s:member_sources) if has_key(filetypes_dict, source.filetype) \ || has_key(filetypes_dict, '_') \ || bufnr('%') == key \ || (bufname('%') ==# '[Command Line]' && bufnr('#') == key) call add(sources_list, [key, source]) endif endfor return sources_list endfunction"}}} function! s:initialize_source(srcname) "{{{ let path = fnamemodify(bufname(a:srcname), ':p') let filename = fnamemodify(path, ':t') if filename == '' let filename = '[No Name]' let path .= '/[No Name]' endif " Set cache line count. let buflines = getbufline(a:srcname, 1, '$') let end_line = len(buflines) let ft = getbufvar(a:srcname, '&filetype') if ft == '' let ft = 'nothing' endif let s:member_sources[a:srcname] = { \ 'member_cache' : {}, 'filetype' : ft, \ 'keyword_pattern' : neocomplcache#get_keyword_pattern(ft), \} endfunction"}}} function! s:get_member_pattern(filetype) "{{{ return has_key(g:neocomplcache_member_patterns, a:filetype) ? \ g:neocomplcache_member_patterns[a:filetype] : \ g:neocomplcache_member_patterns['default'] endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/omni_complete.vim ================================================ "============================================================================= " FILE: omni_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 29 May 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim let s:source = { \ 'name' : 'omni_complete', \ 'kind' : 'manual', \ 'compare_func' : 'neocomplcache#compare_nothing', \ 'mark' : '[O]', \ 'rank' : 50, \} function! s:source.initialize() "{{{ " Initialize omni completion pattern. "{{{ if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'html,xhtml,xml,markdown', \'<[^>]*') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'css,scss,sass', \'^\s\+\w\+\|\w\+[):;]\?\s\+\w*\|[@!]') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'javascript', \'[^. \t]\.\%(\h\w*\)\?') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'actionscript', \'[^. \t][.:]\h\w*') "call neocomplcache#util#set_default_dictionary( "\'g:neocomplcache_omni_patterns', "\'php', "\'[^. \t]->\h\w*\|\h\w*::') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'java', \'\%(\h\w*\|)\)\.') "call neocomplcache#util#set_default_dictionary( "\'g:neocomplcache_omni_patterns', "\'perl', "\'\h\w*->\h\w*\|\h\w*::') "call neocomplcache#util#set_default_dictionary( "\'g:neocomplcache_omni_patterns', "\'c', "\'[^.[:digit:] *\t]\%(\.\|->\)' "call neocomplcache#util#set_default_dictionary( "\'g:neocomplcache_omni_patterns', "\'cpp', "\'[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'objc', \'[^.[:digit:] *\t]\%(\.\|->\)') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'objj', \'[\[ \.]\w\+$\|:\w*$') " External language interface check. if has('ruby') " call neocomplcache#util#set_default_dictionary( "\'g:neocomplcache_omni_patterns', 'ruby', "\'[^. *\t]\.\h\w*\|\h\w*::') endif if has('python/dyn') || has('python3/dyn') \ || has('python') || has('python3') call neocomplcache#util#set_default_dictionary( \'g:neocomplcache_omni_patterns', \'python', '[^. \t]\.\w*') endif "}}} endfunction"}}} function! s:source.finalize() "{{{ endfunction"}}} function! s:source.get_keyword_pos(cur_text) "{{{ let syn_name = neocomplcache#helper#get_syn_name(1) if syn_name ==# 'Comment' || syn_name ==# 'String' " Skip omni_complete in string literal. return -1 endif let filetype = neocomplcache#get_context_filetype() let s:complete_results = s:set_complete_results_pos( \ s:get_omni_funcs(filetype), a:cur_text) return s:get_complete_pos(s:complete_results) endfunction"}}} function! s:source.get_complete_words(complete_pos, complete_str) "{{{ return s:get_candidates( \ s:set_complete_results_words(s:complete_results), \ a:complete_pos, a:complete_str) endfunction"}}} function! neocomplcache#sources#omni_complete#define() "{{{ return s:source endfunction"}}} function! s:get_omni_funcs(filetype) "{{{ let funcs = [] for ft in insert(split(a:filetype, '\.'), '_') if has_key(g:neocomplcache_omni_functions, ft) let omnifuncs = \ (type(g:neocomplcache_omni_functions[ft]) == type([])) ? \ g:neocomplcache_omni_functions[ft] : \ [g:neocomplcache_omni_functions[ft]] else let omnifuncs = [&l:omnifunc] endif for omnifunc in omnifuncs if neocomplcache#check_invalid_omnifunc(omnifunc) " omnifunc is irregal. continue endif if get(g:neocomplcache_omni_patterns, omnifunc, '') != '' let pattern = g:neocomplcache_omni_patterns[omnifunc] elseif get(g:neocomplcache_omni_patterns, ft, '') != '' let pattern = g:neocomplcache_omni_patterns[ft] else let pattern = '' endif if pattern == '' continue endif call add(funcs, [omnifunc, pattern]) endfor endfor return neocomplcache#util#uniq(funcs) endfunction"}}} function! s:get_omni_list(list) "{{{ let omni_list = [] " Convert string list. for val in deepcopy(a:list) let dict = (type(val) == type('') ? \ { 'word' : val } : val) let dict.menu = '[O]' . get(dict, 'menu', '') call add(omni_list, dict) unlet val endfor return omni_list endfunction"}}} function! s:set_complete_results_pos(funcs, cur_text) "{{{ " Try omnifunc completion. "{{{ let complete_results = {} for [omnifunc, pattern] in a:funcs if neocomplcache#is_auto_complete() \ && a:cur_text !~ '\%(' . pattern . '\m\)$' continue endif " Save pos. let pos = getpos('.') try let complete_pos = call(omnifunc, [1, '']) catch call neocomplcache#print_error( \ 'Error occurred calling omnifunction: ' . omnifunc) call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) let complete_pos = -1 finally if getpos('.') != pos call setpos('.', pos) endif endtry if complete_pos < 0 continue endif let complete_str = a:cur_text[complete_pos :] let complete_results[omnifunc] = { \ 'candidates' : [], \ 'complete_pos' : complete_pos, \ 'complete_str' : complete_str, \ 'omnifunc' : omnifunc, \} endfor "}}} return complete_results endfunction"}}} function! s:set_complete_results_words(complete_results) "{{{ " Try source completion. for [omnifunc, result] in items(a:complete_results) if neocomplcache#complete_check() return a:complete_results endif let pos = getpos('.') " Note: For rubycomplete problem. let complete_str = \ (omnifunc == 'rubycomplete#Complete') ? \ '' : result.complete_str try let list = call(omnifunc, [0, complete_str]) catch call neocomplcache#print_error( \ 'Error occurred calling omnifunction: ' . omnifunc) call neocomplcache#print_error(v:throwpoint) call neocomplcache#print_error(v:exception) let list = [] finally if getpos('.') != pos call setpos('.', pos) endif endtry if type(list) != type([]) " Error. return a:complete_results endif let list = s:get_omni_list(list) let result.candidates = list endfor return a:complete_results endfunction"}}} function! s:get_complete_pos(complete_results) "{{{ if empty(a:complete_results) return -1 endif let complete_pos = col('.') for result in values(a:complete_results) if complete_pos > result.complete_pos let complete_pos = result.complete_pos endif endfor return complete_pos endfunction"}}} function! s:get_candidates(complete_results, complete_pos, complete_str) "{{{ " Append prefix. let candidates = [] let len_words = 0 for [source_name, result] in items(a:complete_results) if result.complete_pos > a:complete_pos let prefix = a:complete_str[: result.complete_pos \ - a:complete_pos - 1] for keyword in result.candidates let keyword.word = prefix . keyword.word endfor endif let candidates += result.candidates endfor return candidates endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/syntax_complete.vim ================================================ "============================================================================= " FILE: syntax_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Important variables. if !exists('s:syntax_list') let s:syntax_list = {} endif let s:source = { \ 'name' : 'syntax_complete', \ 'kind' : 'keyword', \ 'mark' : '[S]', \ 'rank' : 4, \} function! s:source.initialize() "{{{ " Set caching event. autocmd neocomplcache Syntax * call s:caching() " Create cache directory. if !isdirectory(neocomplcache#get_temporary_directory() . '/syntax_cache') \ && !neocomplcache#util#is_sudo() call mkdir(neocomplcache#get_temporary_directory() . '/syntax_cache') endif " Initialize check. call s:caching() endfunction"}}} function! s:source.finalize() "{{{ delcommand NeoComplCacheCachingSyntax endfunction"}}} function! s:source.get_keyword_list(complete_str) "{{{ let list = [] let filetype = neocomplcache#get_context_filetype() if !has_key(s:syntax_list, filetype) call s:caching() endif for syntax in neocomplcache#get_sources_list( \ s:syntax_list, filetype) let list += neocomplcache#dictionary_filter(syntax, a:complete_str) endfor return list endfunction"}}} function! neocomplcache#sources#syntax_complete#define() "{{{ return s:source endfunction"}}} function! s:caching() "{{{ if &filetype == '' || &filetype ==# 'vim' return endif for filetype in neocomplcache#get_source_filetypes(&filetype) if !has_key(s:syntax_list, filetype) " Check old cache. let cache_name = neocomplcache#cache#encode_name('syntax_cache', &filetype) let syntax_files = split( \ globpath(&runtimepath, 'syntax/'.&filetype.'.vim'), '\n') if getftime(cache_name) < 0 || (!empty(syntax_files) \ && getftime(cache_name) <= getftime(syntax_files[0])) if filetype ==# &filetype " Caching from syn list. let s:syntax_list[filetype] = s:caching_from_syn(filetype) endif else let s:syntax_list[filetype] = neocomplcache#cache#index_load_from_cache( \ 'syntax_cache', filetype, 1) endif endif endfor endfunction"}}} function! neocomplcache#sources#syntax_complete#recaching(filetype) "{{{ if a:filetype == '' let filetype = &filetype else let filetype = a:filetype endif " Caching. let s:syntax_list[filetype] = s:caching_from_syn(filetype) endfunction"}}} function! s:caching_from_syn(filetype) "{{{ call neocomplcache#print_caching( \ 'Caching syntax "' . a:filetype . '"... please wait.') " Get current syntax list. redir => syntax_list silent! syntax list redir END if syntax_list =~ '^E\d\+' || syntax_list =~ '^No Syntax items' return [] endif let group_name = '' let keyword_pattern = neocomplcache#get_keyword_pattern(a:filetype) let dup_check = {} let filetype_pattern = tolower(a:filetype) let keyword_lists = {} for line in split(syntax_list, '\n') if line =~ '^\h\w\+' " Change syntax group name. let group_name = matchstr(line, '^\S\+') let line = substitute(line, '^\S\+\s*xxx', '', '') endif if line =~ 'Syntax items' || line =~ '^\s*links to' || \ line =~ '^\s*nextgroup=' || \ strridx(tolower(group_name), filetype_pattern) != 0 " Next line. continue endif let line = substitute(line, 'contained\|skipwhite\|skipnl\|oneline', '', 'g') let line = substitute(line, '^\s*nextgroup=.*\ze\s', '', '') if line =~ '^\s*match' let line = s:substitute_candidate(matchstr(line, '/\zs[^/]\+\ze/')) elseif line =~ '^\s*start=' let line = \s:substitute_candidate(matchstr(line, 'start=/\zs[^/]\+\ze/')) . ' ' . \s:substitute_candidate(matchstr(line, 'end=/zs[^/]\+\ze/')) endif " Add keywords. let match_num = 0 let completion_length = 2 let match_str = matchstr(line, keyword_pattern, match_num) while match_str != '' " Ignore too short keyword. if len(match_str) >= g:neocomplcache_min_syntax_length \ && !has_key(dup_check, match_str) \&& match_str =~ '^[[:print:]]\+$' let key = tolower(match_str[: completion_length-1]) if !has_key(keyword_lists, key) let keyword_lists[key] = [] endif call add(keyword_lists[key], match_str) let dup_check[match_str] = 1 endif let match_num += len(match_str) let match_str = matchstr(line, keyword_pattern, match_num) endwhile endfor " Save syntax cache. let unpack_lists = neocomplcache#unpack_dictionary(keyword_lists) if !empty(unpack_lists) call neocomplcache#cache#save_cache('syntax_cache', &filetype, unpack_lists) endif call neocomplcache#print_caching('') return keyword_lists endfunction"}}} function! s:substitute_candidate(candidate) "{{{ let candidate = a:candidate " Collection. let candidate = substitute(candidate, \'\\\@{}]\|[$^]\|\\z\?\a\)', ' ', 'g') if candidate =~ '\\%\?(' let candidate = join(s:split_pattern(candidate)) endif " \ let candidate = substitute(candidate, '\\\\', '\\', 'g') " * let candidate = substitute(candidate, '\\\*', '*', 'g') return candidate endfunction"}}} function! s:split_pattern(keyword_pattern) "{{{ let original_pattern = a:keyword_pattern let result_patterns = [] let analyzing_patterns = [ '' ] let i = 0 let max = len(original_pattern) while i < max if match(original_pattern, '^\\%\?(', i) >= 0 " Grouping. let end = s:match_pair(original_pattern, '\\%\?(', '\\)', i) if end < 0 "call neocomplcache#print_error('Unmatched (.') return [ a:keyword_pattern ] endif let save_pattern = analyzing_patterns let analyzing_patterns = [] for keyword in split(original_pattern[matchend(original_pattern, '^\\%\?(', i) : end], '\\|') for prefix in save_pattern call add(analyzing_patterns, prefix . keyword) endfor endfor let i = end + 1 elseif match(original_pattern, '^\\|', i) >= 0 " Select. let result_patterns += analyzing_patterns let analyzing_patterns = [ '' ] let original_pattern = original_pattern[i+2 :] let max = len(original_pattern) let i = 0 elseif original_pattern[i] == '\' && i+1 < max let save_pattern = analyzing_patterns let analyzing_patterns = [] for prefix in save_pattern call add(analyzing_patterns, prefix . original_pattern[i] . original_pattern[i+1]) endfor " Escape. let i += 2 else let save_pattern = analyzing_patterns let analyzing_patterns = [] for prefix in save_pattern call add(analyzing_patterns, prefix . original_pattern[i]) endfor let i += 1 endif endwhile let result_patterns += analyzing_patterns return result_patterns endfunction"}}} function! s:match_pair(string, start_pattern, end_pattern, start_cnt) "{{{ let end = -1 let start_pattern = '\%(' . a:start_pattern . '\)' let end_pattern = '\%(' . a:end_pattern . '\)' let i = a:start_cnt let max = len(a:string) let nest_level = 0 while i < max let start = match(a:string, start_pattern, i) let end = match(a:string, end_pattern, i) if start >= 0 && (end < 0 || start < end) let i = matchend(a:string, start_pattern, i) let nest_level += 1 elseif end >= 0 && (start < 0 || end < start) let nest_level -= 1 if nest_level == 0 return end endif let i = matchend(a:string, end_pattern, i) else break endif endwhile if nest_level != 0 return -1 else return end endif endfunction"}}} " Global options definition. "{{{ if !exists('g:neocomplcache_min_syntax_length') let g:neocomplcache_min_syntax_length = 4 endif "}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/tags_complete.vim ================================================ "============================================================================= " FILE: tags_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim " Important variables. if !exists('s:tags_list') let s:tags_list = {} let s:async_tags_list = {} endif let s:source = { \ 'name' : 'tags_complete', \ 'kind' : 'keyword', \} function! s:source.initialize() "{{{ let g:neocomplcache_tags_caching_limit_file_size = \ get(g:, 'neocomplcache_tags_caching_limit_file_size', 500000) " Create cache directory. if !isdirectory(neocomplcache#get_temporary_directory() . '/tags_cache') \ && !neocomplcache#util#is_sudo() call mkdir(neocomplcache#get_temporary_directory() . '/tags_cache', 'p') endif endfunction"}}} function! s:source.finalize() "{{{ delcommand NeoComplCacheCachingTags endfunction"}}} function! neocomplcache#sources#tags_complete#define() "{{{ return s:source endfunction"}}} function! s:source.get_keyword_list(complete_str) "{{{ if !has_key(s:async_tags_list, bufnr('%')) \ && !has_key(s:tags_list, bufnr('%')) call neocomplcache#sources#tags_complete#caching_tags(0) endif if neocomplcache#within_comment() return [] endif call neocomplcache#cache#check_cache( \ 'tags_cache', bufnr('%'), s:async_tags_list, s:tags_list) if !has_key(s:tags_list, bufnr('%')) return [] endif let keyword_list = neocomplcache#dictionary_filter( \ s:tags_list[bufnr('%')], a:complete_str) return neocomplcache#keyword_filter(keyword_list, a:complete_str) endfunction"}}} function! s:initialize_tags(filename) "{{{ " Initialize tags list. let ft = &filetype if ft == '' let ft = 'nothing' endif return { \ 'filename' : a:filename, \ 'cachename' : neocomplcache#cache#async_load_from_tags( \ 'tags_cache', a:filename, ft, 'T', 0) \ } endfunction"}}} function! neocomplcache#sources#tags_complete#caching_tags(force) "{{{ let bufnumber = bufnr('%') let s:async_tags_list[bufnumber] = [] for tags in map(filter(tagfiles(), 'getfsize(v:val) > 0'), \ "neocomplcache#util#substitute_path_separator( \ fnamemodify(v:val, ':p'))") if tags !~? '/doc/tags\%(-\w\+\)\?$' && \ (a:force || getfsize(tags) \ < g:neocomplcache_tags_caching_limit_file_size) call add(s:async_tags_list[bufnumber], \ s:initialize_tags(tags)) endif endfor endfunction"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: autoload/neocomplcache/sources/vim_complete/autocmds.dict ================================================ 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 CompleteDone ; after Insert mode completion is done 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 ================================================ FILE: autoload/neocomplcache/sources/vim_complete/command_args.dict ================================================ -bang ; the command can take a ! modifier (like :q or :w) -bar ; the command can be followed by a "|" and another command -buffer ; the command will only be available in the current buffer -complete=augroup ; autocmd groups -complete=behave ; :behave suboptions -complete=buffer ; buffer names -complete=color ; color schemes -complete=command ; Ex command (and arguments) -complete=compiler ; compilers -complete=cscope ; :cscope suboptions -complete=custom,{func} ; custom completion, defined via {func} -complete=customlist,{func} ; custom completion, defined via {func} -complete=dir ; directory names -complete=environment ; environment variable names -complete=event ; autocommand events -complete=expression ; Vim expression -complete=file ; file and directory names -complete=file_in_path ; file and directory names in 'path' -complete=filetype ; filetype names 'filetype' -complete=function ; function name -complete=help ; help subjects -complete=highlight ; highlight groups -complete=history ; :history suboptions -complete=locale ; locale names (as output of locale -a) -complete=mapping ; mapping name -complete=menu ; menus -complete=option ; options -complete=shellcmd ; Shell command -complete=sign ; :sign suboptions -complete=syntax ; syntax file names |'syntax'| -complete=tag ; tags -complete=tag_list ; tags, file names are shown when CTRL-D is hit -complete=tag_listfiles ; tags, file names are shown when CTRL-D is hit -complete=var ; user variables -count= ; a count (default N) in the line or as an initial argument -nargs=* ; any number of arguments are allowed (0, 1, or many) -nargs=+ ; arguments must be supplied, but any number are allowed -nargs=0 ; no arguments are allowed (the default) -nargs=1 ; exactly one argument is required -nargs=? ; 0 or 1 arguments are allowed -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,$) -register ; the first argument to the command can be an optional register name ================================================ FILE: autoload/neocomplcache/sources/vim_complete/command_completions.dict ================================================ 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] execute 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] ================================================ FILE: autoload/neocomplcache/sources/vim_complete/command_prototypes.dict ================================================ 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] [-bang -complete= -nargs=...] {cmdname} {call function()} | {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} ================================================ FILE: autoload/neocomplcache/sources/vim_complete/command_replaces.dict ================================================ ; 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 ================================================ FILE: autoload/neocomplcache/sources/vim_complete/commands.dict ================================================ 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 ================================================ FILE: autoload/neocomplcache/sources/vim_complete/features.dict ================================================ 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. compatible ; Compiled to be very Vi compatible. cryptv ; Compiled with encryption support |encryption|. cscope ; Compiled with |cscope| support. 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_~|. dos16 ; 16 bits DOS version of Vim. dos32 ; 32 bits DOS (DJGPP) 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_gnome ; Compiled with Gnome support (gui_gtk is also defined). gui_gtk ; Compiled with GTK+ GUI (any version). gui_gtk2 ; Compiled with GTK+ 2 GUI (gui_gtk is also defined). gui_mac ; Compiled with Macintosh GUI. gui_motif ; Compiled with Motif GUI. gui_photon ; Compiled with Photon GUI. gui_running ; Vim is running in the GUI, or it will start soon. gui_win32 ; Compiled with MS Windows Win32 GUI. gui_win32s ; idem, and Win32s system being used (Windows 3.1) 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| lua ; Compiled with Lua interface |Lua|. 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. 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. mouseshape ; Compiled with support for 'mouseshape'. 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_enabled ; Compiled with support for |netbeans| and it's used. netbeans_intg ; Compiled with support for |netbeans|. 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. persistent_undo ; Compiled with support for persistent undo history. postscript ; Compiled with PostScript file printing. printer ; Compiled with |:hardcopy| support. profile ; Compiled with |:profile| support. python ; Compiled with Python interface. python3 ; Compiled with Python3 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. spell ; Compiled with spell checking support |spell|. statusline ; Compiled with |--startuptime| support. sun_workshop ; Compiled with support for Sun |workshop|. 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_any_white ; Compiled with support for any white characters in tags files |tag-any-white|. 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|. 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. unnamedplus ; Usable '+' register instead of '*' register. user_commands ; User-defined commands. vertsplit ; Compiled with vertically split windows |:vsplit|. vim_starting ; True while initial source'ing takes place. viminfo ; Compiled with viminfo support. 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. win16 ; Win16 version of Vim (MS-Windows 3.1). win32 ; Win32 version of Vim (MS-Windows 95/98/ME/NT/2000/XP). win32unix ; Win32 version of Vim, using Unix files (Cygwin) win64 ; Win64 version of Vim (MS-Windows 64 bit). win95 ; Win32 version for MS-Windows 95/98/ME. winaltkeys ; Compiled with 'winaltkeys' option. windows ; Compiled with support for more than one window. writebackup ; Compiled with 'writebackup' default on. x11 ; Compiled with X11 support. xfontset ; Compiled with X fontset support |xfontset|. xim ; Compiled with X input method support |xim|. xpm_w32 ; Compiled with pixmap support for Win32. 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. ================================================ FILE: autoload/neocomplcache/sources/vim_complete/functions.dict ================================================ 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}]) ================================================ FILE: autoload/neocomplcache/sources/vim_complete/helper.vim ================================================ "============================================================================= " FILE: helper.vim " AUTHOR: Shougo Matsushita " Last Modified: 24 Apr 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " }}} "============================================================================= let s:save_cpo = &cpo set cpo&vim 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 bufnumber = 1 " Check buffer. while bufnumber <= bufnr('$') if getbufvar(bufnumber, '&filetype') == 'vim' && bufloaded(bufnumber) \&& !has_key(s:script_candidates_list, bufnumber) let s:script_candidates_list[bufnumber] = s:get_script_candidates(bufnumber) endif let 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 bufnumber = a:bufname != '' ? bufnr(a:bufname) : bufnr('%') if getbufvar(bufnumber, '&filetype') == 'vim' && bufloaded(bufnumber) let s:script_candidates_list[bufnumber] = s:get_script_candidates(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 cur_text = a:cur_text " Echo prototype. let script_candidates_list = s:get_cached_script_candidates() let prototype_name = matchstr(cur_text, \'\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\s*(\ze\%([^(]\|(.\{-})\)*$') let ret = [] if prototype_name != '' if !has_key(s:internal_candidates_list, 'function_prototypes') " No cache. return [] endif " Search function name. call add(ret, { 'text' : prototype_name, 'highlight' : 'Identifier' }) if has_key(s:internal_candidates_list.function_prototypes, prototype_name) call add(ret, { 'text' : s:internal_candidates_list.function_prototypes[prototype_name] }) elseif has_key(s:global_candidates_list.function_prototypes, prototype_name) call add(ret, { 'text' : s:global_candidates_list.function_prototypes[prototype_name] }) elseif has_key(script_candidates_list.function_prototypes, prototype_name) call add(ret, { 'text' : script_candidates_list.function_prototypes[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 prototype_name = neocomplcache#sources#vim_complete#get_command(cur_text) call add(ret, { 'text' : prototype_name, 'highlight' : 'Statement' }) if has_key(s:internal_candidates_list.command_prototypes, prototype_name) call add(ret, { 'text' : s:internal_candidates_list.command_prototypes[prototype_name] }) elseif has_key(s:global_candidates_list.command_prototypes, prototype_name) call add(ret, { 'text' : s:global_candidates_list.command_prototypes[prototype_name] }) else " No prototypes. return [] endif endif return ret endfunction"}}} "}}} function! neocomplcache#sources#vim_complete#helper#get_command_completion(command_name, cur_text, complete_str) "{{{ let completion_name = \ neocomplcache#sources#vim_complete#helper#get_completion_name(a:command_name) if completion_name == '' " Not found. return [] endif let args = (completion_name ==# 'custom' || completion_name ==# 'customlist')? \ [a:command_name, a:cur_text, a:complete_str] : [a:cur_text, a:complete_str] return call('neocomplcache#sources#vim_complete#helper#'.completion_name, 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 = \ neocomplcache#pack_dictionary(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, complete_str) "{{{ let args = s:split_args(a:cur_text, a:complete_str) if len(args) < 2 return [] endif " 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 let list = [] if len(args) == 2 let list += s:global_candidates_list.augroups + s:internal_candidates_list.autocmds elseif len(args) == 3 if args[1] ==# 'FileType' " Filetype completion. let list += neocomplcache#sources#vim_complete#helper#filetype(a:cur_text, a:complete_str) endif let list += s:internal_candidates_list.autocmds elseif len(args) == 4 if args[2] ==# 'FileType' " Filetype completion. let list += neocomplcache#sources#vim_complete#helper#filetype( \ a:cur_text, a:complete_str) endif let list += neocomplcache#sources#vim_complete#helper#command( \ args[3], a:complete_str) let list += s:make_completion_list(['nested'], '') else let command = args[3] =~ '^*' ? \ join(args[4:]) : join(args[3:]) let list += neocomplcache#sources#vim_complete#helper#command( \ command, a:complete_str) let list += s:make_completion_list(['nested'], '') endif return list endfunction"}}} function! neocomplcache#sources#vim_complete#helper#augroup(cur_text, complete_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, complete_str) "{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#colorscheme_args(cur_text, complete_str) "{{{ return s:make_completion_list(filter(map(split( \ globpath(&runtimepath, 'colors/*.vim'), '\n'), \ 'fnamemodify(v:val, ":t:r")'), \ 'stridx(v:val, a:complete_str) == 0'), '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#command(cur_text, complete_str) "{{{ if a:cur_text == '' || \ a:cur_text =~ '^[[:digit:],[:space:][:tab:]$''<>]*\h\w*$' " Commands. " Caching. if !has_key(s:global_candidates_list, 'commands') let s:global_candidates_list.commands = \ neocomplcache#pack_dictionary(s:get_cmdlist()) endif if !has_key(s:internal_candidates_list, 'commands') let s:internal_candidates_list.command_prototypes = \ s:caching_prototype_from_dict('command_prototypes') let commands = s:caching_from_dict('commands', 'c') for command in commands if has_key(s:internal_candidates_list.command_prototypes, command.word) let command.description = command.word . \ s:internal_candidates_list.command_prototypes[command.word] endif endfor let s:internal_candidates_list.commands = \ neocomplcache#pack_dictionary(commands) endif " echomsg string(s:internal_candidates_list.commands)[: 1000] " echomsg string(s:global_candidates_list.commands)[: 1000] let list = neocomplcache#dictionary_filter( \ s:internal_candidates_list.commands, a:complete_str) \ + neocomplcache#dictionary_filter( \ s:global_candidates_list.commands, a:complete_str) else " Commands args. let command = neocomplcache#sources#vim_complete#get_command(a:cur_text) let completion_name = \ neocomplcache#sources#vim_complete#helper#get_completion_name(command) " Prevent infinite loop. let cur_text = completion_name ==# 'command' ? \ a:cur_text[len(command):] : a:cur_text let list = neocomplcache#sources#vim_complete#helper#get_command_completion( \ command, cur_text, a:complete_str) if a:cur_text =~ \'[[(,{]\|`=[^`]*$' " Expression. let list += neocomplcache#sources#vim_complete#helper#expression( \ a:cur_text, a:complete_str) endif endif return list endfunction"}}} function! neocomplcache#sources#vim_complete#helper#command_args(cur_text, complete_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, complete_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:complete_str, getline('.'), len(a:cur_text)]), '\n'), '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#customlist(command_name, cur_text, complete_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:complete_str, getline('.'), len(a:cur_text)]), '') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#dir(cur_text, complete_str) "{{{ return filter(neocomplcache#sources#filename_complete#get_complete_words( \ a:complete_str, '.'), 'isdirectory(v:val.word)') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#environment(cur_text, complete_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, complete_str) "{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#execute(cur_text, complete_str) "{{{ if a:cur_text =~ '["''][^"'']*$' let command = matchstr(a:cur_text, '["'']\zs[^"'']*$') return neocomplcache#sources#vim_complete#helper#command(command, a:complete_str) else return neocomplcache#sources#vim_complete#helper#expression(a:cur_text, a:complete_str) endif endfunction"}}} function! neocomplcache#sources#vim_complete#helper#expression(cur_text, complete_str) "{{{ return neocomplcache#sources#vim_complete#helper#function(a:cur_text, a:complete_str) \+ neocomplcache#sources#vim_complete#helper#var(a:cur_text, a:complete_str) endfunction"}}} function! neocomplcache#sources#vim_complete#helper#feature(cur_text, complete_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, complete_str) "{{{ return neocomplcache#sources#filename_complete#get_complete_words( \ a:complete_str, '.') endfunction"}}} function! neocomplcache#sources#vim_complete#helper#filetype(cur_text, complete_str) "{{{ if !has_key(s:internal_candidates_list, 'filetypes') let s:internal_candidates_list.filetypes = \ neocomplcache#pack_dictionary(s:make_completion_list(map( \ split(globpath(&runtimepath, 'syntax/*.vim'), '\n') + \ split(globpath(&runtimepath, 'indent/*.vim'), '\n') + \ split(globpath(&runtimepath, 'ftplugin/*.vim'), '\n') \ , "matchstr(fnamemodify(v:val, ':t:r'), '^[[:alnum:]-]*')"), '')) endif return neocomplcache#dictionary_filter( \ s:internal_candidates_list.filetypes, a:complete_str) endfunction"}}} function! neocomplcache#sources#vim_complete#helper#function(cur_text, complete_str) "{{{ " Caching. if !has_key(s:global_candidates_list, 'functions') let s:global_candidates_list.functions = \ neocomplcache#pack_dictionary(s:get_functionlist()) endif if !has_key(s:internal_candidates_list, 'functions') let s:internal_candidates_list.function_prototypes = \ s:caching_prototype_from_dict('functions') let functions = s:caching_from_dict('functions', 'f') for function in functions if has_key(s:internal_candidates_list.function_prototypes, function.word) let function.description = function.word \ . s:internal_candidates_list.function_prototypes[function.word] endif endfor let s:internal_candidates_list.functions = \ neocomplcache#pack_dictionary(functions) endif let script_candidates_list = s:get_cached_script_candidates() if a:complete_str =~ '^s:' let list = values(script_candidates_list.functions) elseif a:complete_str =~ '^\a:' let functions = deepcopy(values(script_candidates_list.functions)) for keyword in functions let keyword.word = '' . keyword.word[2:] let keyword.abbr = '' . keyword.abbr[2:] endfor let list = functions else let list = neocomplcache#dictionary_filter( \ s:internal_candidates_list.functions, a:complete_str) \ + neocomplcache#dictionary_filter( \ s:global_candidates_list.functions, a:complete_str) endif return list endfunction"}}} function! neocomplcache#sources#vim_complete#helper#help(cur_text, complete_str) "{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#highlight(cur_text, complete_str) "{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#let(cur_text, complete_str) "{{{ if a:cur_text !~ '=' return neocomplcache#sources#vim_complete#helper#var(a:cur_text, a:complete_str) elseif a:cur_text =~# '\' let list += neocomplcache#sources#vim_complete#helper#expression(a:cur_text, a:complete_str) elseif a:cur_text =~ ':\?' let command = matchstr(a:cur_text, ':\?\zs.*$') let list += neocomplcache#sources#vim_complete#helper#command(command, a:complete_str) endif return list endfunction"}}} function! neocomplcache#sources#vim_complete#helper#menu(cur_text, complete_str) "{{{ return [] endfunction"}}} function! neocomplcache#sources#vim_complete#helper#option(cur_text, complete_str) "{{{ " Caching. if !has_key(s:internal_candidates_list, 'options') let s:internal_candidates_list.options = s:caching_from_dict('options', 'o') for keyword in deepcopy(s:internal_candidates_list.options) let keyword.word = 'no' . keyword.word let keyword.abbr = 'no' . keyword.abbr call add(s:internal_candidates_list.options, keyword) endfor endif if a:cur_text =~ '\', '', '', '', \ '', '', '', ''], '') endfunction"}}} function! s:get_local_variables() "{{{ " Get local variable list. let keyword_dict = {} " Search function. let line_num = line('.') - 1 let end_line = (line('.') > 100) ? line('.') - 100 : 1 while line_num >= end_line let line = getline(line_num) if line =~ '\' break elseif line =~ '\ 700 ? \ s:script_candidates_list[bufnr('%')] : { \ 'functions' : {}, 'variables' : {}, 'function_prototypes' : {}, 'dictionary_variables' : {} } endfunction"}}} function! s:get_script_candidates(bufnumber) "{{{ " Get script candidate list. let function_dict = {} let variable_dict = {} let dictionary_variable_dict = {} let function_prototypes = {} let var_pattern = '\a:[[:alnum:]_:]*\.\h\w*\%(()\?\)\?' for line in getbufline(a:bufnumber, 1, '$') if line =~ '\\?\|\h[[:alnum:]_:#\[]*\%([!\]]\+\|()\?\)\?\)' let keyword_list = [] for line in readfile(dict_files[0]) call add(keyword_list, { \ 'word' : substitute(matchstr( \ line, keyword_pattern), '[\[\]]', '', 'g'), \ 'kind' : a:kind, 'abbr' : line \}) endfor return keyword_list endfunction"}}} function! s:caching_completion_from_dict(dict_name) "{{{ let dict_files = split(globpath(&runtimepath, \ 'autoload/neocomplcache/sources/vim_complete/'.a:dict_name.'.dict'), '\n') if empty(dict_files) return {} endif let keyword_dict = {} for line in readfile(dict_files[0]) let word = matchstr(line, '^[[:alnum:]_\[\]]\+') let completion = matchstr(line[len(word):], '\h\w*') if completion != '' if word =~ '\[' let [word_head, word_tail] = split(word, '\[') let word_tail = ' ' . substitute(word_tail, '\]', '', '') else let word_head = word let word_tail = ' ' endif for i in range(len(word_tail)) let keyword_dict[word_head . word_tail[1:i]] = completion endfor endif endfor return keyword_dict endfunction"}}} function! s:caching_prototype_from_dict(dict_name) "{{{ let dict_files = split(globpath(&runtimepath, \ 'autoload/neocomplcache/sources/vim_complete/'.a:dict_name.'.dict'), '\n') if empty(dict_files) return {} endif if a:dict_name == 'functions' let pattern = '^[[:alnum:]_]\+(' else let pattern = '^[[:alnum:]_\[\](]\+' endif let keyword_dict = {} for line in readfile(dict_files[0]) let word = matchstr(line, pattern) let rest = line[len(word):] if word =~ '\[' let [word_head, word_tail] = split(word, '\[') let word_tail = ' ' . substitute(word_tail, '\]', '', '') else let word_head = word let word_tail = ' ' endif for i in range(len(word_tail)) let keyword_dict[word_head . word_tail[1:i]] = rest endfor endfor return keyword_dict endfunction"}}} function! s:get_cmdlist() "{{{ " Get command list. redir => redir silent! command redir END let keyword_list = [] let completions = [ 'augroup', 'buffer', 'behave', \ 'color', 'command', 'compiler', 'cscope', \ 'dir', 'environment', 'event', 'expression', \ 'file', 'file_in_path', 'filetype', 'function', \ 'help', 'highlight', 'history', 'locale', \ 'mapping', 'menu', 'option', 'shellcmd', 'sign', \ 'syntax', 'tag', 'tag_listfiles', \ 'var', 'custom', 'customlist' ] let command_prototypes = {} let command_completions = {} for line in split(redir, '\n')[1:] let word = matchstr(line, '\a\w*') " Analyze prototype. let end = matchend(line, '\a\w*') let args = matchstr(line, '[[:digit:]?+*]', end) if args != '0' let prototype = matchstr(line, '\a\w*', end) let found = 0 for comp in completions if comp == prototype let command_completions[word] = prototype let found = 1 break endif endfor if !found let prototype = 'arg' endif if args == '*' let prototype = '[' . prototype . '] ...' elseif args == '?' let prototype = '[' . prototype . ']' elseif args == '+' let prototype = prototype . ' ...' endif let command_prototypes[word] = ' ' . repeat(' ', 16 - len(word)) . prototype else let command_prototypes[word] = '' endif let prototype = command_prototypes[word] call add(keyword_list, { \ 'word' : word, 'abbr' : word . prototype, \ 'description' : word . prototype, 'kind' : 'c' \}) endfor let s:global_candidates_list.command_prototypes = command_prototypes let s:global_candidates_list.command_completions = command_completions return keyword_list endfunction"}}} function! s:get_variablelist(dict, prefix) "{{{ let kind_dict = \ ['0', '""', '()', '[]', '{}', '.', 'b', 'no', 'j', 'ch'] return values(map(copy(a:dict), "{ \ 'word' : a:prefix.v:key, \ 'kind' : get(kind_dict, type(v:val), '?'), \}")) endfunction"}}} function! s:get_functionlist() "{{{ " Get function list. redir => redir silent! function redir END let keyword_dict = {} let function_prototypes = {} for line in split(redir, '\n') let line = line[9:] if line =~ '^' continue endif let orig_line = line let word = matchstr(line, '\h[[:alnum:]_:#.]*()\?') if word != '' let keyword_dict[word] = { \ 'word' : word, 'abbr' : line, \ 'description' : line, \} let function_prototypes[word] = orig_line[len(word):] endif endfor let s:global_candidates_list.function_prototypes = function_prototypes return values(keyword_dict) endfunction"}}} function! s:get_augrouplist() "{{{ " Get augroup list. redir => redir silent! augroup redir END let keyword_list = [] for group in split(redir . ' END', '\s\|\n') call add(keyword_list, { 'word' : group }) endfor return keyword_list endfunction"}}} function! s:get_mappinglist() "{{{ " Get mapping list. redir => redir silent! map redir END let keyword_list = [] for line in split(redir, '\n') let map = matchstr(line, '^\a*\s*\zs\S\+') if map !~ '^<' || map =~ '^' continue endif call add(keyword_list, { 'word' : map }) endfor return keyword_list endfunction"}}} function! s:get_envlist() "{{{ " Get environment variable list. let keyword_list = [] for line in split(system('set'), '\n') let word = '$' . toupper(matchstr(line, '^\h\w*')) call add(keyword_list, { 'word' : word, 'kind' : 'e' }) endfor return keyword_list endfunction"}}} function! s:make_completion_list(list, kind) "{{{ let list = [] for item in a:list call add(list, { 'word' : item, 'kind' : a:kind }) endfor return list endfunction"}}} function! s:analyze_function_line(line, keyword_dict, prototype) "{{{ " Get script function. let line = substitute(matchstr(a:line, '\ ; 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 < At the line 1 and 3, neocomplcache#get_context_filetype() is "html" and at the line 2 it's "javascript", whilst at any lines &filetype is "html". *neocomplcache#disable_default_dictionary()* neocomplcache#disable_default_dictionary({variable-name}) Disable default {variable-name} dictionary initialization. Note: It must be called in .vimrc. > call neocomplcache#disable_default_dictionary( \ 'g:neocomplcache_same_filetype_lists') < ------------------------------------------------------------------------------ KEY MAPPINGS *neocomplcache-key-mappings* *neocomplcache#start_manual_complete()* neocomplcache#start_manual_complete([{sources}]) Use this function on inoremap . The keymapping call the completion of neocomplcache. When you rearrange the completion of the Vim standard, you use it. If you give {sources} argument, neocomplcache call {sources}. {sources} is name of source or list of sources name. > inoremap neocomplcache#start_manual_complete() < *neocomplcache#manual_filename_complete()* *neocomplcache#manual_omni_complete()* Note: These functions are obsolete. *neocomplcache#close_popup()* neocomplcache#close_popup() Inset candidate and close popup menu for neocomplcache. > inoremap neocomplcache#close_popup() < *neocomplcache#cancel_popup()* neocomplcache#cancel_popup() cancel completion menu for neocomplcache. > inoremap neocomplcache#cancel_popup() < *neocomplcache#smart_close_popup()* neocomplcache#smart_close_popup() Inset candidate and close popup menu for neocomplcache. Unlike|neocomplcache#close_popup()|, this function changes behavior by|g:neocomplcache_enable_auto_select|smart. Note: This mapping is conflicted with |SuperTab| or |endwise| plugins. *neocomplcache#undo_completion()* neocomplcache#undo_completion() Use this function on inoremap . Undo inputted candidate. Because there is not mechanism to cancel candidate in Vim, it will be convenient when it inflects. > inoremap neocomplcache#undo_completion() < *neocomplcache#complete_common_string()* neocomplcache#complete_common_string() Use this function on inoremap . Complete common string in candidates. It will be convenient when candidates have long common string. > inoremap neocomplcache#complete_common_string() < *(neocomplcache_start_unite_complete)* (neocomplcache_start_unite_complete) Start completion with |unite|. Note: Required unite.vim Latest ver.3.0 or above. Note: In unite interface, uses partial match instead of head match. *(neocomplcache_start_quick_match)* (neocomplcache_start_unite_quick_match) Start completion with |unite| and start quick match mode. Note: Required unite.vim Latest ver.3.0 or above. ============================================================================== EXAMPLES *neocomplcache-examples* > "Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)! " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplcache. let g:neocomplcache_enable_at_startup = 1 " Use smartcase. let g:neocomplcache_enable_smart_case = 1 " Set minimum syntax keyword length. let g:neocomplcache_min_syntax_length = 3 let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Enable heavy features. " Use camel case completion. "let g:neocomplcache_enable_camel_case_completion = 1 " Use underbar completion. "let g:neocomplcache_enable_underbar_completion = 1 " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '', \ 'vimshell' : $HOME.'/.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword. if !exists('g:neocomplcache_keyword_patterns') let g:neocomplcache_keyword_patterns = {} endif let g:neocomplcache_keyword_patterns['default'] = '\h\w*' " Plugin key-mappings. inoremap neocomplcache#undo_completion() inoremap neocomplcache#complete_common_string() " Recommended key-mappings. " : close popup and save indent. inoremap =my_cr_function() function! s:my_cr_function() return neocomplcache#smart_close_popup() . "\" " For no inserting key. "return pumvisible() ? neocomplcache#close_popup() : "\" endfunction " : completion. inoremap pumvisible() ? "\" : "\" " , : close popup and delete backword char. inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#smart_close_popup()."\" inoremap neocomplcache#close_popup() inoremap neocomplcache#cancel_popup() " Close popup by . "inoremap pumvisible() ? neocomplcache#close_popup() : "\" " For cursor moving in insert mode(Not recommended) "inoremap neocomplcache#close_popup() . "\" "inoremap neocomplcache#close_popup() . "\" "inoremap neocomplcache#close_popup() . "\" "inoremap neocomplcache#close_popup() . "\" " Or set this. "let g:neocomplcache_enable_cursor_hold_i = 1 " Or set this. "let g:neocomplcache_enable_insert_char_pre = 1 " AutoComplPop like behavior. "let g:neocomplcache_enable_auto_select = 1 " Shell like behavior(not recommended). "set completeopt+=longest "let g:neocomplcache_enable_auto_select = 1 "let g:neocomplcache_disable_auto_complete = 1 "inoremap pumvisible() ? "\" : "\\" " Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " Enable heavy omni completion. if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif if !exists('g:neocomplcache_force_omni_patterns') let g:neocomplcache_force_omni_patterns = {} endif let g:neocomplcache_omni_patterns.php = \ '[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' let g:neocomplcache_omni_patterns.c = \ '[^.[:digit:] *\t]\%(\.\|->\)\%(\h\w*\)\?' let g:neocomplcache_omni_patterns.cpp = \ '[^.[:digit:] *\t]\%(\.\|->\)\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' " For perlomni.vim setting. " https://github.com/c9s/perlomni.vim let g:neocomplcache_omni_patterns.perl = \ '[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' < ============================================================================== SOURCES *neocomplcache-sources* Neocomplcache reads automatically sources saved in an autoload/neocomplcache/sources directory. buffer_complete.vim *buffer_complete* This source collects keywords from buffer. member_complete.vim *member_complete* This source collects use of member variables from buffer. tags_complete.vim *tags_complete* This source analyzes a tag file from tagfiles() for completion. When a huge tag file (above |g:neocomplcache_tags_caching_limit_file_size|) is set, neocomplcache does not make cache if you do not execute |:NeoComplCacheCachingTags|command. Because tags_complete is too slow if tags_complete read a big tags file. You should use more convenient include completion now. syntax_complete.vim *syntax_complete* This source analyzes a syntax file like autoload/syntaxcomplete.vim offered by default, and to add to candidate completion. The plugin can recognize candidates a lot more than autoload/syntaxcomplete.vim. include_complete.vim *include_complete* This source will add the file which an opening buffer refers to to candidate. It is convenient, because you do not need to prepare a tags file and a dictionary file. But it is necessary for 'path' and 'include', 'includeexpr' to be set adequately. Note: If you have vimproc installed, neocomplcache will cache automatically. Otherwise it won't; please execute |:NeoComplCacheCachingInclude| manually. vim_complete.vim *vim_complete* This source analyzes context and start Omni completion of Vim script. This plugin does not work other than editing time of Vim script. I created it because neocomplcache cannot call |i_CTRL-X_CTRL-V|. Local variable and a script variable, a function and the analysis of the command are implemented now. dictionary_complete.vim *dictionary_complete* This source adds candidates from 'dictionary' or |g:neocomplcache_dictionary_filetype_lists|. filename_complete.vim *filename_complete* This source collects filename candidates. filename_include.vim *filename_include* This source collects filename candidates. It is useful when you input header file name. It recognizes include pattern and include path like include_complete. omni_complete.vim *omni_complete* This source calls 'omnifunc' automatically when cursor text is matched with |g:neocomplcache_omni_patterns|. If |g:neocomplcache_omni_function_list|is defined, neocomplcache will give priority it. Note: This source is not supported wildcard. suffix of complete candidates in popup menu declaration. (This will be good for user to know where candidate from and what it is.) filename_complete -> [F] {filename} filename_include -> [FI] {filename} dictionary_complete -> [D] {words} member_complete -> [M] member buffer_complete -> [B] {buffername} syntax_complete -> [S] {syntax-keyword} include_complete -> [I] neosnippet -> [neosnip] vim_complete -> [vim] type omni_complete -> [O] tags_complete -> [T] other plugin sources -> [plugin-name-prefix] other completefunc sources -> [plugin-name-prefix] other ftplugin sources -> [plugin-name-prefix] ------------------------------------------------------------------------------ USER SOURCES *neocomplcache-user-sources* This section, introduce non default neocomplcache sources. neosnippet *neocomplcache-sources-neosnippet* This source is for snippets completion. Note: This source is not in default sources after neocomplcache ver.7.0. https://github.com/Shougo/neosnippet neco-ghc *neocomplcache-sources-neco-ghc* https://github.com/ujihisa/neco-ghc eagletmt originally implemented and now ujihisa is maintaining this source. It completes a source file written in Haskell. It requires ghc-mod . ============================================================================== FILTERS *neocomplcache-filters* To custom candidates, neocomplcache uses the filters. There are three kinds of filters are available. "matcher" is to use filter candidates. "sorter" is to use sort candidates. "converter" is to use candidates conversion. Note: "matcher" is not implemented. It will implemented in ver.8.1. Default sources are below. But you can create original filters(cf: |neocomplcache-create-filter|) and set them by |neocomplcache#custom_source()|. > call unite#custom_source('buffer_complete', 'converters', []) " Change default sorter. call unite#custom_source('_', 'sorters', \ ['sorter_length']) < *neocomplcache-filter-sorter_default* Default sorters: ['sorter_rank']. *neocomplcache-filter-converter_default* Default converters: ['converter_remove_next_keyword', \ 'converter_delimiter', 'converter_case', 'converter_abbr']. *neocomplcache-filter-sorter_nothing* sorter_nothing Nothing sorter. *neocomplcache-filter-sorter_rank* sorter_rank Matched rank order sorter. The higher the matched word is already selected or in current buffer *neocomplcache-filter-sorter_length* sorter_length Candidates length order sorter. *neocomplcache-filter-converter_nothing* converter_nothing This converter is dummy. *neocomplcache-filter-converter_abbr* converter_abbr The converter which abbreviates a candidate's abbr. *neocomplcache-filter-converter_case* converter_case The converter which converts a candidate's word in text mode. (cf: |g:neocomplcache_text_mode_filetypes|) *neocomplcache-filter-converter_delimiter* converter_delimiter The converter which abbreviates a candidate's delimiter. (cf: |g:neocomplcache_delimiter_patterns|) *neocomplcache-filter-converter_remove_next_keyword* converter_remove_next_keyword The converter which removes matched next keyword part in a candidate's word. (cf: |g:neocomplcache_next_keyword_patterns|) ============================================================================== CREATE SOURCE *neocomplcache-create-source* In this clause, I comment on a method to make source of neocomplcache. The ability of neocomplcache will spread by creating source by yourself. The files in autoload/neocomplcache/sources are automatically loaded and it calls neocomplcache#sources#{source_name}#define() whose return value is the source. Each return value can be a list so you can return an empty list to avoid adding undesirable sources. To add your own sources dynamically, you can use |neocomplcache#define_source()|. ------------------------------------------------------------------------------ SOURCE ATTRIBUTES *neocomplcache-source-attributes* *neocomplcache-source-attribute-name* name String (Required) The name of a source. It must consist of the following characters: - a-z - 0-9 - _ - / - - (Not head) *neocomplcache-source-attribute-kind* kind String (Optional) Source kind. Following values are available. "manual" : This source decides complete position manually. Note: "complfunc" or "ftplugin" are old values. "keyword" : This source decides complete position by |g:neocomplcache_keyword_patterns|. Note: "plugin" is old value. *neocomplcache-source-attribute-filetypes* filetypes Dictionary (Optional) Available filetype dictionary. For example: > let source = { \ 'name' : 'test', \ 'kind' : 'manual', \ 'filetypes' : { 'vim' : 1, 'html' : 1 }, \} < The source is available in vim and html filetypes. If you omit it, this source available in all filetypes. *neocomplcache-source-attribute-rank* rank Number (Optional) Source priority. Note: You can set source priority by |g:neocomplcache_source_rank|, but it is obsolete way. If you omit it, it is set below value. If kind attribute is "keyword" : 5 If filetype attribute is empty : 10 Else : 100 *neocomplcache-source-attribute-min_pattern_length* min_pattern_length Number (Optional) Required pattern length for completion. If you omit it, it is set below value. If kind attribute is "keyword" : |g:neocomplcache_auto_completion_start_length| Else : 0 *neocomplcache-source-attribute-max_candidates* max_candidates Number (Optional) The maximum number of candidates. This attribute is optional; if it is not given, 0 is used as the default value. This means maximum number is infinity. *neocomplcache-source-attribute-hooks* hooks Dictionary (Optional) You may put hook functions in this dictionary in which the key is the position to hook and the value is the reference to the function to be called. The following hook functions are defined: *neocomplcache-source-attribute-hooks-on_init* on_init Called when initializing the source. This function takes {context} as its parameters. *neocomplcache-source-attribute-initialize* Note initialize() attribute is obsolete interface for initialization. *neocomplcache-source-attribute-hooks-on_final* on_final Called after executing |:NeoComplCacheDisable|. This function takes {context} as its parameters. *neocomplcache-source-attribute-finalize* Note finalize() attribute is obsolete interface for finalization. *neocomplcache-source-attribute-hooks-on_post_filter* on_post_filter Called after the filters to narrow down the candidates. This is used to set attributes. This filters is to avoid adversely affecting the performance. This function takes {context} as its parameters. *neocomplcache-source-attribute-get_complete_position* get_complete_position Function (Optional) This function takes {context} as its parameter and returns complete position in current line. Here, {context} is the context information when the source is called(|neocomplcache-notation-{context}|). If you omit it, neocomplcache will use the position using |g:neocomplcache_keyword_patterns|. Note get_keyword_pos() is obsolete interface for get complete position. *neocomplcache-source-attribute-gather_candidates* gather_candidates Function (Required) This function is called in gathering candidates. If you enabled fuzzy completion by |g:neocomplcache_enable_fuzzy_completion| , this function is called whenever the input string is changed. This function takes {context} as its parameter and returns a list of {candidate}. Here, {context} is the context information when the source is called(|neocomplcache-notation-{context}|). Note: get_complete_words() and get_keyword_list() are obsolete interface for gather candidates. Note: |neocomplcache-filters| feature is disabled for compatibility in neocomplcache ver.8.0. You should use new interface in neocomplcache ver.8.1. {context} *neocomplcache-notation-{context}* A dictionary to give context information. The followings are the primary information. The global context information can be acquired by |neocomplcache#get_context()|. input (String) The input string of current line. complete_pos (Number) The complete position of current source. complete_str (String) The complete string of current source. source__{name} (Unknown) (Optional) Additional source information. Note: Recommend sources save variables instead of s: variables. ------------------------------------------------------------------------------ CANDIDATE ATTRIBUTES *neocomplcache-candidate-attributes* *neocomplcache-candidate-attribute-name* word String (Required) The completion word of a candidate. It is used for matching inputs. *neocomplcache-candidate-attribute-abbr* abbr String (Optional) The abbreviation of a candidate. It is displayed in popup window. It is omitted by |g:neocomplcache_max_keyword_width|. *neocomplcache-candidate-attribute-kind* kind String (Optional) The kind of a candidate. It is displayed in popup window. *neocomplcache-candidate-attribute-menu* menu String (Optional) The menu information of a candidate. It is displayed in popup window. *neocomplcache-candidate-attribute-info* info String (Optional) The preview information of a candidate. If 'completeopt' contains "preview", it will be displayed in |preview-window|. *neocomplcache-candidate-attribute-rank* rank Number (Optional) The completion priority. CONTEXT *neocomplcache-context* ============================================================================== CREATE FILTER *neocomplcache-create-filter* The files in autoload/neocomplcache/filters are automatically loaded and it calls neocomplcache#filters#{filter_name}#define() whose return value is the filter. Each return value can be a list so you can return an empty list to avoid adding undesirable filters. To add your own filters dynamically, you can use |neocomplcache#define_filter()|. ------------------------------------------------------------------------------ FILTER ATTRIBUTES *neocomplcache-filter-attributes* *neocomplcache-filter-attribute-name* name String (Required) The filter name. *neocomplcache-filter-attribute-filter* filter Function (Required) The filter function. This function takes {context} as its parameter and returns a list of {candidate}. The specification of the parameters and the returned value is same as |neocomplcache-source-attribute-gather_candidates|. *neocomplcache-filter-attribute-description* description String (Optional) The filter description string. ============================================================================== UNITE SOURCES *neocomplcache-unite-sources* *neocomplcache-unite-source-neocomplcache* neocomplcache Nominates neocomplcache completion candidates. The kind is "completion". This source is used in |(neocomplcache_start_unite_complete)|. > imap (neocomplcache_start_unite_complete) imap (neocomplcache_start_unite_quick_match) < ============================================================================== FAQ *neocomplcache-faq* Q: My customization for neocomplcache is invalid. Why? A: User customization for neocomplcache must be set before initialization of neocomplcache. For example: |neocomplcache#custom_source()| Q: Is there a way to control the colors used for popup menu using highlight groups?: A: Like this: > highlight Pmenu ctermbg=8 guibg=#606060 highlight PmenuSel ctermbg=1 guifg=#dddd00 guibg=#1f82cd highlight PmenuSbar ctermbg=0 guibg=#d6d6d6 < Q: Python (or Ruby) interface crashes Vim when I use neocomplcache or not responding when input ".": A: This is not neocomplcache's issue. Please report to the maintainers of the omnicomplete (rubycomplete or pythoncomplete) and its Vim interface. You should disable omni_complete in python or ruby. > if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif let g:neocomplcache_omni_patterns.python = '' let g:neocomplcache_omni_patterns.ruby = '' < Q: I like moving cursor by cursor-keys. But neocomplcache popups menus... A: Please set this in your .vimrc. Note that this feature requires Vim 7.3.418 or later. > let g:neocomplcache_enable_insert_char_pre = 1 < Q: Where is snippets set for neocomplcache? A: https://github.com/Shougo/neosnippet Q: How I can disable python omni complete of neocomplcache?: A: > if !exists('g:neocomplcache_omni_patterns') let g:neocomplcache_omni_patterns = {} endif let g:neocomplcache_omni_patterns.python = '' < Q: Can I enable quick match? : A: Quick match feature had been removed in latest neocomplcache because quick match turned into hard to implement. But you can use |unite.vim| instead to use quick match. > imap - pumvisible() ? \ "\(neocomplcache_start_unite_quick_match)" : '-' < Q: How can I change the order of candidates? : A: Todo. Q: An input problem occurred in using uim-skk or other IMEs: A: It may be fixed with setting |g:neocomplcache_enable_prefetch| as 1. Q: include_complete does not work. A: include_complete depends on |vimproc|. I recommend you to install it. Also you can check 'path' option or change |g:neocomplcache_include_paths|. http://github.com/Shougo/vimproc Q: neocomplcache cannot create cache files in "sudo vim": A: Because neocomplcache (and other plugins) creates temporary files in super user permission by sudo command. You must use sudo.vim or set "Defaults always_set_home" in "/etc/sudoers", or must use "sudoedit" command. Ubuntu has a command "sudoedit" which can work well with neocomplcache. I'm not sure if other distros has this command... http://www.vim.org/scripts/script.php?script_id=729 Q: Error occurred in ruby omni complete using |g:neocomplcache_omni_patterns|. https://github.com/vim-ruby/vim-ruby/issues/95 A: Please set |g:neocomplcache_force_omni_patterns| instead of |g:neocomplcache_omni_patterns|. Q: Does not work with clang_complete. A: Please try below settings. > if !exists('g:neocomplcache_force_omni_patterns') let g:neocomplcache_force_omni_patterns = {} endif let g:neocomplcache_force_overwrite_completefunc = 1 let g:neocomplcache_force_omni_patterns.c = \ '[^.[:digit:] *\t]\%(\.\|->\)' let g:neocomplcache_force_omni_patterns.cpp = \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' let g:neocomplcache_force_omni_patterns.objc = \ '[^.[:digit:] *\t]\%(\.\|->\)' let g:neocomplcache_force_omni_patterns.objcpp = \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' let g:clang_complete_auto = 0 let g:clang_auto_select = 0 "let g:clang_use_library = 1 < Q: I want to support omni patterns for external plugins. A: You can add find some already found omni patterns and functions at here. Note: Some patterns are omitted here, (someone should check out those plugin's source code's complete function, and find out the omni pattern). > " Go (plugin: gocode) let g:neocomplcache_omni_functions.go = 'gocomplete#Complete' " Clojure (plugin: vim-clojure) let g:neocomplcache_omni_functions.clojure = 'vimclojure#OmniCompletion' " SQL let g:neocomplcache_omni_functions.sql = 'sqlcomplete#Complete' " R (plugin: vim-R-plugin) let g:neocomplcache_omni_patterns.r = '[[:alnum:].\\]\+' let g:neocomplcache_omni_functions.r = 'rcomplete#CompleteR' " XQuery (plugin: XQuery-indentomnicomplete) let g:neocomplcache_omni_patterns.xquery = '\k\|:\|\-\|&' let g:neocomplcache_omni_functions.xquery = 'xquerycomplete#CompleteXQuery' < Q: Does not indent when I input "else" in ruby filetype. A: You must install "vim-ruby" from github to indent in neocomplcache first. https://github.com/vim-ruby/vim-ruby Neocomplcache pops up a completion window automatically, but if the popup window is already visible, Vim cannot indent text. So you must choose "close popup window manually by or mappings" or "close popup window by user mappings". Q: mapping conflicts with |SuperTab| or |endwise| plugins. A: Please try below settings. > " : close popup and save indent. inoremap =my_cr_function() function! s:my_cr_function() return neocomplcache#smart_close_popup() . "\" " For no inserting key. "return pumvisible() ? neocomplcache#close_popup() : "\" endfunction > Q: No completion offered from "vim" buffers in "non-vim" buffers. A: It is feature. neocomplcache completes from same filetype buffers in default. But you can completes from other filetype buffers using |g:neocomplcache_same_filetype_lists|. Q: I want to complete from all buffers. A: |g:neocomplcache_same_filetype_lists| > let g:neocomplcache_same_filetype_lists = {} let g:neocomplcache_same_filetype_lists._ = '_' < Q: Suggestions are case insensitive in "gitcommit" buffers, but not "javascript". A: This is g:neocomplcache_text_mode_filetypes feature. You can disable it by following code. > if !exists('g:neocomplcache_text_mode_filetypes') let g:neocomplcache_tags_filter_patterns = {} endif let g:neocomplcache_text_mode_filetypes.gitcommit = 0 < Q: Conflicts completefunc with other plugins in neocomplcache. A: You can disable the error by |g:neocomplcache_force_overwrite_completefunc| variable to 1. Q: I want to use Ruby omni_complete. A: Please set |g:neocomplcache_force_omni_patterns|. But this completion is heavy, so disabled by default. Note: But you should use |neocomplcache-rsense| instead of rubycomplete. https://github.com/Shougo/neocomplcache-rsense > autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete if !exists('g:neocomplcache_force_omni_patterns') let g:neocomplcache_force_omni_patterns = {} endif let g:neocomplcache_force_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' < Q: I want to use jedi omni_complete. https://github.com/davidhalter/jedi-vim A: Please set |g:neocomplcache_force_omni_patterns| as below. > autocmd FileType python setlocal omnifunc=jedi#completions let g:jedi#auto_vim_configuration = 0 let g:neocomplcache_force_omni_patterns.python = '[^. \t]\.\w*' < Q: Candidates are not found in heavy completion(neco-look, etc). A: It may be caused by skip completion. Q: I want to disable skip completion. A: > let g:neocomplcache_skip_auto_completion_time = '' < Q: I want to initialize neocomplcache in .vimrc. A: Please call neocomplcache#initialize() in .vimrc. But this function slows your Vim initialization. > call neocomplcache#initialize() < Q: neocomplcache conflicts when multibyte input in GVim. A: Because Vim multibyte IME integration is incomplete. If you set |g:neocomplcache_lock_iminsert| is non-zero, it may be fixed. Q: Freeze for a while and close opened folding when I begin to insert. https://github.com/Shougo/neocomplcache/issues/368 A: I think you use 'foldmethod' is "expr" or "syntax". It is too heavy to use neocomplcache(or other auto completion). You should change 'foldmethod' option. Note: In current version, neocomplcache does not restore 'foldmethod'. Because it is too heavy. Q: I want to use Pydiction with neocomplcache. A: You should set |g:neocomplcache_dictionary_filetype_lists|. neocomplcache can load Pydiction dictionary file. Q: Why does neocomplcache use if_lua besides if_python? Many people may not be able to use it because they do not have the root privilege to recompile vim. A: Because of the following reasons. 1. Python interface is not available on every Vim environment. For example, Android, iOS, non configured Vim, or etc. 2. Incompatibility between Python2 and Python3. I must rewrite for it. 3. Loading Python interface is slow (10~20ms), but loading Lua interface is absolutely fast (270ns). 4. Python2 and Python3 are not loaded at the same time on Unix environment. 5. Python itself is too large. 6. Python interface is slower than Lua interface (almost twice.) 7. Lua interface is stable (no crashes on latest Vim.) 8. Using C module (like vimproc, YouCompleteMe) is hard to compile on Windows environment. 9. Using both Python and C, like YouCompleteMe, is too unstable. Your Vim may crashes or causes mysterious errors. 10. To build if_lua is easy. 11. I think if_lua is the second level language in Vim (The first is Vim script.) Q: I want to disable preview window. A: > set completeopt-=preview < Q: I want to use "vim-lua-ftplugin". https://github.com/xolox/vim-lua-ftplugin A: Please set |g:neocomplcache_omni_patterns| as below. Note: You can not use "vim-lua-ftplugin" on 7.3.885 or below, because if_lua has double-free problem. > let g:lua_check_syntax = 0 let g:lua_complete_omni = 1 let g:lua_complete_dynamic = 0 let g:neocomplcache_omni_functions.lua = \ 'xolox#lua#omnifunc' let g:neocomplcache_omni_patterns.lua = \ '\w\+[.:]\|require\s*(\?["'']\w*' " let g:neocomplcache_force_omni_patterns.lua = " \ '\w\+[.:]\|require\s*(\?["'']\w*' < Q: neocomplcache closes DiffGitCached window from vim-fugitive https://github.com/Shougo/neocomplcache.vim/issues/424 A: > let g:neocomplcache_enable_auto_close_preview = 0 < Q: I want to get quiet messages in auto completion. https://github.com/Shougo/neocomplcache.vim/issues/448 A: Before 7.4 patch 314 it was not possible because of vim's default behavior. If you are using a recent version of vim you can disable the messages through the 'shortmess' option. > if has("patch-7.4.314") set shortmess+=c endif < For earlier vim versions you can try to hide them by using the settings below > autocmd VimEnter * \ highlight ModeMsg guifg=bg guibg=bg | highlight WarningMsg guifg=bg < Q: neocomplcache will change external completeopt vaule(longest). https://github.com/Shougo/neocomplcache.vim/issues/453 A: It is feature. Because "longest" completeopt conflicts with auto completion. To use "longest" option, you must disable auto completion. "longest" is good feature. But it is for manual completion only. Q: autoclose conflicts with neocomplcache. https://github.com/Shougo/neocomplcache.vim/issues/350 A: It is autoclose mappings problem. I cannot fix it. You should use auto-pairs plugin instead of it. https://github.com/jiangmiao/auto-pairs ============================================================================== vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: ================================================ FILE: plugin/neocomplcache/buffer_complete.vim ================================================ "============================================================================= " FILE: buffer_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 05 Oct 2012. "============================================================================= if exists('g:loaded_neocomplcache_buffer_complete') finish endif let s:save_cpo = &cpo set cpo&vim " Add commands. "{{{ command! -nargs=? -complete=file -bar \ NeoComplCacheCachingBuffer \ call neocomplcache#sources#buffer_complete#caching_buffer() command! -nargs=? -complete=buffer -bar \ NeoComplCachePrintSource \ call neocomplcache#sources#buffer_complete#print_source() command! -nargs=? -complete=buffer -bar \ NeoComplCacheOutputKeyword \ call neocomplcache#sources#buffer_complete#output_keyword() command! -nargs=? -complete=buffer -bar \ NeoComplCacheDisableCaching \ call neocomplcache#sources#buffer_complete#disable_caching() command! -nargs=? -complete=buffer -bar \ NeoComplCacheEnableCaching \ call neocomplcache#sources#buffer_complete#enable_caching() "}}} let &cpo = s:save_cpo unlet s:save_cpo let g:loaded_neocomplcache_buffer_complete = 1 " vim: foldmethod=marker ================================================ FILE: plugin/neocomplcache/dictionary_complete.vim ================================================ "============================================================================= " FILE: dictionary_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 05 Oct 2012. "============================================================================= if exists('g:loaded_neocomplcache_dictionary_complete') finish endif let s:save_cpo = &cpo set cpo&vim " Add commands. "{{{ command! -nargs=? -complete=customlist,neocomplcache#filetype_complete \ NeoComplCacheCachingDictionary \ call neocomplcache#sources#dictionary_complete#recaching() "}}} let &cpo = s:save_cpo unlet s:save_cpo let g:loaded_neocomplcache_dictionary_complete = 1 " vim: foldmethod=marker ================================================ FILE: plugin/neocomplcache/include_complete.vim ================================================ "============================================================================= " FILE: include_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 05 Oct 2012. "============================================================================= if exists('g:loaded_neocomplcache_include_complete') finish endif let s:save_cpo = &cpo set cpo&vim " Add commands. "{{{ command! -nargs=? -complete=buffer NeoComplCacheCachingInclude \ call neocomplcache#sources#include_complete#caching_include() "}}} let &cpo = s:save_cpo unlet s:save_cpo let g:loaded_neocomplcache_include_complete = 1 " vim: foldmethod=marker ================================================ FILE: plugin/neocomplcache/syntax_complete.vim ================================================ "============================================================================= " FILE: syntax_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 05 Oct 2012. "============================================================================= if exists('g:loaded_neocomplcache_syntax_complete') finish endif let s:save_cpo = &cpo set cpo&vim " Add commands. "{{{ command! -nargs=? -complete=customlist,neocomplcache#filetype_complete \ NeoComplCacheCachingSyntax \ call neocomplcache#sources#syntax_complete#recaching() "}}} let &cpo = s:save_cpo unlet s:save_cpo let g:loaded_neocomplcache_syntax_complete = 1 " vim: foldmethod=marker ================================================ FILE: plugin/neocomplcache/tags_complete.vim ================================================ "============================================================================= " FILE: tags_complete.vim " AUTHOR: Shougo Matsushita " Last Modified: 05 Oct 2012. "============================================================================= if exists('g:loaded_neocomplcache_tags_complete') finish endif let s:save_cpo = &cpo set cpo&vim " Add commands. "{{{ command! -nargs=0 -bar \ NeoComplCacheCachingTags \ call neocomplcache#sources#tags_complete#caching_tags(1) "}}} let &cpo = s:save_cpo unlet s:save_cpo let g:loaded_neocomplcache_tags_complete = 1 " vim: foldmethod=marker ================================================ FILE: plugin/neocomplcache.vim ================================================ "============================================================================= " FILE: neocomplcache.vim " AUTHOR: Shougo Matsushita " Last Modified: 26 Sep 2013. " 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. " }}} " GetLatestVimScripts: 2620 1 :AutoInstall: neocomplcache "============================================================================= if exists('g:loaded_neocomplcache') finish endif let g:loaded_neocomplcache = 1 let s:save_cpo = &cpo set cpo&vim if v:version < 702 echohl Error echomsg 'neocomplcache does not work this version of Vim (' . v:version . ').' echohl None finish endif command! -nargs=0 -bar NeoComplCacheEnable \ call neocomplcache#init#enable() command! -nargs=0 -bar NeoComplCacheDisable \ call neocomplcache#init#disable() command! -nargs=0 -bar NeoComplCacheLock \ call neocomplcache#commands#_lock() command! -nargs=0 -bar NeoComplCacheUnlock \ call neocomplcache#commands#_unlock() command! -nargs=0 -bar NeoComplCacheToggle \ call neocomplcache#commands#_toggle_lock() command! -nargs=1 -bar NeoComplCacheLockSource \ call neocomplcache#commands#_lock_source() command! -nargs=1 -bar NeoComplCacheUnlockSource \ call neocomplcache#commands#_unlock_source() if v:version >= 703 command! -nargs=1 -bar -complete=filetype NeoComplCacheSetFileType \ call neocomplcache#commands#_set_file_type() else command! -nargs=1 -bar NeoComplCacheSetFileType \ call neocomplcache#commands#_set_file_type() endif command! -nargs=0 -bar NeoComplCacheClean \ call neocomplcache#commands#_clean() " Warning if using obsolute mappings. "{{{ silent! inoremap (neocomplcache_snippets_expand) \ :echoerr print_snippets_complete_error() silent! snoremap (neocomplcache_snippets_expand) \ ::echoerr print_snippets_complete_error() silent! inoremap (neocomplcache_snippets_jump) \ :echoerr print_snippets_complete_error() silent! snoremap (neocomplcache_snippets_jump) \ ::echoerr print_snippets_complete_error() silent! inoremap (neocomplcache_snippets_force_expand) \ :echoerr print_snippets_complete_error() silent! snoremap (neocomplcache_snippets_force_expand) \ ::echoerr print_snippets_complete_error() silent! inoremap (neocomplcache_snippets_force_jump) \ :echoerr print_snippets_complete_error() silent! snoremap (neocomplcache_snippets_force_jump) \ ::echoerr print_snippets_complete_error() function! s:print_snippets_complete_error() return 'Warning: neocomplcache snippets source was splitted!' \ .' You should install neosnippet from' \ .' "https://github.com/Shougo/neosnippet.vim"' endfunction"}}} " Global options definition. "{{{ let g:neocomplcache_max_list = \ get(g:, 'neocomplcache_max_list', 100) let g:neocomplcache_max_keyword_width = \ get(g:, 'neocomplcache_max_keyword_width', 80) let g:neocomplcache_max_menu_width = \ get(g:, 'neocomplcache_max_menu_width', 15) let g:neocomplcache_auto_completion_start_length = \ get(g:, 'neocomplcache_auto_completion_start_length', 2) let g:neocomplcache_manual_completion_start_length = \ get(g:, 'neocomplcache_manual_completion_start_length', 0) let g:neocomplcache_min_keyword_length = \ get(g:, 'neocomplcache_min_keyword_length', 4) let g:neocomplcache_enable_ignore_case = \ get(g:, 'neocomplcache_enable_ignore_case', &ignorecase) let g:neocomplcache_enable_smart_case = \ get(g:, 'neocomplcache_enable_smart_case', &infercase) let g:neocomplcache_disable_auto_complete = \ get(g:, 'neocomplcache_disable_auto_complete', 0) let g:neocomplcache_enable_wildcard = \ get(g:, 'neocomplcache_enable_wildcard', 1) let g:neocomplcache_enable_camel_case_completion = \ get(g:, 'neocomplcache_enable_camel_case_completion', 0) let g:neocomplcache_enable_underbar_completion = \ get(g:, 'neocomplcache_enable_underbar_completion', 0) let g:neocomplcache_enable_fuzzy_completion = \ get(g:, 'neocomplcache_enable_fuzzy_completion', 0) let g:neocomplcache_fuzzy_completion_start_length = \ get(g:, 'neocomplcache_fuzzy_completion_start_length', 3) let g:neocomplcache_enable_caching_message = \ get(g:, 'neocomplcache_enable_caching_message', 1) let g:neocomplcache_enable_insert_char_pre = \ get(g:, 'neocomplcache_enable_insert_char_pre', 0) let g:neocomplcache_enable_cursor_hold_i = \ get(g:, 'neocomplcache_enable_cursor_hold_i', 0) let g:neocomplcache_cursor_hold_i_time = \ get(g:, 'neocomplcache_cursor_hold_i_time', 300) let g:neocomplcache_enable_auto_select = \ get(g:, 'neocomplcache_enable_auto_select', 0) let g:neocomplcache_enable_auto_delimiter = \ get(g:, 'neocomplcache_enable_auto_delimiter', 0) let g:neocomplcache_caching_limit_file_size = \ get(g:, 'neocomplcache_caching_limit_file_size', 500000) let g:neocomplcache_disable_caching_file_path_pattern = \ get(g:, 'neocomplcache_disable_caching_file_path_pattern', '') let g:neocomplcache_lock_buffer_name_pattern = \ get(g:, 'neocomplcache_lock_buffer_name_pattern', '') let g:neocomplcache_ctags_program = \ get(g:, 'neocomplcache_ctags_program', 'ctags') let g:neocomplcache_force_overwrite_completefunc = \ get(g:, 'neocomplcache_force_overwrite_completefunc', 0) let g:neocomplcache_enable_prefetch = \ get(g:, 'neocomplcache_enable_prefetch', \ !(v:version > 703 || v:version == 703 && has('patch519')) \ || (has('gui_running') && has('xim')) \ ) let g:neocomplcache_lock_iminsert = \ get(g:, 'neocomplcache_lock_iminsert', 0) let g:neocomplcache_release_cache_time = \ get(g:, 'neocomplcache_release_cache_time', 900) let g:neocomplcache_wildcard_characters = \ get(g:, 'neocomplcache_wildcard_characters', { \ '_' : '*' }) let g:neocomplcache_skip_auto_completion_time = \ get(g:, 'neocomplcache_skip_auto_completion_time', '0.3') let g:neocomplcache_enable_auto_close_preview = \ get(g:, 'neocomplcache_enable_auto_close_preview', 1) let g:neocomplcache_sources_list = \ get(g:, 'neocomplcache_sources_list', {}) let g:neocomplcache_disabled_sources_list = \ get(g:, 'neocomplcache_disabled_sources_list', {}) if exists('g:neocomplcache_source_disable') let g:neocomplcache_disabled_sources_list._ = \ keys(filter(copy(g:neocomplcache_source_disable), 'v:val')) endif if exists('g:neocomplcache_plugin_completion_length') let g:neocomplcache_source_completion_length = \ g:neocomplcache_plugin_completion_length endif let g:neocomplcache_source_completion_length = \ get(g:, 'neocomplcache_source_completion_length', {}) if exists('g:neocomplcache_plugin_rank') let g:neocomplcache_source_rank = g:neocomplcache_plugin_rank endif let g:neocomplcache_source_rank = \ get(g:, 'neocomplcache_source_rank', {}) let g:neocomplcache_temporary_dir = \ get(g:, 'neocomplcache_temporary_dir', \ ($XDG_CACHE_HOME != '' ? \ $XDG_CACHE_HOME . '/neocomplcache' : expand('~/.cache/neocomplcache'))) let g:neocomplcache_enable_debug = \ get(g:, 'neocomplcache_enable_debug', 0) if get(g:, 'neocomplcache_enable_at_startup', 0) augroup neocomplcache " Enable startup. autocmd CursorHold,CursorMovedI \ * call neocomplcache#init#lazy() augroup END endif"}}} let &cpo = s:save_cpo unlet s:save_cpo " vim: foldmethod=marker ================================================ FILE: vest/test-neocomplcache.vim ================================================ scriptencoding utf-8 " Saving 'cpoptions' {{{ let s:save_cpo = &cpo set cpo&vim " }}} Context types It tests compare functions. ShouldEqual sort([{ 'word' : 'z0' }, { 'word' : 'z10' }, \ { 'word' : 'z2'}, { 'word' : 'z3'} ], \ 'neocomplcache#compare_human'), \ [{ 'word' : 'z0' }, { 'word' : 'z2' }, \ { 'word' : 'z3' }, { 'word' : 'z10' }] End End Fin " Restore 'cpoptions' {{{ let &cpo = s:save_cpo " }}} " vim:foldmethod=marker:fen: