Commits

Anonymous committed d656de8

add vim javascript

Comments (0)

Files changed (215)

vimfiles/bundle/neocomplcache/README

+Description:
+neocomplcache performs keyword completion by making a cache of keyword in
+buffer. Because I implemented it by paying own expenses unlike the keyword
+completion including the Vim composing type, neocomplcache can be customized
+flexibly. Unfortunately neocomplcache may use more memory than other
+plugins.
+
+Installation:
+1: Extract the file and Put files in your Vim directory
+   (usually ~/.vim/ or Program Files/Vim/vimfiles on Windows).
+2: Execute |:NeoComplCacheEnable| command or
+let g:neocomplcache_enable_at_startup = 1
+in your .vimrc.
+
+Caution:
+Because all variable names are changed in neocomplcache Ver.5, there is not
+backward compatibility. In the case of the upgrade, you should use the next
+script which Mr.thinca made.
+http://gist.github.com/422503
+
+Screen shots:
+Quick match.
+http://3.bp.blogspot.com/_ci2yBnqzJgM/TD1PeahCmOI/AAAAAAAAADc/Rz_Pbpr92z4/s1600/quick_match.png
+Snippet completion like snipMate.
+http://3.bp.blogspot.com/_ci2yBnqzJgM/SfkgaHXLS0I/AAAAAAAAAA4/TmaylpFl_Uw/s1600-h/Screenshot2.PNG
+Original filename completion.
+http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1O5_bOQ2I/AAAAAAAAADE/vHf9Xg_mrTI/s1600/filename_complete.png
+Register completion.
+http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1Pel4fomI/AAAAAAAAADk/YsAxF8i6r3w/s1600/register_complete.png
+Omni completion.
+http://2.bp.blogspot.com/_ci2yBnqzJgM/TD1PTolkTBI/AAAAAAAAADU/knJ3eniuHWI/s1600/omni_complete.png
+Completion with vimshell(http://github.com/Shougo/vimshell).
+http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1PLfdQrwI/AAAAAAAAADM/2pSFRTHwYOY/s1600/neocomplcache_with_vimshell.png
+Vim completion.
+http://1.bp.blogspot.com/_ci2yBnqzJgM/TD1PfKTlwnI/AAAAAAAAADs/nOGWTRLuae8/s1600/vim_complete.png
+
+Setting examples:
+" Disable AutoComplPop.
+let g:acp_enableAtStartup = 0
+" Use neocomplcache.
+let g:neocomplcache_enable_at_startup = 1
+" Use smartcase.
+let g:neocomplcache_enable_smart_case = 1
+" Use camel case completion.
+let g:neocomplcache_enable_camel_case_completion = 1
+" Use underbar completion.
+let g:neocomplcache_enable_underbar_completion = 1
+" Set minimum syntax keyword length.
+let g:neocomplcache_min_syntax_length = 3
+let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
+
+" Define dictionary.
+let g:neocomplcache_dictionary_filetype_lists = {
+    \ 'default' : '',
+    \ 'vimshell' : $HOME.'/.vimshell_hist',
+    \ 'scheme' : $HOME.'/.gosh_completions'
+    \ }
+
+" Define keyword.
+if !exists('g:neocomplcache_keyword_patterns')
+  let g:neocomplcache_keyword_patterns = {}
+endif
+let g:neocomplcache_keyword_patterns['default'] = '\h\w*'
+
+" Plugin key-mappings.
+imap <C-k>     <Plug>(neocomplcache_snippets_expand)
+smap <C-k>     <Plug>(neocomplcache_snippets_expand)
+inoremap <expr><C-g>     neocomplcache#undo_completion()
+inoremap <expr><C-l>     neocomplcache#complete_common_string()
+
+" SuperTab like snippets behavior.
+"imap <expr><TAB> neocomplcache#sources#snippets_complete#expandable() ? "\<Plug>(neocomplcache_snippets_expand)" : pumvisible() ? "\<C-n>" : "\<TAB>"
+
+" Recommended key-mappings.
+" <CR>: close popup and save indent.
+inoremap <expr><CR>  neocomplcache#smart_close_popup() . "\<CR>"
+" <TAB>: completion.
+inoremap <expr><TAB>  pumvisible() ? "\<C-n>" : "\<TAB>"
+" <C-h>, <BS>: close popup and delete backword char.
+inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>"
+inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>"
+inoremap <expr><C-y>  neocomplcache#close_popup()
+inoremap <expr><C-e>  neocomplcache#cancel_popup()
+
+" AutoComplPop like behavior.
+"let g:neocomplcache_enable_auto_select = 1
+
+" Shell like behavior(not recommended).
+"set completeopt+=longest
+"let g:neocomplcache_enable_auto_select = 1
+"let g:neocomplcache_disable_auto_complete = 1
+"inoremap <expr><TAB>  pumvisible() ? "\<Down>" : "\<TAB>"
+"inoremap <expr><CR>  neocomplcache#smart_close_popup() . "\<CR>"
+
+" Enable omni completion.
+autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
+autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
+autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
+autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
+autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
+
+" Enable heavy omni completion.
+if !exists('g:neocomplcache_omni_patterns')
+  let g:neocomplcache_omni_patterns = {}
+endif
+let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
+"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
+let g:neocomplcache_omni_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
+let g:neocomplcache_omni_patterns.c = '\%(\.\|->\)\h\w*'
+let g:neocomplcache_omni_patterns.cpp = '\h\w*\%(\.\|->\)\h\w*\|\h\w*::'

vimfiles/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim

+"=============================================================================
+" FILE: buffer_complete.vim
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 20 Jun 2011.
+" License: MIT license  {{{
+"     Permission is hereby granted, free of charge, to any person obtaining
+"     a copy of this software and associated documentation files (the
+"     "Software"), to deal in the Software without restriction, including
+"     without limitation the rights to use, copy, modify, merge, publish,
+"     distribute, sublicense, and/or sell copies of the Software, and to
+"     permit persons to whom the Software is furnished to do so, subject to
+"     the following conditions:
+"
+"     The above copyright notice and this permission notice shall be included
+"     in all copies or substantial portions of the Software.
+"
+"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+" Important variables.
+if !exists('s:buffer_sources')
+  let s:buffer_sources = {}
+endif
+
+let s:source = {
+      \ 'name' : 'buffer_complete',
+      \ 'kind' : 'plugin',
+      \}
+
+function! s:source.initialize()"{{{
+  augroup neocomplcache"{{{
+    " Caching events
+    autocmd InsertEnter * call s:check_source()
+    autocmd CursorHold * call s:rank_caching_current_cache_line(1)
+    autocmd CursorHold * call s:check_deleted_buffer()
+    autocmd InsertEnter,CursorHoldI * call s:rank_caching_current_cache_line(0)
+    autocmd InsertLeave * call neocomplcache#sources#buffer_complete#caching_current_cache_line()
+    autocmd VimLeavePre * call s:save_all_cache()
+  augroup END"}}}
+
+  " Set rank.
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'buffer_complete', 4)
+
+  " Set completion length.
+  call neocomplcache#set_completion_length('buffer_complete', 0)
+
+  " Create cache directory.
+  if !isdirectory(g:neocomplcache_temporary_dir . '/buffer_cache')
+    call mkdir(g:neocomplcache_temporary_dir . '/buffer_cache', 'p')
+  endif
+
+  " Initialize script variables."{{{
+  let s:buffer_sources = {}
+  let s:filetype_frequencies = {}
+  let s:cache_line_count = 70
+  let s:rank_cache_count = 1
+  let s:disable_caching_list = {}
+  let s:completion_length = g:neocomplcache_auto_completion_start_length
+  "}}}
+
+  " Add commands."{{{
+  command! -nargs=? -complete=buffer NeoComplCacheCachingBuffer call s:caching_buffer(<q-args>)
+  command! -nargs=? -complete=buffer NeoComplCachePrintSource call s:print_source(<q-args>)
+  command! -nargs=? -complete=buffer NeoComplCacheOutputKeyword call s:output_keyword(<q-args>)
+  command! -nargs=? -complete=buffer NeoComplCacheSaveCache call s:save_all_cache()
+  command! -nargs=? -complete=buffer NeoComplCacheDisableCaching call s:disable_caching(<q-args>)
+  command! -nargs=? -complete=buffer NeoComplCacheEnableCaching call s:enable_caching(<q-args>)
+  "}}}
+endfunction
+"}}}
+
+function! s:source.finalize()"{{{
+  delcommand NeoComplCacheCachingBuffer
+  delcommand NeoComplCachePrintSource
+  delcommand NeoComplCacheOutputKeyword
+  delcommand NeoComplCacheSaveCache
+  delcommand NeoComplCacheDisableCaching
+  delcommand NeoComplCacheEnableCaching
+
+  call s:save_all_cache()
+
+  let s:buffer_sources = {}
+endfunction"}}}
+
+function! s:source.get_keyword_list(cur_keyword_str)"{{{
+  if neocomplcache#is_auto_complete() && len(a:cur_keyword_str) < s:completion_length
+    " Check member prefix pattern.
+    let l:filetype = neocomplcache#get_context_filetype()
+    if !has_key(g:neocomplcache_member_prefix_patterns, l:filetype)
+          \ || g:neocomplcache_member_prefix_patterns[l:filetype] == ''
+      return []
+    endif
+
+    let l:cur_text = neocomplcache#get_cur_text()
+    let l:var_name = matchstr(l:cur_text, '\%(\h\w*\%(()\?\)\?\%(' .
+          \ g:neocomplcache_member_prefix_patterns[l:filetype] . '\m\)\)\+$')
+    if l:var_name == ''
+      return []
+    endif
+
+    let l:keyword_list = []
+    for src in s:get_sources_list()
+      if has_key(s:buffer_sources[src].member_cache, l:var_name)
+        let l:keyword_list += values(s:buffer_sources[src].member_cache[l:var_name])
+      endif
+    endfor
+  else
+    let l:keyword_list = []
+    for src in s:get_sources_list()
+      let l:keyword_cache = neocomplcache#dictionary_filter(
+            \ s:buffer_sources[src].keyword_cache, a:cur_keyword_str, s:completion_length)
+
+      if src == bufnr('%')
+        call s:calc_frequency(l:keyword_cache)
+      endif
+
+      let l:keyword_list += l:keyword_cache
+    endfor
+  endif
+
+  return l:keyword_list
+endfunction"}}}
+
+function! neocomplcache#sources#buffer_complete#define()"{{{
+  return s:source
+endfunction"}}}
+
+function! neocomplcache#sources#buffer_complete#get_frequencies()"{{{
+  let l:filetype = neocomplcache#get_context_filetype()
+  if !has_key(s:filetype_frequencies, l:filetype)
+    return {}
+  endif
+
+  return s:filetype_frequencies[l:filetype]
+endfunction"}}}
+
+function! neocomplcache#sources#buffer_complete#caching_current_cache_line()"{{{
+  " Current line caching.
+
+  if !s:exists_current_source() || has_key(s:disable_caching_list, bufnr('%'))
+    return
+  endif
+
+  let l:source = s:buffer_sources[bufnr('%')]
+  let l:filename = fnamemodify(l:source.name, ':t')
+  let l:menu = '[B] ' . neocomplcache#util#strwidthpart(
+        \ l:filename, g:neocomplcache_max_filename_width)
+  let l:keyword_pattern = l:source.keyword_pattern
+  let l:keyword_pattern2 = '^\%('.l:keyword_pattern.'\m\)'
+  let l:keywords = l:source.keyword_cache
+
+  let l:line = join(getline(line('.')-1, line('.')+1))
+  let l:match = match(l:line, l:keyword_pattern)
+  while l:match >= 0"{{{
+    let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match)
+
+    " Ignore too short keyword.
+    if len(l:match_str) >= g:neocomplcache_min_keyword_length"{{{
+      " Check dup.
+      let l:key = tolower(l:match_str[: s:completion_length-1])
+      if !has_key(l:keywords, l:key)
+        let l:keywords[l:key] = {}
+      endif
+      if !has_key(l:keywords[l:key], l:match_str)
+        " Append list.
+        let l:keywords[l:key][l:match_str] = { 'word' : l:match_str, 'menu' : l:menu }
+      endif
+    endif"}}}
+
+    " Next match.
+    let l:match = match(l:line, l:keyword_pattern, l:match + len(l:match_str))
+  endwhile"}}}
+endfunction"}}}
+
+function! s:calc_frequency(list)"{{{
+  if !s:exists_current_source()
+    return
+  endif
+
+  let l:list_len = len(a:list)
+
+  if l:list_len > g:neocomplcache_max_list * 5
+    let l:calc_cnt = 15
+  elseif l:list_len > g:neocomplcache_max_list * 3
+    let l:calc_cnt = 13
+  elseif l:list_len > g:neocomplcache_max_list
+    let l:calc_cnt = 10
+  elseif l:list_len > g:neocomplcache_max_list / 2
+    let l:calc_cnt = 8
+  elseif l:list_len > g:neocomplcache_max_list / 3
+    let l:calc_cnt = 5
+  elseif l:list_len > g:neocomplcache_max_list / 4
+    let l:calc_cnt = 4
+  else
+    let l:calc_cnt = 3
+  endif
+
+  let l:source = s:buffer_sources[bufnr('%')]
+  let l:frequencies = l:source.frequencies
+  let l:filetype = neocomplcache#get_context_filetype()
+  if !has_key(s:filetype_frequencies, l:filetype)
+    let s:filetype_frequencies[l:filetype] = {}
+  endif
+  let l:filetype_frequencies = s:filetype_frequencies[l:filetype]
+  
+  for keyword in a:list
+    if s:rank_cache_count <= 0
+      " Set rank.
+      
+      let l:word = keyword.word
+      let l:frequency = 0
+      for rank_lines in values(l:source.rank_lines)
+        if has_key(rank_lines, l:word)
+          let l:frequency += rank_lines[l:word]
+        endif
+      endfor
+      
+      if !has_key(l:filetype_frequencies, l:word)
+        let l:filetype_frequencies[l:word] = 0
+      endif
+      if has_key(l:frequencies, l:word)
+        let l:filetype_frequencies[l:word] -= l:frequencies[l:word]
+      endif
+      if l:frequency == 0
+        " Garbage collect
+        let l:ignorecase_save = &ignorecase
+        let &ignorecase = 0
+        let l:pos = searchpos(neocomplcache#escape_match(l:word), 'ncw', 0)
+        let &ignorecase = l:ignorecase_save
+        
+        if l:pos[0] == 0
+          " Delete.
+          let l:key = tolower(l:word[: s:completion_length-1])
+          if has_key(l:source.keyword_cache[l:key], l:word)
+            call remove(l:source.keyword_cache[l:key], l:word)
+          endif
+          if has_key(l:source.frequencies, l:word)
+            call remove(l:source.frequencies, l:word)
+          endif
+          if l:filetype_frequencies[l:word] == 0
+            call remove(l:filetype_frequencies, l:word)
+          endif
+        else
+          let l:frequencies[l:word] = 1
+          let l:filetype_frequencies[l:word] += 1
+        endif
+      else
+        let l:frequencies[l:word] = l:frequency
+        let l:filetype_frequencies[l:word] += l:frequency
+      endif
+
+      " Reset count.
+      let s:rank_cache_count = neocomplcache#rand(l:calc_cnt)
+    endif
+
+    let s:rank_cache_count -= 1
+  endfor
+endfunction"}}}
+
+function! s:get_sources_list()"{{{
+  let l:sources_list = []
+
+  let l:filetypes_dict = {}
+  for l:filetype in neocomplcache#get_source_filetypes(neocomplcache#get_context_filetype())
+    let l:filetypes_dict[l:filetype] = 1
+  endfor
+
+  for key in keys(s:buffer_sources)
+    if has_key(l:filetypes_dict, s:buffer_sources[key].filetype) || bufnr('%') == key
+          \ || (bufname('%') ==# '[Command Line]' && bufnr('#') == key)
+      call add(l:sources_list, key)
+    endif
+  endfor
+
+  return l:sources_list
+endfunction"}}}
+
+function! s:rank_caching_current_cache_line(is_force)"{{{
+  if !s:exists_current_source() || neocomplcache#is_locked()
+    return
+  endif
+
+  let l:source = s:buffer_sources[bufnr('%')]
+  let l:filename = fnamemodify(l:source.name, ':t')
+
+  let l:start_line = (line('.')-1)/l:source.cache_line_cnt*l:source.cache_line_cnt+1
+  let l:end_line = l:start_line + l:source.cache_line_cnt-1
+  let l:cache_num = (l:start_line-1) / l:source.cache_line_cnt
+
+  " For debugging.
+  "echomsg printf("start=%d, end=%d", l:start_line, l:end_line)
+
+  if !a:is_force && has_key(l:source.rank_lines, l:cache_num)
+    return
+  endif
+
+  " Clear cache line.
+  let l:source.rank_lines[l:cache_num] = {}
+  let l:rank_lines = l:source.rank_lines[l:cache_num]
+
+  let l:buflines = getline(l:start_line, l:end_line)
+  let l:menu = '[B] ' . neocomplcache#util#strwidthpart(
+        \ l:filename, g:neocomplcache_max_filename_width)
+  let l:keyword_pattern = l:source.keyword_pattern
+  let l:keyword_pattern2 = '^\%('.l:keyword_pattern.'\m\)'
+
+  let [l:line_num, l:max_lines] = [0, len(l:buflines)]
+  while l:line_num < l:max_lines
+    let l:line = buflines[l:line_num]
+    let l:match = match(l:line, l:keyword_pattern)
+
+    while l:match >= 0"{{{
+      let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match)
+
+      " Ignore too short keyword.
+      if len(l:match_str) >= g:neocomplcache_min_keyword_length"{{{
+        if !has_key(l:rank_lines, l:match_str)
+          let l:rank_lines[l:match_str] = 1
+        else
+          let l:rank_lines[l:match_str] += 1
+        endif
+      endif"}}}
+
+      " Next match.
+      let l:match = match(l:line, l:keyword_pattern, l:match + len(l:match_str))
+    endwhile"}}}
+
+    let l:line_num += 1
+  endwhile
+
+  let l:filetype = neocomplcache#get_context_filetype(1)
+  if !has_key(g:neocomplcache_member_prefix_patterns, l:filetype)
+        \ || g:neocomplcache_member_prefix_patterns[l:filetype] == ''
+    return
+  endif
+
+  let l:menu = '[B] member'
+  let l:keyword_pattern = '\%(\h\w*\%(()\?\)\?\%(' . g:neocomplcache_member_prefix_patterns[l:filetype] . '\m\)\)\+\h\w*\%(()\?\)\?'
+  let l:keyword_pattern2 = '^'.l:keyword_pattern
+  let l:member_pattern = '\h\w*\%(()\?\)\?$'
+
+  " Cache member pattern.
+  let [l:line_num, l:max_lines] = [0, len(l:buflines)]
+  while l:line_num < l:max_lines
+    let l:line = buflines[l:line_num]
+    let l:match = match(l:line, l:keyword_pattern)
+
+    while l:match >= 0"{{{
+      let l:match_str = matchstr(l:line, l:keyword_pattern2, l:match)
+
+      " Next match.
+      let l:match = matchend(l:line, l:keyword_pattern, l:match + len(l:match_str))
+
+      while l:match_str != ''
+        let l:member_name = matchstr(l:match_str, l:member_pattern)
+        let l:var_name = l:match_str[ : -len(l:member_name)-1]
+
+        if !has_key(l:source.member_cache, l:var_name)
+          let l:source.member_cache[l:var_name] = {}
+        endif
+        if !has_key(l:source.member_cache[l:var_name], l:member_name)
+          let l:source.member_cache[l:var_name][l:member_name] = { 'word' : l:member_name, 'menu' : l:menu }
+        endif
+
+        let l:match_str = matchstr(l:var_name, l:keyword_pattern2)
+      endwhile
+    endwhile"}}}
+
+    let l:line_num += 1
+  endwhile
+endfunction"}}}
+
+function! s:initialize_source(srcname)"{{{
+  let l:path = fnamemodify(bufname(a:srcname), ':p')
+  let l:filename = fnamemodify(l:path, ':t')
+  if l:filename == ''
+    let l:filename = '[No Name]'
+    let l:path .= '/[No Name]'
+  endif
+
+  " Set cache line count.
+  let l:buflines = getbufline(a:srcname, 1, '$')
+  let l:end_line = len(l:buflines)
+
+  if l:end_line > 150
+    let cnt = 0
+    for line in l:buflines[50:150] 
+      let cnt += len(line)
+    endfor
+
+    if cnt <= 3000
+      let l:cache_line_cnt = s:cache_line_count
+    elseif cnt <= 4000
+      let l:cache_line_cnt = s:cache_line_count*7 / 10
+    elseif cnt <= 5000
+      let l:cache_line_cnt = s:cache_line_count / 2
+    elseif cnt <= 7500
+      let l:cache_line_cnt = s:cache_line_count / 3
+    elseif cnt <= 10000
+      let l:cache_line_cnt = s:cache_line_count / 5
+    elseif cnt <= 12000
+      let l:cache_line_cnt = s:cache_line_count / 7
+    elseif cnt <= 14000
+      let l:cache_line_cnt = s:cache_line_count / 10
+    else
+      let l:cache_line_cnt = s:cache_line_count / 13
+    endif
+  elseif l:end_line > 100
+    let l:cache_line_cnt = s:cache_line_count / 3
+  else
+    let l:cache_line_cnt = s:cache_line_count / 5
+  endif
+
+  let l:ft = getbufvar(a:srcname, '&filetype')
+  if l:ft == ''
+    let l:ft = 'nothing'
+  endif
+
+  let l:keyword_pattern = neocomplcache#get_keyword_pattern(l:ft)
+
+  let s:buffer_sources[a:srcname] = {
+        \ 'keyword_cache' : {}, 'rank_lines' : {}, 'member_cache' : {},
+        \ 'name' : l:filename, 'filetype' : l:ft, 'keyword_pattern' : l:keyword_pattern,
+        \ 'end_line' : l:end_line , 'cache_line_cnt' : l:cache_line_cnt,
+        \ 'frequencies' : {}, 'check_sum' : len(join(l:buflines[:4], '\n')),
+        \ 'path' : l:path, 'loaded_cache' : 0,
+        \ 'cache_name' : neocomplcache#cache#encode_name('buffer_cache', l:path),
+        \}
+endfunction"}}}
+
+function! s:word_caching(srcname)"{{{
+  " Initialize source.
+  call s:initialize_source(a:srcname)
+
+  let l:source = s:buffer_sources[a:srcname]
+  let l:srcname = fnamemodify(l:source.name, ':p')
+
+  if neocomplcache#cache#check_old_cache('buffer_cache', l:srcname)
+    if l:source.name ==# '[Command Line]'
+          \ || getbufvar(a:srcname, '&buftype') =~ 'nofile'
+      " Ignore caching.
+      return
+    endif
+
+    let l:source.cache_name =
+          \ neocomplcache#cache#async_load_from_file('buffer_cache', l:source.path, l:source.keyword_pattern, 'B')
+  endif
+endfunction"}}}
+
+function! s:check_changed_buffer(bufnumber)"{{{
+  let l:source = s:buffer_sources[a:bufnumber]
+
+  if getbufvar(a:bufnumber, '&buftype') =~ 'nofile'
+    " Check buffer changed.
+    let l:check_sum = len(join(getbufline(a:bufnumber, 1, 5), '\n'))
+    if l:check_sum != l:source.check_sum
+      " Recaching.
+      return 1
+    endif
+  endif
+
+  let l:ft = getbufvar(a:bufnumber, '&filetype')
+  if l:ft == ''
+    let l:ft = 'nothing'
+  endif
+
+  let l:filename = fnamemodify(bufname(a:bufnumber), ':t')
+  if l:filename == ''
+    let l:filename = '[No Name]'
+  endif
+
+  return s:buffer_sources[a:bufnumber].name != l:filename
+        \ || s:buffer_sources[a:bufnumber].filetype != l:ft
+endfunction"}}}
+
+function! s:check_source()"{{{
+  let l:bufnumber = bufnr('%')
+
+  " Check new buffer.
+  let l:bufname = fnamemodify(bufname(l:bufnumber), ':p')
+  if (!has_key(s:buffer_sources, l:bufnumber) || s:check_changed_buffer(l:bufnumber))
+        \ && !has_key(s:disable_caching_list, l:bufnumber)
+        \ && !neocomplcache#is_locked(l:bufnumber)
+        \ && !getwinvar(bufwinnr(l:bufnumber), '&previewwindow')
+        \ && getfsize(l:bufname) < g:neocomplcache_caching_limit_file_size
+        \ && (g:neocomplcache_force_caching_buffer_name_pattern == ''
+        \       || l:bufname !~ g:neocomplcache_force_caching_buffer_name_pattern)
+
+    " Caching.
+    call s:word_caching(l:bufnumber)
+  endif
+
+  if has_key(s:buffer_sources, l:bufnumber)
+        \ && !s:buffer_sources[l:bufnumber].loaded_cache
+    let l:source = s:buffer_sources[l:bufnumber]
+
+    if filereadable(l:source.cache_name)
+      " Caching from cache.
+      call neocomplcache#cache#list2index(
+            \ neocomplcache#cache#load_from_cache('buffer_cache', l:source.path),
+            \ l:source.keyword_cache,
+            \ s:completion_length)
+
+      let l:source.loaded_cache = 1
+    endif
+  endif
+endfunction"}}}
+function! s:check_deleted_buffer()"{{{
+  " Check deleted buffer.
+  for key in keys(s:buffer_sources)
+    if !bufloaded(str2nr(key))
+      " Save cache.
+      call s:save_cache(key)
+
+      " Remove item.
+      call remove(s:buffer_sources, key)
+    endif
+  endfor
+endfunction"}}}
+
+function! s:exists_current_source()"{{{
+  return has_key(s:buffer_sources, bufnr('%'))
+endfunction"}}}
+
+function! s:save_cache(srcname)"{{{
+  if s:buffer_sources[a:srcname].end_line < 500
+    return
+  endif
+
+  if getbufvar(a:srcname, '&buftype') =~ 'nofile'
+    return
+  endif
+
+  let l:srcname = fnamemodify(bufname(str2nr(a:srcname)), ':p')
+  if !filereadable(l:srcname) ||
+        \ (g:neocomplcache_disable_caching_file_path_pattern != ''
+        \   && l:srcname =~ g:neocomplcache_disable_caching_file_path_pattern)
+    return
+  endif
+
+  let l:cache_name = neocomplcache#cache#encode_name('buffer_cache', l:srcname)
+
+  if filereadable(l:cache_name) &&
+        \ (g:neocomplcache_disable_caching_file_path_pattern != ''
+        \   && l:srcname =~ g:neocomplcache_disable_caching_file_path_pattern)
+    " Delete cache file.
+    call delete(l:cache_name)
+    return
+  endif
+
+  if getftime(l:cache_name) >= getftime(l:srcname)
+    return
+  endif
+
+  " Output buffer.
+  call neocomplcache#cache#save_cache('buffer_cache', l:srcname, neocomplcache#unpack_dictionary(s:buffer_sources[a:srcname].keyword_cache))
+endfunction "}}}
+function! s:save_all_cache()"{{{
+  try
+    for l:key in keys(s:buffer_sources)
+      call s:save_cache(l:key)
+    endfor
+  catch
+    call neocomplcache#print_error('Error occured while saving cache!')
+    let l:error_file = g:neocomplcache_temporary_dir . strftime('/error-%Y-%m-%d.log')
+    call writefile([v:exception . ' ' . v:throwpoint], l:error_file)
+    call neocomplcache#print_error('Please check error file: ' . l:error_file)
+  endtry
+endfunction"}}}
+
+" Command functions."{{{
+function! s:caching_buffer(name)"{{{
+  if a:name == ''
+    let l:number = bufnr('%')
+  else
+    let l:number = bufnr(a:name)
+
+    if l:number < 0
+      call neocomplcache#print_error('Invalid buffer name.')
+      return
+    endif
+  endif
+
+  " Word recaching.
+  call s:word_caching(l:number)
+endfunction"}}}
+function! s:print_source(name)"{{{
+  if a:name == ''
+    let l:number = bufnr('%')
+  else
+    let l:number = bufnr(a:name)
+
+    if l:number < 0
+      call neocomplcache#print_error('Invalid buffer name.')
+      return
+    endif
+  endif
+
+  if !has_key(s:buffer_sources, l:number)
+    return
+  endif
+
+  silent put=printf('Print neocomplcache %d source.', l:number)
+  for l:key in keys(s:buffer_sources[l:number])
+    silent put =printf('%s => %s', l:key, string(s:buffer_sources[l:number][l:key]))
+  endfor
+endfunction"}}}
+function! s:output_keyword(name)"{{{
+  if a:name == ''
+    let l:number = bufnr('%')
+  else
+    let l:number = bufnr(a:name)
+
+    if l:number < 0
+      call neocomplcache#print_error('Invalid buffer name.')
+      return
+    endif
+  endif
+
+  if !has_key(s:buffer_sources, l:number)
+    return
+  endif
+
+  " Output buffer.
+  for keyword in neocomplcache#unpack_dictionary(s:buffer_sources[l:number].keyword_cache)
+    silent put=string(keyword)
+  endfor
+endfunction "}}}
+function! s:disable_caching(name)"{{{
+  if a:name == ''
+    let l:number = bufnr('%')
+  else
+    let l:number = bufnr(a:name)
+
+    if l:number < 0
+      call neocomplcache#print_error('Invalid buffer name.')
+      return
+    endif
+  endif
+
+  let s:disable_caching_list[l:number] = 1
+
+  if has_key(s:buffer_sources, l:number)
+    " Delete source.
+    call remove(s:buffer_sources, l:number)
+  endif
+endfunction"}}}
+function! s:enable_caching(name)"{{{
+  if a:name == ''
+    let l:number = bufnr('%')
+  else
+    let l:number = bufnr(a:name)
+
+    if l:number < 0
+      call neocomplcache#print_error('Invalid buffer name.')
+      return
+    endif
+  endif
+
+  if has_key(s:disable_caching_list, l:number)
+    call remove(s:disable_caching_list, l:number)
+  endif
+endfunction"}}}
+"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker

vimfiles/bundle/neocomplcache/autoload/neocomplcache/sources/completefunc_complete.vim

+"=============================================================================
+" FILE: completefunc_complete.vim
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 25 Jul 2010
+" License: MIT license  {{{
+"     Permission is hereby granted, free of charge, to any person obtaining
+"     a copy of this software and associated documentation files (the
+"     "Software"), to deal in the Software without restriction, including
+"     without limitation the rights to use, copy, modify, merge, publish,
+"     distribute, sublicense, and/or sell copies of the Software, and to
+"     permit persons to whom the Software is furnished to do so, subject to
+"     the following conditions:
+"
+"     The above copyright notice and this permission notice shall be included
+"     in all copies or substantial portions of the Software.
+"
+"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:source = {
+      \ 'name' : 'completefunc_complete',
+      \ 'kind' : 'complfunc',
+      \}
+
+function! s:source.initialize()"{{{
+  " Set rank.
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'completefunc_complete', 5)
+endfunction"}}}
+function! s:source.finalize()"{{{
+endfunction"}}}
+
+function! s:source.get_keyword_pos(cur_text)"{{{
+  return -1
+endfunction"}}}
+
+function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
+  return []
+endfunction"}}}
+
+function! neocomplcache#sources#completefunc_complete#define()"{{{
+  return s:source
+endfunction"}}}
+
+function! neocomplcache#sources#completefunc_complete#call_completefunc(funcname)"{{{
+  let l:cur_text = neocomplcache#get_cur_text()
+
+  " Save pos.
+  let l:pos = getpos('.')
+  let l:line = getline('.')
+
+  let l:cur_keyword_pos = call(a:funcname, [1, ''])
+
+  " Restore pos.
+  call setpos('.', l:pos)
+
+  if l:cur_keyword_pos < 0
+    return ''
+  endif
+  let l:cur_keyword_str = l:cur_text[l:cur_keyword_pos :]
+
+  let l:pos = getpos('.')
+
+  let l:list = call(a:funcname, [0, l:cur_keyword_str])
+
+  call setpos('.', l:pos)
+
+  if empty(l:list)
+    return ''
+  endif
+
+  let l:list = s:get_completefunc_list(l:list)
+
+  " Start manual complete.
+  return neocomplcache#start_manual_complete_list(l:cur_keyword_pos, l:cur_keyword_str, l:list)
+endfunction"}}}
+
+function! s:get_completefunc_list(list)"{{{
+  let l:comp_list = []
+
+  " Convert string list.
+  for str in filter(copy(a:list), 'type(v:val) == '.type(''))
+    let l:dict = { 'word' : str, 'menu' : '[C]' }
+
+    call add(l:comp_list, l:dict)
+  endfor
+
+  for l:comp in filter(a:list, 'type(v:val) != '.type(''))
+    let l:dict = {
+          \'word' : l:comp.word, 'menu' : '[C]', 
+          \'abbr' : has_key(l:comp, 'abbr')? l:comp.abbr : l:comp.word
+          \}
+
+    if has_key(l:comp, 'kind')
+      let l:dict.kind = l:comp.kind
+    endif
+
+    if has_key(l:comp, 'menu')
+      let l:dict.menu .= ' ' . l:comp.menu
+    endif
+
+    call add(l:comp_list, l:dict)
+  endfor
+
+  return l:comp_list
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker

vimfiles/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim

+"=============================================================================
+" FILE: dictionary_complete.vim
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 21 Jul 2011.
+" License: MIT license  {{{
+"     Permission is hereby granted, free of charge, to any person obtaining
+"     a copy of this software and associated documentation files (the
+"     "Software"), to deal in the Software without restriction, including
+"     without limitation the rights to use, copy, modify, merge, publish,
+"     distribute, sublicense, and/or sell copies of the Software, and to
+"     permit persons to whom the Software is furnished to do so, subject to
+"     the following conditions:
+"
+"     The above copyright notice and this permission notice shall be included
+"     in all copies or substantial portions of the Software.
+"
+"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! neocomplcache#sources#dictionary_complete#define()"{{{
+  return s:source
+endfunction"}}}
+
+let s:source = {
+      \ 'name' : 'dictionary_complete',
+      \ 'kind' : 'plugin',
+      \}
+
+function! s:source.initialize()"{{{
+  " Initialize.
+  let s:dictionary_list = {}
+  let s:completion_length = neocomplcache#get_auto_completion_length('dictionary_complete')
+  let s:async_dictionary_list = {}
+
+  " Initialize dictionary."{{{
+  if !exists('g:neocomplcache_dictionary_filetype_lists')
+    let g:neocomplcache_dictionary_filetype_lists = {}
+  endif
+  if !has_key(g:neocomplcache_dictionary_filetype_lists, 'default')
+    let g:neocomplcache_dictionary_filetype_lists['default'] = ''
+  endif
+  "}}}
+
+  " Initialize dictionary completion pattern."{{{
+  if !exists('g:neocomplcache_dictionary_patterns')
+    let g:neocomplcache_dictionary_patterns = {}
+  endif
+  "}}}
+
+  " Set caching event.
+  autocmd neocomplcache FileType * call s:caching()
+
+  " Add command.
+  command! -nargs=? -complete=customlist,neocomplcache#filetype_complete NeoComplCacheCachingDictionary call s:recaching(<q-args>)
+
+  " Create cache directory.
+  if !isdirectory(g:neocomplcache_temporary_dir . '/dictionary_cache')
+    call mkdir(g:neocomplcache_temporary_dir . '/dictionary_cache')
+  endif
+
+  " Initialize check.
+  call s:caching()
+endfunction"}}}
+
+function! s:source.finalize()"{{{
+  delcommand NeoComplCacheCachingDictionary
+endfunction"}}}
+
+function! s:source.get_keyword_list(cur_keyword_str)"{{{
+  let l:list = []
+
+  let l:filetype = neocomplcache#is_text_mode() ? 'text' : neocomplcache#get_context_filetype()
+  if neocomplcache#is_text_mode() && !has_key(s:dictionary_list, 'text')
+    " Caching.
+    call s:caching()
+  endif
+
+  for l:ft in neocomplcache#get_source_filetypes(l:filetype)
+    call neocomplcache#cache#check_cache('dictionary_cache', l:ft, s:async_dictionary_list,
+      \ s:dictionary_list, s:completion_length)
+
+    for l:source in neocomplcache#get_sources_list(s:dictionary_list, l:ft)
+      let l:list += neocomplcache#dictionary_filter(l:source, a:cur_keyword_str, s:completion_length)
+    endfor
+  endfor
+
+  return l:list
+endfunction"}}}
+
+function! s:caching()"{{{
+  if !bufloaded(bufnr('%'))
+    return
+  endif
+
+  let l:key = neocomplcache#is_text_mode() ? 'text' : neocomplcache#get_context_filetype()
+  for l:filetype in neocomplcache#get_source_filetypes(l:key)
+    if !has_key(s:dictionary_list, l:filetype)
+          \ && !has_key(s:async_dictionary_list, l:filetype)
+      call s:recaching(l:filetype)
+    endif
+  endfor
+endfunction"}}}
+
+function! s:caching_dictionary(filetype)
+  if a:filetype == ''
+    let l:filetype = neocomplcache#get_context_filetype(1)
+  else
+    let l:filetype = a:filetype
+  endif
+  if has_key(s:async_dictionary_list, l:filetype)
+        \ && filereadable(s:async_dictionary_list[l:filetype].cache_name)
+    " Delete old cache.
+    call delete(s:async_dictionary_list[l:filetype].cache_name)
+  endif
+
+  call s:recaching(l:filetype)
+endfunction
+function! s:recaching(filetype)"{{{
+  " Caching.
+  if has_key(g:neocomplcache_dictionary_filetype_lists, a:filetype)
+    let l:dictionaries = g:neocomplcache_dictionary_filetype_lists[a:filetype]
+  elseif a:filetype != &filetype || &l:dictionary == ''
+    return
+  else
+    let l:dictionaries = &l:dictionary
+  endif
+
+  let s:async_dictionary_list[a:filetype] = []
+
+  let l:pattern = has_key(g:neocomplcache_dictionary_patterns, a:filetype) ?
+        \ g:neocomplcache_dictionary_patterns[a:filetype] :
+        \ neocomplcache#get_keyword_pattern(a:filetype)
+  for l:dictionary in split(l:dictionaries, ',')
+    if filereadable(l:dictionary)
+      call add(s:async_dictionary_list[a:filetype], {
+            \ 'filename' : l:dictionary,
+            \ 'cachename' : neocomplcache#cache#async_load_from_file(
+            \       'dictionary_cache', l:dictionary, l:pattern, 'D')
+            \ })
+    endif
+  endfor
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker

vimfiles/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim

+"=============================================================================
+" FILE: filename_complete.vim
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 09 Aug 2011.
+" License: MIT license  {{{
+"     Permission is hereby granted, free of charge, to any person obtaining
+"     a copy of this software and associated documentation files (the
+"     "Software"), to deal in the Software without restriction, including
+"     without limitation the rights to use, copy, modify, merge, publish,
+"     distribute, sublicense, and/or sell copies of the Software, and to
+"     permit persons to whom the Software is furnished to do so, subject to
+"     the following conditions:
+"
+"     The above copyright notice and this permission notice shall be included
+"     in all copies or substantial portions of the Software.
+"
+"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:source = {
+      \ 'name' : 'filename_complete',
+      \ 'kind' : 'complfunc',
+      \}
+
+function! s:source.initialize()"{{{
+  " Initialize.
+  let s:skip_dir = {}
+
+  call neocomplcache#set_completion_length('filename_complete', g:neocomplcache_auto_completion_start_length)
+
+  " Set rank.
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'filename_complete', 2)
+endfunction"}}}
+function! s:source.finalize()"{{{
+endfunction"}}}
+
+function! s:source.get_keyword_pos(cur_text)"{{{
+  let l:filetype = neocomplcache#get_context_filetype()
+  if l:filetype ==# 'vimshell' || l:filetype ==# 'unite' || neocomplcache#within_comment()
+    return -1
+  endif
+
+  " Not Filename pattern.
+  if a:cur_text =~
+        \'\*$\|\.\.\+$\|[/\\][/\\]\f*$\|/c\%[ygdrive/]$\|\\|$\|\a:[^/]*$'
+    return -1
+  endif
+
+  " Filename pattern.
+  let l:pattern = neocomplcache#get_keyword_pattern_end('filename')
+  let [l:cur_keyword_pos, l:cur_keyword_str] = neocomplcache#match_word(a:cur_text, l:pattern)
+
+  " Not Filename pattern.
+  if neocomplcache#is_win() && l:filetype == 'tex' && l:cur_keyword_str =~ '\\'
+    return -1
+  endif
+
+  " Skip directory.
+  if neocomplcache#is_auto_complete()
+    let l:dir = simplify(fnamemodify(l:cur_keyword_str, ':p:h'))
+    if l:dir != '' && has_key(s:skip_dir, l:dir)
+      return -1
+    endif
+  endif
+
+  return l:cur_keyword_pos
+endfunction"}}}
+
+function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{
+  let l:filetype = neocomplcache#get_context_filetype()
+
+  " Check include pattern.
+  let l:pattern = exists('g:neocomplcache_include_patterns') &&
+        \ has_key(g:neocomplcache_include_patterns, l:filetype) ?
+        \ g:neocomplcache_include_patterns[l:filetype] :
+        \ getbufvar(bufnr('%'), '&include')
+  let l:line = neocomplcache#get_cur_text()
+  return (l:pattern == '' || l:line !~ l:pattern) ?
+        \ s:get_glob_files(a:cur_keyword_str, '') :
+        \ s:get_include_files(a:cur_keyword_str)
+endfunction"}}
+
+function! s:get_include_files(cur_keyword_str)"{{{
+  let l:filetype = neocomplcache#get_context_filetype()
+
+  let l:path = exists('g:neocomplcache_include_patterns') &&
+        \ has_key(g:neocomplcache_include_paths, l:filetype) ?
+        \ g:neocomplcache_include_paths[l:filetype] :
+        \ getbufvar(bufnr('%'), '&path')
+
+  let l:pattern = exists('g:neocomplcache_include_patterns') &&
+        \ has_key(g:neocomplcache_include_patterns, l:filetype) ?
+        \ g:neocomplcache_include_patterns[l:filetype] :
+        \ getbufvar(bufnr('%'), '&include')
+  let l:line = neocomplcache#get_cur_text()
+  let l:match_end = matchend(l:line, l:pattern)
+  let l:cur_keyword_str = matchstr(l:line[l:match_end :], '\f\+')
+
+  " Path search.
+  let l:glob = (l:cur_keyword_str !~ '\*$')?
+        \ l:cur_keyword_str . '*' : l:cur_keyword_str
+  let l:cwd = getcwd()
+  let l:bufdirectory = fnamemodify(expand('%'), ':p:h')
+  let l:dir_list = []
+  let l:file_list = []
+  for subpath in map(split(l:path, ','), 'substitute(v:val, "\\\\", "/", "g")')
+    let l:dir = (subpath == '.') ? l:bufdirectory : subpath
+    if !isdirectory(l:dir)
+      continue
+    endif
+    lcd `=l:dir`
+
+    for word in split(substitute(glob(l:glob), '\\', '/', 'g'), '\n')
+      let l:dict = { 'word' : word, 'menu' : '[F]' }
+
+      let l:abbr = l:dict.word
+      if isdirectory(l:word)
+        let l:abbr .= '/'
+        if g:neocomplcache_enable_auto_delimiter
+          let l:dict.word .= '/'
+        endif
+      endif
+      let l:dict.abbr = l:abbr
+
+      " Escape word.
+      let l:dict.word = escape(l:dict.word, ' *?[]"={}')
+
+      call add(isdirectory(l:word) ? l:dir_list : l:file_list, l:dict)
+    endfor
+  endfor
+  lcd `=l:cwd`
+
+  return neocomplcache#keyword_filter(l:dir_list, a:cur_keyword_str)
+        \ + neocomplcache#keyword_filter(l:file_list, a:cur_keyword_str)
+endfunction"}}}
+
+let s:cached_files = {}
+
+function! s:get_glob_files(cur_keyword_str, path)"{{{
+  let l:path = ',,' . substitute(a:path, '\.\%(,\|$\)\|,,', '', 'g')
+
+  let l:cur_keyword_str = a:cur_keyword_str
+  let l:cur_keyword_str = escape(a:cur_keyword_str, '[]')
+  let l:cur_keyword_str = substitute(l:cur_keyword_str, '\\ ', ' ', 'g')
+
+  let l:glob = (l:cur_keyword_str !~ '\*$')?  l:cur_keyword_str . '*' : l:cur_keyword_str
+
+  if a:path == '' && l:cur_keyword_str !~ '/'
+    if !has_key(s:cached_files, getcwd())
+      call s:caching_current_files()
+    endif
+
+    let l:files = copy(s:cached_files[getcwd()])
+  else
+    try
+      let l:globs = globpath(l:path, l:glob)
+    catch
+      return []
+    endtry
+    let l:files = split(substitute(l:globs, '\\', '/', 'g'), '\n')
+
+    if empty(l:files)
+      " Add '*' to a delimiter.
+      let l:cur_keyword_str = substitute(l:cur_keyword_str, '\w\+\ze[/._-]', '\0*', 'g')
+      let l:glob = (l:cur_keyword_str !~ '\*$')?  l:cur_keyword_str . '*' : l:cur_keyword_str
+
+      try
+        let l:globs = globpath(l:path, l:glob)
+      catch
+        return []
+      endtry
+      let l:files = split(substitute(l:globs, '\\', '/', 'g'), '\n')
+    endif
+  endif
+
+  let l:files = neocomplcache#keyword_filter(map(
+        \ l:files, '{
+        \    "word" : fnamemodify(v:val, ":t"),
+        \    "orig" : v:val,
+        \ }'),
+        \ fnamemodify(a:cur_keyword_str, ':t'))
+
+  if (neocomplcache#is_auto_complete() && len(l:files) > g:neocomplcache_max_list)
+    let l:files = l:files[: g:neocomplcache_max_list - 1]
+  endif
+
+  let l:files = map(l:files, '{
+        \    "word" : substitute(v:val.orig, "//", "/", "g"),
+        \ }')
+
+  if a:cur_keyword_str =~ '^\$\h\w*'
+    let l:env = matchstr(a:cur_keyword_str, '^\$\h\w*')
+    let l:env_ev = eval(l:env)
+    if neocomplcache#is_win()
+      let l:env_ev = substitute(l:env_ev, '\\', '/', 'g')
+    endif
+    let l:len_env = len(l:env_ev)
+  else
+    let l:len_env = 0
+  endif
+
+  let l:home_pattern = '^'.substitute($HOME, '\\', '/', 'g').'/'
+  let l:exts = escape(substitute($PATHEXT, ';', '\\|', 'g'), '.')
+
+  let l:dir_list = []
+  let l:file_list = []
+  for l:dict in l:files
+    let l:dict.menu = '[F]'
+    let l:dict.orig = l:dict.word
+
+    if l:len_env != 0 && l:dict.word[: l:len_env-1] == l:env_ev
+      let l:dict.word = l:env . l:dict.word[l:len_env :]
+    elseif a:cur_keyword_str =~ '^\~/'
+      let l:dict.word = substitute(l:dict.word, l:home_pattern, '\~/', '')
+    endif
+
+    let l:abbr = l:dict.word
+    if isdirectory(expand(l:dict.word))
+      let l:abbr .= '/'
+      if g:neocomplcache_enable_auto_delimiter
+        let l:dict.word .= '/'
+      endif
+    elseif neocomplcache#is_win()
+      if '.'.fnamemodify(l:dict.word, ':e') =~ l:exts
+        let l:abbr .= '*'
+      endif
+    elseif executable(l:dict.word)
+      let l:abbr .= '*'
+    endif
+    let l:dict.abbr = l:abbr
+
+    " Escape word.
+    let l:dict.word = escape(l:dict.word, ' *?[]"={}')
+
+    call add(isdirectory(l:dict.word) ? l:dir_list : l:file_list, l:dict)
+  endfor
+
+  return l:dir_list + l:file_list
+endfunction"}}}
+function! s:caching_current_files()
+  let s:cached_files[getcwd()] =
+        \ split(substitute(glob('*') . "\n" . glob('.*'), '\\', '/', 'g'), '\n')
+endfunction
+
+function! neocomplcache#sources#filename_complete#define()"{{{
+  return s:source
+endfunction"}}}
+
+function! neocomplcache#sources#filename_complete#get_complete_words(cur_keyword_str, path)"{{{
+  return s:get_glob_files(a:cur_keyword_str, a:path)
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker

vimfiles/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim

+"=============================================================================
+" FILE: include_complete.vim
+" AUTHOR:  Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 09 Aug 2011.
+" License: MIT license  {{{
+"     Permission is hereby granted, free of charge, to any person obtaining
+"     a copy of this software and associated documentation files (the
+"     "Software"), to deal in the Software without restriction, including
+"     without limitation the rights to use, copy, modify, merge, publish,
+"     distribute, sublicense, and/or sell copies of the Software, and to
+"     permit persons to whom the Software is furnished to do so, subject to
+"     the following conditions:
+"
+"     The above copyright notice and this permission notice shall be included
+"     in all copies or substantial portions of the Software.
+"
+"     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+"     OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+"     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+"     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+"     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+"     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+"     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:include_info = {}
+
+let s:source = {
+      \ 'name' : 'include_complete',
+      \ 'kind' : 'plugin',
+      \}
+
+function! s:source.initialize()"{{{
+  " Initialize
+  let s:include_info = {}
+  let s:include_cache = {}
+  let s:async_include_cache = {}
+  let s:cached_pattern = {}
+  let s:completion_length = neocomplcache#get_auto_completion_length('include_complete')
+
+  " Set rank.
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_plugin_rank, 'include_complete', 8)
+
+  if neocomplcache#has_vimproc()
+    augroup neocomplcache
+      " Caching events
+      autocmd BufWritePost * call s:check_buffer('', 0)
+    augroup END
+  endif
+
+  " Initialize include pattern."{{{
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_include_patterns, 'java,haskell', '^import')
+  "}}}
+  " Initialize expr pattern."{{{
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_include_exprs, 'haskell',
+        \'substitute(v:fname,''\\.'',''/'',''g'')')
+  "}}}
+  " Initialize path pattern."{{{
+  "}}}
+  " Initialize suffixes pattern."{{{
+  call neocomplcache#set_dictionary_helper(g:neocomplcache_include_suffixes, 'haskell', '.hs')
+  "}}}
+  if !exists('g:neocomplcache_include_max_processes')
+    let g:neocomplcache_include_max_processes = 20
+  endif
+
+  " Create cache directory.
+  if !isdirectory(g:neocomplcache_temporary_dir . '/include_cache')
+    call mkdir(g:neocomplcache_temporary_dir . '/include_cache', 'p')
+  endif
+
+  " Add command.
+  command! -nargs=? -complete=buffer NeoComplCacheCachingInclude call s:caching_include(<q-args>)
+
+  if neocomplcache#exists_echodoc()
+    call echodoc#register('include_complete', s:doc_dict)
+  endif
+endfunction"}}}
+
+function! s:source.finalize()"{{{
+  delcommand NeoComplCacheCachingInclude
+  
+  if neocomplcache#exists_echodoc()
+    call echodoc#unregister('include_complete')
+  endif
+endfunction"}}}
+
+function! s:source.get_keyword_list(cur_keyword_str)"{{{
+  if neocomplcache#within_comment()
+    return []
+  endif
+
+  if !has_key(s:include_info, bufnr('%'))
+    if !neocomplcache#has_vimproc()
+      return []
+    endif
+
+    " Auto caching.
+    call s:check_buffer('', 0)
+  endif
+
+  let l:keyword_list = []
+
+  " Check caching.
+  for l:include in s:include_info[bufnr('%')].include_files
+    call neocomplcache#cache#check_cache(
+          \ 'include_cache', l:include, s:async_include_cache,
+          \ s:include_cache, s:completion_length)
+    if has_key(s:include_cache, l:include)
+      let l:keyword_list += neocomplcache#dictionary_filter(
+            \ s:include_cache[l:include], a:cur_keyword_str, s:completion_length)
+    endif
+  endfor
+
+  return neocomplcache#keyword_filter(neocomplcache#dup_filter(l:keyword_list), a:cur_keyword_str)
+endfunction"}}}
+
+function! neocomplcache#sources#include_complete#define()"{{{
+  return s:source
+endfunction"}}}
+
+function! neocomplcache#sources#include_complete#get_include_files(bufnumber)"{{{
+  if has_key(s:include_info, a:bufnumber)
+    return s:include_info[a:bufnumber].include_files
+  else
+    return []
+  endif
+endfunction"}}}
+
+" For echodoc."{{{
+let s:doc_dict = {
+      \ 'name' : 'include_complete',
+      \ 'rank' : 5,
+      \ 'filetypes' : {},
+      \ }
+function! s:doc_dict.search(cur_text)"{{{
+  if &filetype ==# 'vim' || !has_key(s:include_info, bufnr('%'))
+    return []
+  endif
+
+  " Collect words.
+  let l:words = []