Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

vim bundle update

  • Loading branch information...
commit 82d49ff48c4e636688879d7ccb8b9cbb05d72e59 1 parent 91fedf7
Gabriel Adomnicai authored
Showing with 3,136 additions and 3,965 deletions.
  1. +13 −13 .gitconfig.view
  2. +1 −1  .vim/bundle/neocomplcache/README.md
  3. +870 −520 .vim/bundle/neocomplcache/autoload/neocomplcache.vim
  4. +12 −4 .vim/bundle/neocomplcache/autoload/neocomplcache/async_cache.vim
  5. +21 −18 .vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
  6. +61 −96 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
  7. +20 −24 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim
  8. +33 −18 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim
  9. +69 −55 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
  10. +25 −13 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
  11. +187 −125 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
  12. +16 −20 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/syntax_complete.vim
  13. +11 −16 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/tags_complete.vim
  14. +5 −3 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete.vim
  15. +1 −0  .vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/autocmds.dict
  16. +22 −11 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/command_args.dict
  17. +19 −15 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/features.dict
  18. +49 −24 .vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/helper.vim
  19. +37 −11 .vim/bundle/neocomplcache/autoload/neocomplcache/util.vim
  20. +153 −0 .vim/bundle/neocomplcache/autoload/vital/_9813ec6.vim
  21. +222 −0 .vim/bundle/neocomplcache/autoload/vital/_9813ec6/data/list.vim
  22. +356 −0 .vim/bundle/neocomplcache/autoload/vital/_9813ec6/prelude.vim
  23. +88 −0 .vim/bundle/neocomplcache/autoload/vital/_9813ec6/system/cache.vim
  24. +3 −1 .vim/bundle/neocomplcache/autoload/vital/neocomplcache.vital
  25. +679 −2,961 .vim/bundle/neocomplcache/doc/neocomplcache.txt
  26. +18 −5 .vim/bundle/neocomplcache/plugin/neocomplcache.vim
  27. +37 −0 .vim/bundle/neocomplcache/plugin/neocomplcache/buffer_complete.vim
  28. +25 −0 .vim/bundle/neocomplcache/plugin/neocomplcache/dictionary_complete.vim
  29. +24 −0 .vim/bundle/neocomplcache/plugin/neocomplcache/include_complete.vim
  30. +25 −0 .vim/bundle/neocomplcache/plugin/neocomplcache/syntax_complete.vim
  31. +25 −0 .vim/bundle/neocomplcache/plugin/neocomplcache/tags_complete.vim
  32. +0 −2  .vim/bundle/snipmate.vim/snippets/javascript.snippets
  33. +9 −9 .vimrc.view
26 .gitconfig.view
View
@@ -18,7 +18,7 @@ setlocal commentstring=;\ %s
setlocal complete=.,w,b,u,t,i
setlocal concealcursor=
setlocal conceallevel=0
-setlocal completefunc=neocomplcache#auto_complete
+setlocal completefunc=neocomplcache#manual_complete
setlocal nocopyindent
setlocal cryptmethod=
setlocal nocursorbind
@@ -47,8 +47,8 @@ setlocal formatexpr=
setlocal formatoptions=croql
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
setlocal grepprg=
-setlocal iminsert=2
-setlocal imsearch=2
+setlocal iminsert=0
+setlocal imsearch=0
setlocal include=
setlocal includeexpr=
setlocal indentexpr=GetGitconfigIndent()
@@ -58,7 +58,7 @@ setlocal iskeyword=@,48-57,192-255,-
setlocal keywordprg=
setlocal linebreak
setlocal nolisp
-setlocal list
+setlocal nolist
setlocal macmeta
setlocal makeprg=
setlocal matchpairs=(:),{:},[:]
@@ -67,7 +67,7 @@ setlocal modifiable
setlocal nrformats=octal,hex
setlocal number
setlocal numberwidth=4
-setlocal omnifunc=javascriptcomplete#CompleteJS
+setlocal omnifunc=zencoding#CompleteTag
setlocal path=
setlocal nopreserveindent
setlocal nopreviewwindow
@@ -77,10 +77,10 @@ setlocal norelativenumber
setlocal norightleft
setlocal rightleftcmd=search
setlocal noscrollbind
-setlocal shiftwidth=4
+setlocal shiftwidth=2
setlocal noshortname
-setlocal smartindent
-setlocal softtabstop=4
+setlocal nosmartindent
+setlocal softtabstop=2
setlocal nospell
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
setlocal spellfile=
@@ -92,7 +92,7 @@ setlocal synmaxcol=3000
if &syntax != 'gitconfig'
setlocal syntax=gitconfig
endif
-setlocal tabstop=4
+setlocal tabstop=2
setlocal tags=
setlocal textwidth=0
setlocal thesaurus=
@@ -102,13 +102,13 @@ setlocal nowinfixwidth
setlocal nowrap
setlocal wrapmargin=0
silent! normal! zE
-let s:l = 17 - ((16 * winheight(0) + 25) / 51)
+let s:l = 1 - ((0 * winheight(0) + 30) / 60)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
-17
-normal! 020l
-lcd /gree/MLB
+1
+normal! 0
+lcd /apps/blogmon/lib
let &so = s:so_save | let &siso = s:siso_save
doautoall SessionLoadPost
" vim: set ft=vim :
2  .vim/bundle/neocomplcache/README.md
View
@@ -16,7 +16,7 @@ Installation
(usually ~/.vim/ or Program Files/Vim/vimfiles on Windows).
* Execute `|:NeoComplCacheEnable|` command or
`let g:neocomplcache_enable_at_startup = 1`
-in your .vimrc.
+in your `.vimrc`. Not in `.gvimrc`(`_gvimrc`)!
Caution
-------
1,390 .vim/bundle/neocomplcache/autoload/neocomplcache.vim
View
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: neocomplcache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 26 Jul 2012.
+" Last Modified: 07 Oct 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -22,7 +22,6 @@
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
-" Version: 7.1, for Vim 7.2
"=============================================================================
let s:save_cpo = &cpo
@@ -30,9 +29,34 @@ set cpo&vim
scriptencoding utf-8
+function! s:initialize_variables()"{{{
+ let s:is_enabled = 1
+ let s:complfunc_sources = {}
+ let s:plugin_sources = {}
+ let s:ftplugin_sources = {}
+ let s:loaded_ftplugin_sources = {}
+ let s:sources_lock = {}
+ let s:cur_keyword_str = ''
+ let s:complete_words = []
+ let s:complete_results = {}
+ let s:cur_text = ''
+ let s:old_cur_text = ''
+ let s:moved_cur_text = ''
+ let s:changedtick = b:changedtick
+ let s:is_text_mode = 0
+ let s:within_comment = 0
+ let s:skip_next_complete = 0
+ let s:is_prefetch = 0
+ let s:use_sources = {}
+ let s:update_time_save = &updatetime
+ let s:filetype_frequencies = {}
+ let s:cur_keyword_pos = -1
+ let s:loaded_all_sources = 0
+endfunction"}}}
+
if !exists('s:is_enabled')
+ call s:initialize_variables()
let s:is_enabled = 0
- let s:context_filetype = ''
endif
function! neocomplcache#enable() "{{{
@@ -67,441 +91,531 @@ function! neocomplcache#enable() "{{{
endif
"}}}
- " Initialize"{{{
- let s:is_enabled = 1
- let s:complfunc_sources = {}
- let s:plugin_sources = {}
- let s:ftplugin_sources = {}
- let s:loaded_ftplugin_sources = {}
- let s:complete_lock = {}
- let s:sources_lock = {}
- let s:auto_completion_length = {}
- let s:cur_keyword_str = ''
- let s:complete_words = []
- let s:complete_results = {}
- let s:cur_text = ''
- let s:old_cur_text = ''
- let s:moved_cur_text = ''
- let s:changedtick = b:changedtick
- let s:context_filetype = ''
- let s:is_text_mode = 0
- let s:within_comment = 0
- let s:skip_next_complete = 0
- let s:is_prefetch = 0
- let s:use_sources = {}
- let s:update_time_save = &updatetime
- let s:filetype_frequencies = {}
- let s:cur_keyword_pos = -1
- "}}}
-
- " Initialize sources table."{{{
- " Search autoload.
- for file in split(globpath(&runtimepath, 'autoload/neocomplcache/sources/*.vim'), '\n')
- let source_name = fnamemodify(file, ':t:r')
- if !has_key(s:plugin_sources, source_name)
- \ && neocomplcache#is_source_enabled(source_name)
- let source = call('neocomplcache#sources#' . source_name . '#define', [])
- if empty(source)
- " Ignore.
- elseif source.kind ==# 'complfunc'
- let s:complfunc_sources[source_name] = source
- elseif source.kind ==# 'ftplugin'
- let s:ftplugin_sources[source_name] = source
-
- " Clear loaded flag.
- let s:ftplugin_sources[source_name].loaded = 0
- elseif source.kind ==# 'plugin'
- \ && neocomplcache#is_source_enabled('keyword_complete')
- let s:plugin_sources[source_name] = source
- endif
- endif
- endfor
- "}}}
+ call s:initialize_variables()
" Initialize keyword patterns."{{{
- if !exists('g:neocomplcache_keyword_patterns')
- let g:neocomplcache_keyword_patterns = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
- \'default',
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_keyword_patterns', {})
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
+ \'_',
\'\k\+')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'lisp,scheme,clojure,int-gosh,int-clisp,int-clj',
\'[[:alpha:]+*/@$_=.!?-][[:alnum:]+*/@$_:=.!?-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'ruby,int-irb',
\'^=\%(b\%[egin]\|e\%[nd]\)\|\%(@@\|[:$@]\)\h\w*\|\h\w*\%(::\w*\)*[!?]\?')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'php,int-php',
- \'</\?\%(\h[[:alnum:]_-]*\s*\)\?\%(/\?>\)\?\|\$\h\w*\|\h\w*\%(\%(\\\|::\)\w*\)*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ \'</\?\%(\h[[:alnum:]_-]*\s*\)\?\%(/\?>\)\?'.
+ \'\|\$\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#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'perl6,int-perl6',
- \'<\h\w*>\?\|[$@%&][!.*?]\?\h[[:alnum:]_-]*\|\h[[:alnum:]_-]*\%(::[[:alnum:]_-]*\)*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ \'<\h\w*>\?\|[$@%&][!.*?]\?\h[[:alnum:]_-]*'.
+ \'\|\h[[:alnum:]_-]*\%(::[[:alnum:]_-]*\)*')
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'pir',
\'[$@%.=]\?\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'pasm',
\'[=]\?\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'vim,help',
- \'-\h[[:alnum:]-]*=\?\|\c\[:\%(\h\w*:\]\)\?\|&\h[[:alnum:]_:]*\|'
- \'<SID>\%(\h\w*\)\?\|<Plug>([^)]*)\?\|<\h[[:alnum:]_-]*>\?\|\h[[:alnum:]_:#]*!\?\|$\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ \'-\h[[:alnum:]-]*=\?\|\c\[:\%(\h\w*:\]\)\?\|&\h[[:alnum:]_:]*\|'.
+ \'<SID>\%(\h\w*\)\?\|<Plug>([^)]*)\?'.
+ \'\|<\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#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ \'\\\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',
- \'\$\w\+\|[[:alpha:]_.-][[:alnum:]_.-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ \'[[:alpha:]_.-][[:alnum:]_.-]*')
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'vimshell',
\'\$\$\?\w*\|[[:alpha:]_.\\/~-][[:alnum:]_.\\/~-]*\|\d\+\%(\.\d\+\)\+')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'ps1,int-powershell',
\'\[\h\%([[:alnum:]_.]*\]::\)\?\|[$%@.]\?[[:alpha:]_.:-][[:alnum:]_.:-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'c',
\'^\s*#\s*\h\w*\|\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'cpp',
\'^\s*#\s*\h\w*\|\h\w*\%(::\w*\)*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'objc',
\'^\s*#\s*\h\w*\|\h\w*\|@\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'objcpp',
\'^\s*#\s*\h\w*\|\h\w*\%(::\w*\)*\|@\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'objj',
\'\h\w*\|@\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'d',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'python,int-python,int-ipython',
\'[@]\?\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'cs',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'java',
\'[@]\?\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'javascript,actionscript,int-js,int-kjs,int-rhino',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'coffee,int-coffee',
\'[@]\?\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'awk',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'haskell,int-ghci',
\'\%(\u\w*\.\)\+[[:alnum:]_'']*\|[[:alpha:]_''][[:alnum:]_'']*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'ml,ocaml,int-ocaml,int-sml,int-smlsharp',
\'[''`#.]\?\h[[:alnum:]_'']*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'erlang,int-erl',
\'^\s*-\h\w*\|\%(\h\w*:\)*\h\w\|\h[[:alnum:]_@]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'html,xhtml,xml,markdown,eruby',
- \'</\?\%([[:alnum:]_:-]\+\s*\)\?\%(/\?>\)\?\|&\h\%(\w*;\)\?\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
- \'css,stylus',
+ \'</\?\%([[:alnum:]_:-]\+\s*\)\?\%(/\?>\)\?\|&\h\%(\w*;\)\?'.
+ \'\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*')
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
+ \'css,stylus,scss',
\'[@#.]\?[[:alpha:]_:-][[:alnum:]_:-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'tags',
\'^[^!][^/[:blank:]]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'pic',
\'^\s*#\h\w*\|\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'arm',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'asmh8300',
\'[[:alpha:]_.][[:alnum:]_.]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'masm',
\'\.\h\w*\|[[:alpha:]_@?$][[:alnum:]_@?$]*\|\h\w*:\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'nasm',
\'^\s*\[\h\w*\|[%.]\?\h\w*\|\%(\.\.@\?\|%[%$!]\)\%(\h\w*\)\?\|\h\w*:\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'asm',
\'[%$.]\?\h\w*\%(\$\h\w*\)\?')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'gas',
\'[$.]\?\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'gdb,int-gdb',
\'$\h\w*\|[[:alnum:]:._-]\+')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'make',
\'[[:alpha:]_.-][[:alnum:]_.-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'scala,int-scala',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'int-termtter',
\'\h[[:alnum:]_/-]*\|\$\a\+\|#\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'int-earthquake',
\'[:#$]\h\w*\|\h[[:alnum:]_/-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'dosbatch,int-cmdproxy',
\'\$\w+\|[[:alpha:]_./-][[:alnum:]_.-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'vb',
\'\h\w*\|#\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'lua',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\ 'zimbu',
\'\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'konoha',
\'[*$@%]\h\w*\|\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'cobol',
\'\a[[:alnum:]-]*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'coq',
\'\h[[:alnum:]_'']*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'tcl',
\'[.-]\h\w*\|\h\w*')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_keyword_patterns',
\'nyaos,int-nyaos',
\'\h\w*')
"}}}
" Initialize next keyword patterns."{{{
- if !exists('g:neocomplcache_next_keyword_patterns')
- let g:neocomplcache_next_keyword_patterns = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'perl',
+ 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#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'perl6',
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_next_keyword_patterns', 'perl6',
\'\h\w*>')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'vim,help',
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_next_keyword_patterns', 'vim,help',
\'\w*()\?\|\w*:\]\|[[:alnum:]_-]*[)>=]')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'python',
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_next_keyword_patterns', 'python',
\'\w*()\?')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'tex',
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_next_keyword_patterns', 'tex',
\'[[:alnum:]:_]\+[*[{}]')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_next_keyword_patterns, 'html,xhtml,xml,mkd',
+ call neocomplcache#util#set_default_dictionary(
+ \'g:neocomplcache_next_keyword_patterns', 'html,xhtml,xml,mkd',
\'[[:alnum:]_:-]*>\|[^"]*"')
"}}}
" Initialize same file type lists."{{{
- if !exists('g:neocomplcache_same_filetype_lists')
- let g:neocomplcache_same_filetype_lists = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ 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#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'cpp', 'c')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'erb', 'ruby,html,xhtml')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'html,xml', 'xhtml')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'html,xhtml', 'css,stylus')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ 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#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'xhtml', 'html,xml')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'help', 'vim')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'tex', 'bib,plaintex')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'plaintex', 'bib,tex')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'lingr-say', 'lingr-messages,lingr-members')
" Interactive filetypes.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-irb', 'ruby')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-ghci,int-hugs', 'haskell')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-python,int-ipython', 'python')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-gosh', 'scheme')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-clisp', 'lisp')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-erl', 'erlang')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-zsh', 'zsh')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-bash', 'bash')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-sh', 'sh')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-cmdproxy', 'dosbatch')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-powershell', 'powershell')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-perlsh', 'perl')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-perl6', 'perl6')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-ocaml', 'ocaml')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-clj', 'clojure')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-sml,int-smlsharp', 'sml')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-js,int-kjs,int-rhino', 'javascript')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-coffee', 'coffee')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-gdb', 'gdb')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-scala', 'scala')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-nyaos', 'nyaos')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_same_filetype_lists',
\ 'int-php', 'php')
"}}}
" Initialize context filetype lists."{{{
- if exists('g:neocomplcache_filetype_include_lists')
- let g:neocomplcache_context_filetype_lists =
- \ g:neocomplcache_filetype_include_lists
- endif
- if !exists('g:neocomplcache_context_filetype_lists')
- let g:neocomplcache_context_filetype_lists = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_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' : ');'},
+ \ {'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#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'd', [
- \ {'filetype' : 'masm', 'start' : 'asm\s*\%(\n\s*\)\?{', 'end' : '}'},
+ \ {'filetype' : 'masm',
+ \ 'start' : 'asm\s*\%(\n\s*\)\?{', 'end' : '}'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'perl6', [
\ {'filetype' : 'pir', 'start' : 'Q:PIR\s*{', 'end' : '}'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'vimshell', [
- \ {'filetype' : 'vim', 'start' : 'vexe \([''"]\)', 'end' : '\\\@<!\1'},
+ \ {'filetype' : 'vim',
+ \ 'start' : 'vexe \([''"]\)', 'end' : '\\\@<!\1'},
\ {'filetype' : 'vim', 'start' : ' :\w*', 'end' : '\n'},
\ {'filetype' : 'vim', 'start' : ' vexe\s\+', 'end' : '\n'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'eruby', [
\ {'filetype' : 'ruby', 'start' : '<%[=#]\?', 'end' : '%>'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'vim', [
- \ {'filetype' : 'python', 'start' : '^\s*python3\? <<\s*\(\h\w*\)', 'end' : '^\1'},
- \ {'filetype' : 'ruby', 'start' : '^\s*ruby <<\s*\(\h\w*\)', 'end' : '^\1'},
+ \ {'filetype' : 'python',
+ \ 'start' : '^\s*python3\? <<\s*\(\h\w*\)', 'end' : '^\1'},
+ \ {'filetype' : 'ruby',
+ \ 'start' : '^\s*ruby <<\s*\(\h\w*\)', 'end' : '^\1'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'html,xhtml', [
- \ {'filetype' : 'javascript', 'start' : '<script type="text/javascript">', 'end' : '</script>'},
- \ {'filetype' : 'css', 'start' : '<style type="text/css">', 'end' : '</style>'},
+ \ {'filetype' : 'javascript', 'start' :
+ \'<script\%( [^>]*\)\? type="text/javascript"\%( [^>]*\)\?>',
+ \ 'end' : '</script>'},
+ \ {'filetype' : 'coffee', 'start' :
+ \'<script\%( [^>]*\)\? type="text/coffeescript"\%( [^>]*\)\?>',
+ \ 'end' : '</script>'},
+ \ {'filetype' : 'css', 'start' :
+ \'<script\%( [^>]*\)\? type="text/css"\%( [^>]*\)\?>',
+ \ 'end' : '</style>'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'python', [
- \ {'filetype' : 'vim', 'start' : 'vim.command\s*(\([''"]\)', 'end' : '\\\@<!\1\s*)'},
- \ {'filetype' : 'vim', 'start' : 'vim.eval\s*(\([''"]\)', 'end' : '\\\@<!\1\s*)'},
+ \ {'filetype' : 'vim',
+ \ 'start' : 'vim.command\s*(\([''"]\)', 'end' : '\\\@<!\1\s*)'},
+ \ {'filetype' : 'vim',
+ \ 'start' : 'vim.eval\s*(\([''"]\)', 'end' : '\\\@<!\1\s*)'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'help', [
\ {'filetype' : 'vim', 'start' : '^>', 'end' : '^<'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_context_filetype_lists',
\ 'nyaos,int-nyaos', [
- \ {'filetype' : 'lua', 'start' : '\<lua_e\s\+\(["'']\)', 'end' : '^\1'},
+ \ {'filetype' : 'lua',
+ \ 'start' : '\<lua_e\s\+\(["'']\)', 'end' : '^\1'},
\])
"}}}
" Initialize delimiter patterns."{{{
- if !exists('g:neocomplcache_delimiter_patterns')
- let g:neocomplcache_delimiter_patterns = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_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#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'erlang,lisp,int-clisp', [':'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'lisp,int-clisp', ['/', ':'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'clojure,int-clj', ['/', '\.'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'perl,cpp', ['::'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'php', ['\', '::'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
- \ 'java,d,javascript,actionscript,ruby,eruby,haskell,int-ghci,coffee,zimbu,konoha',
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
+ \ 'java,d,javascript,actionscript,'.
+ \ 'ruby,eruby,haskell,int-ghci,coffee,zimbu,konoha',
\ ['\.'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'lua', ['\.', ':'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_delimiter_patterns,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_delimiter_patterns',
\ 'perl6', ['\.', '::'])
"}}}
" Initialize ctags arguments."{{{
- if !exists('g:neocomplcache_ctags_arguments_list')
- let g:neocomplcache_ctags_arguments_list = {}
- endif
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_ctags_arguments_list, 'default', '')
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_ctags_arguments_list, 'vim',
- \"--extra=fq --fields=afmiKlnsStz --regex-vim='/function!? ([a-z#:_0-9A-Z]+)/\\1/function/'")
+ 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#set_dictionary_helper(
- \ g:neocomplcache_ctags_arguments_list, 'c',
- \'--c-kinds=+p --fields=+iaS --extra=+q -I__DARWIN_ALIAS,__DARWIN_ALIAS_C,__DARWIN_ALIAS_I,__DARWIN_INODE64
+ 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#set_dictionary_helper(
- \ g:neocomplcache_ctags_arguments_list, 'c',
- \'-R --sort=1 --c-kinds=+p --fields=+iaS --extra=+q -I __wur')
- endif
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_ctags_arguments_list, 'cpp',
- \'-R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q -I __wur --language-force=C++')
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_ctags_arguments_list', 'c',
+ \ '-R --sort=1 --c-kinds=+p --fields=+iaS --extra=+q -I __wur')
+ endif
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_ctags_arguments_list', 'cpp',
+ \ '-R --sort=1 --c++-kinds=+p --fields=+iaS
+ \ --extra=+q -I __wur --language-force=C++')
"}}}
" Initialize text mode filetypes."{{{
- if !exists('g:neocomplcache_text_mode_filetypes')
- let g:neocomplcache_text_mode_filetypes = {}
- endif
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_text_mode_filetypes,
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_text_mode_filetypes', {})
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_text_mode_filetypes',
\ 'text,help,tex,gitcommit,vcs-commit', 1)
"}}}
" Initialize tags filter patterns."{{{
- if !exists('g:neocomplcache_tags_filter_patterns')
- let g:neocomplcache_tags_filter_patterns = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_tags_filter_patterns, 'c,cpp',
+ 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
- if !exists('g:neocomplcache_ignore_composite_filetype_lists')
- let g:neocomplcache_ignore_composite_filetype_lists = {}
- endif
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_ignore_composite_filetype_lists', {})
" Add commands."{{{
command! -nargs=? Neco call s:display_neco(<q-args>)
@@ -526,28 +640,16 @@ function! neocomplcache#enable() "{{{
let &completefunc = 'neocomplcache#manual_complete'
let &l:completefunc = 'neocomplcache#manual_complete'
- " Set options.
- set completeopt-=menu
- set completeopt+=menuone
-
" For auto complete keymappings.
inoremap <expr><silent> <Plug>(neocomplcache_start_unite_complete)
\ unite#sources#neocomplcache#start_complete()
inoremap <expr><silent> <Plug>(neocomplcache_start_unite_quick_match)
\ unite#sources#neocomplcache#start_quick_match()
- inoremap <expr><silent> <Plug>(neocomplcache_start_unite_snippet)
- \ unite#sources#snippet#start_complete()
inoremap <silent> <Plug>(neocomplcache_start_auto_complete)
\ <C-x><C-u><C-r>=neocomplcache#popup_post()<CR>
inoremap <silent> <Plug>(neocomplcache_start_omni_complete)
- \ <C-x><C-o><C-r>=neocomplcache#popup_post()<CR>
-
- " Initialize.
- for source in values(neocomplcache#available_complfuncs())
- if has_key(source, 'initialize')
- call source.initialize()
- endif
- endfor
+ \ <C-x><C-o><C-p>
+ " \ <C-x><C-o><C-r>=neocomplcache#popup_post()<CR>
endfunction"}}}
function! neocomplcache#disable()"{{{
@@ -570,27 +672,34 @@ function! neocomplcache#disable()"{{{
delcommand Neco
delcommand NeoComplCacheAutoCompletionLength
- for source in values(neocomplcache#available_complfuncs())
- if has_key(source, 'finalize')
- call source.finalize()
- endif
- endfor
- for source in values(neocomplcache#available_ftplugins())
- if source.loaded
- if has_key(source, 'finalize')
- call source.finalize()
- endif
+ for source in values(neocomplcache#available_sources())
+ if !has_key(source, 'finalize') || !source.loaded
+ continue
endif
+
+ try
+ call source.finalize()
+ catch
+ call neocomplcache#print_error(v:throwpoint)
+ call neocomplcache#print_error(v:exception)
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s finalize()!')
+ call neocomplcache#print_error(
+ \ 'Source name is ' . source.name)
+ endtry
endfor
endfunction"}}}
function! neocomplcache#manual_complete(findstart, base)"{{{
if a:findstart
+ let cur_text = s:get_cur_text()
if !neocomplcache#is_enabled()
+ \ || neocomplcache#is_omni_complete(cur_text)
let s:cur_keyword_str = ''
let s:complete_words = []
let s:is_prefetch = 0
let &l:completefunc = 'neocomplcache#manual_complete'
+
return (g:neocomplcache_enable_prefetch
\ || g:neocomplcache_enable_insert_char_pre) ?
\ -1 : -3
@@ -601,7 +710,7 @@ function! neocomplcache#manual_complete(findstart, base)"{{{
" Use prefetch results.
else
let s:complete_results =
- \ neocomplcache#get_complete_results(s:get_cur_text())
+ \ neocomplcache#get_complete_results(cur_text)
endif
let cur_keyword_pos =
\ neocomplcache#get_cur_keyword_pos(s:complete_results)
@@ -617,24 +726,26 @@ function! neocomplcache#manual_complete(findstart, base)"{{{
endif
return cur_keyword_pos
- endif
-
- let cur_keyword_pos = neocomplcache#get_cur_keyword_pos(s:complete_results)
- let s:complete_words = neocomplcache#get_complete_words(
+ else
+ let cur_keyword_pos = neocomplcache#get_cur_keyword_pos(s:complete_results)
+ let s:complete_words = neocomplcache#get_complete_words(
\ s:complete_results, cur_keyword_pos, a:base)
- let s:cur_keyword_str = a:base
- let s:is_prefetch = 0
+ let s:cur_keyword_str = a:base
+ let s:is_prefetch = 0
- if v:version > 703 || v:version == 703 && has('patch418')
- let dict = { 'words' : s:complete_words }
+ if v:version > 703 || v:version == 703 && has('patch418')
+ let dict = { 'words' : s:complete_words }
- if g:neocomplcache_enable_cursor_hold_i
- " Note: Vim Still have broken register-. problem.
- let dict.refresh = 'always'
+ if len(s:complete_words) >= g:neocomplcache_max_list
+ \ && (g:neocomplcache_enable_cursor_hold_i
+ \ || v:version > 703 || v:version == 703 && has('patch561'))
+ " Note: If Vim is less than 7.3.561, it have broken register "." problem.
+ let dict.refresh = 'always'
+ endif
+ return dict
+ else
+ return s:complete_words
endif
- return dict
- else
- return s:complete_words
endif
endfunction"}}}
@@ -649,7 +760,8 @@ function! neocomplcache#sources_manual_complete(findstart, base)"{{{
" Get cur_keyword_pos.
let complete_results = neocomplcache#get_complete_results(
\ s:get_cur_text(), s:use_sources)
- let s:cur_keyword_pos = neocomplcache#get_cur_keyword_pos(complete_results)
+ let s:cur_keyword_pos =
+ \ neocomplcache#get_cur_keyword_pos(complete_results)
if s:cur_keyword_pos < 0
let s:cur_keyword_str = ''
@@ -738,11 +850,7 @@ function! s:do_auto_complete(event)"{{{
" Prevent infinity loop.
if cur_text == ''
\ || cur_text == s:old_cur_text
- \ || (neocomplcache#is_eskk_enabled() &&
- \ !neocomplcache#is_eskk_convertion(cur_text))
- \ || (!neocomplcache#is_eskk_enabled() &&
- \ neocomplcache#is_multibyte_input(cur_text))
- \ || g:neocomplcache_lock_iminsert && &l:iminsert
+ \ || (g:neocomplcache_lock_iminsert && &l:iminsert)
let s:cur_keyword_str = ''
let s:complete_words = []
return
@@ -751,7 +859,22 @@ function! s:do_auto_complete(event)"{{{
let s:old_cur_text = cur_text
if s:skip_next_complete
let s:skip_next_complete = 0
- return
+
+ " Check delimiter pattern.
+ let is_delimiter = 0
+ let filetype = neocomplcache#get_context_filetype()
+
+ for delimiter in ['/', '\.'] +
+ \ get(g:neocomplcache_delimiter_patterns, filetype, [])
+ if cur_text =~ delimiter . '$'
+ let is_delimiter = 1
+ break
+ endif
+ endfor
+
+ if !is_delimiter
+ return
+ endif
endif
if neocomplcache#is_omni_complete(cur_text)
@@ -759,6 +882,12 @@ function! s:do_auto_complete(event)"{{{
return
endif
+ " Check multibyte input or eskk.
+ if neocomplcache#is_eskk_enabled()
+ \ || neocomplcache#is_multibyte_input(cur_text)
+ return
+ endif
+
" Check complete position.
let complete_results = s:set_complete_results_pos(cur_text)
if empty(complete_results)
@@ -770,7 +899,7 @@ function! s:do_auto_complete(event)"{{{
if neocomplcache#is_prefetch()
" Do prefetch.
let s:complete_results =
- \ neocomplcache#get_complete_results(s:get_cur_text())
+ \ neocomplcache#get_complete_results(cur_text)
if empty(s:complete_results)
" Skip completion.
@@ -790,18 +919,18 @@ function! s:do_auto_complete(event)"{{{
set completeopt+=menuone
" Start auto complete.
- if neocomplcache#is_prefetch()
- call feedkeys((g:neocomplcache_enable_auto_select ?
- \ "\<C-x>\<C-u>\<C-p>\<Down>" :
- \ "\<C-x>\<C-u>\<C-p>"), 'n')
- else
- call feedkeys("\<Plug>(neocomplcache_start_auto_complete)")
- endif
+ call feedkeys("\<Plug>(neocomplcache_start_auto_complete)")
let s:changedtick = b:changedtick
endfunction"}}}
" Source helper."{{{
+function! neocomplcache#available_sources()"{{{
+ return extend(extend(copy(
+ \ neocomplcache#available_complfuncs()),
+ \ neocomplcache#available_loaded_ftplugins()),
+ \ neocomplcache#available_loaded_plugins())
+endfunction"}}}
function! neocomplcache#available_complfuncs()"{{{
return s:complfunc_sources
endfunction"}}}
@@ -819,31 +948,34 @@ function! neocomplcache#available_sources()"{{{
return extend(extend(copy(s:complfunc_sources), s:plugin_sources),
\ s:loaded_ftplugin_sources)
endfunction"}}}
-function! neocomplcache#keyword_escape(cur_keyword_str)"{{{
- " Escape."{{{
+function! s:keyword_escape(cur_keyword_str)
let keyword_escape = escape(a:cur_keyword_str, '~" \.^$[]')
if g:neocomplcache_enable_wildcard
- let keyword_escape = substitute(substitute(keyword_escape, '.\zs\*', '.*', 'g'), '\%(^\|\*\)\zs\*', '\\*', 'g')
- if '-' !~ '\k'
- let keyword_escape = substitute(keyword_escape, '.\zs-', '.\\+', 'g')
- endif
+ let keyword_escape = substitute(
+ \ substitute(keyword_escape, '.\zs\*', '.*', 'g'),
+ \ '\%(^\|\*\)\zs\*', '\\*', 'g')
else
let keyword_escape = escape(keyword_escape, '*')
- endif"}}}
+ endif
+ return keyword_escape
+endfunction
+function! neocomplcache#keyword_escape(cur_keyword_str)"{{{
" Fuzzy completion.
- let keyword_len = len(keyword_escape)
+ let keyword_len = len(a:cur_keyword_str)
if g:neocomplcache_enable_fuzzy_completion
\ && (g:neocomplcache_fuzzy_completion_start_length
\ <= keyword_len && keyword_len < 20)
- let fuzzy_start = g:neocomplcache_fuzzy_completion_start_length
- if fuzzy_start <= 1
+ let keyword_escape = s:keyword_escape(a:cur_keyword_str)
+
+ let start = g:neocomplcache_fuzzy_completion_start_length
+ if start <= 1
let keyword_escape =
\ substitute(keyword_escape, '\w',
\ '\\%(\0\\|\U\0\E\\l*\\|\0\\w*\\W\\)', 'g')
elseif keyword_len < 8
- let keyword_escape = keyword_escape[: fuzzy_start - 2]
- \ . substitute(keyword_escape[fuzzy_start-1 :], '\w',
+ let keyword_escape = keyword_escape[: start - 2]
+ \ . substitute(keyword_escape[start-1 :], '\w',
\ '\\%(\0\\|\U\0\E\\l*\\|\0\\w*\\W\\)', 'g')
else
let keyword_escape = keyword_escape[: 3] .
@@ -851,29 +983,38 @@ function! neocomplcache#keyword_escape(cur_keyword_str)"{{{
\ '\\%(\0\\|\U\0\E\\l*\\|\0\\w*\\W\\)', 'g') . keyword_escape[13:]
endif
else
+ let head = neocomplcache#is_auto_complete() ?
+ \ s:keyword_escape(a:cur_keyword_str[: 1]) : ''
+ let keyword_escape = s:keyword_escape(
+ \ (neocomplcache#is_auto_complete() ?
+ \ a:cur_keyword_str[2: ] :a:cur_keyword_str))
+
" Underbar completion."{{{
if g:neocomplcache_enable_underbar_completion
- \ && keyword_escape =~ '_'
- let keyword_escape_orig = keyword_escape
+ \ && keyword_escape =~ '[^_]_'
let keyword_escape = substitute(keyword_escape,
\ '[^_]\zs_', '[^_]*_', 'g')
endif
if g:neocomplcache_enable_underbar_completion
- \ && '-' =~ '\k' && keyword_escape =~ '-'
+ \ && '-' =~ '\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'
- let keyword_escape = substitute(keyword_escape, '\u\?\zs\U*',
+ \ && keyword_escape =~ '\u\?\U*'
+ let keyword_escape =
+ \ substitute(keyword_escape,
+ \ '\u\?\zs\U*',
\ '\\%(\0\\l*\\|\U\0\E\\u*_\\?\\)', 'g')
endif
"}}}
+
+ let keyword_escape = head . keyword_escape
endif
- " echomsg keyword_escape
+ call neocomplcache#print_debug(keyword_escape)
return keyword_escape
endfunction"}}}
function! neocomplcache#keyword_filter(list, cur_keyword_str)"{{{
@@ -885,12 +1026,10 @@ function! neocomplcache#keyword_filter(list, cur_keyword_str)"{{{
" Delimiter check.
let filetype = neocomplcache#get_context_filetype()
- if has_key(g:neocomplcache_delimiter_patterns, filetype)"{{{
- for delimiter in g:neocomplcache_delimiter_patterns[filetype]
- let cur_keyword_str = substitute(cur_keyword_str,
- \ delimiter, '*' . delimiter, 'g')
- endfor
- endif"}}}
+ for delimiter in get(g:neocomplcache_delimiter_patterns, filetype, [])
+ let cur_keyword_str = substitute(cur_keyword_str,
+ \ delimiter, '*' . delimiter, 'g')
+ endfor
if cur_keyword_str == ''
return a:list
@@ -987,19 +1126,20 @@ function! neocomplcache#fuzzy_filter(list, cur_keyword_str)"{{{
return ret
endfunction"}}}
-function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str, completion_length)"{{{
+function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str)"{{{
if empty(a:dictionary)
return []
endif
- if len(a:cur_keyword_str) < a:completion_length ||
+ let completion_length = 2
+ if len(a:cur_keyword_str) < completion_length ||
\ neocomplcache#check_completion_length_match(
- \ a:cur_keyword_str, a:completion_length)
+ \ a:cur_keyword_str, completion_length)
return neocomplcache#keyword_filter(
\ neocomplcache#unpack_dictionary(a:dictionary), a:cur_keyword_str)
endif
- let key = tolower(a:cur_keyword_str[: a:completion_length-1])
+ let key = tolower(a:cur_keyword_str[: completion_length-1])
if !has_key(a:dictionary, key)
return []
@@ -1012,7 +1152,7 @@ function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str, completio
let list = values(a:dictionary[key])
endif
- return (len(a:cur_keyword_str) == a:completion_length && &ignorecase)?
+ return (len(a:cur_keyword_str) == completion_length && &ignorecase)?
\ list : neocomplcache#keyword_filter(copy(list), a:cur_keyword_str)
endfunction"}}}
function! neocomplcache#unpack_dictionary(dict)"{{{
@@ -1110,9 +1250,15 @@ function! neocomplcache#get_next_keyword()"{{{
return matchstr('a'.getline('.')[len(neocomplcache#get_cur_text()) :], pattern)[1:]
endfunction"}}}
function! neocomplcache#get_completion_length(plugin_name)"{{{
- if neocomplcache#is_auto_complete() && has_key(s:auto_completion_length, bufnr('%'))
- return s:auto_completion_length[bufnr('%')]
- elseif has_key(g:neocomplcache_source_completion_length, a:plugin_name)
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ if neocomplcache#is_auto_complete()
+ \ && b:neocomplcache.completion_length >= 0
+ return b:neocomplcache.completion_length
+ elseif has_key(g:neocomplcache_source_completion_length,
+ \ a:plugin_name)
return g:neocomplcache_source_completion_length[a:plugin_name]
elseif has_key(s:ftplugin_sources, a:plugin_name)
\ || has_key(s:complfunc_sources, a:plugin_name)
@@ -1178,20 +1324,30 @@ function! neocomplcache#match_word(cur_text, ...)"{{{
let pattern = a:0 >= 1 ? a:1 : neocomplcache#get_keyword_pattern_end()
" Check wildcard.
- let cur_keyword_pos = s:match_wildcard(a:cur_text, pattern, match(a:cur_text, pattern))
+ let cur_keyword_pos = s:match_wildcard(
+ \ a:cur_text, pattern, match(a:cur_text, pattern))
let cur_keyword_str = a:cur_text[cur_keyword_pos :]
return [cur_keyword_pos, cur_keyword_str]
endfunction"}}}
+function! neocomplcache#match_wild_card(cur_keyword_str)"{{{
+ let index = stridx(a:cur_keyword_str, '*')
+ return !g:neocomplcache_enable_wildcard && index > 0 ?
+ \ a:cur_keyword_str : a:cur_keyword_str[: index]
+endfunction"}}}
function! neocomplcache#is_enabled()"{{{
return s:is_enabled
endfunction"}}}
function! neocomplcache#is_locked(...)"{{{
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
let bufnr = a:0 > 0 ? a:1 : bufnr('%')
return !s:is_enabled
\ || g:neocomplcache_disable_auto_complete
- \ || get(s:complete_lock, bufnr, 0)
+ \ || b:neocomplcache.lock
\ || (g:neocomplcache_lock_buffer_name_pattern != '' &&
\ bufname(bufnr) =~ g:neocomplcache_lock_buffer_name_pattern)
\ || &l:omnifunc ==# 'fuf#onComplete'
@@ -1241,8 +1397,17 @@ function! neocomplcache#is_prefetch()"{{{
\ || &l:formatoptions =~# 'a'
endfunction"}}}
function! neocomplcache#is_omni_complete(cur_text)"{{{
- if !neocomplcache#is_source_enabled('omni_complete')
- return 0
+ " Check eskk complete length.
+ if neocomplcache#is_eskk_enabled()
+ \ && exists('g:eskk#start_completion_length')
+ if !neocomplcache#is_eskk_convertion(a:cur_text)
+ return 0
+ endif
+
+ let cur_keyword_pos = call(&l:omnifunc, [1, ''])
+ let cur_keyword_str = a:cur_text[cur_keyword_pos :]
+ return neocomplcache#util#mb_strlen(cur_keyword_str) >=
+ \ g:eskk#start_completion_length
endif
let filetype = neocomplcache#get_context_filetype()
@@ -1252,19 +1417,23 @@ function! neocomplcache#is_omni_complete(cur_text)"{{{
return 0
endif
+ let syn_name = neocomplcache#get_syn_name(1)
+ if syn_name ==# 'Comment' || syn_name ==# 'String'
+ " Skip omni_complete in string literal.
+ return 0
+ endif
+
let omnifunc = &l:omnifunc
- if has_key(g:neocomplcache_omni_patterns, omnifunc)
- let pattern = g:neocomplcache_omni_patterns[omnifunc]
- elseif filetype != '' && has_key(g:neocomplcache_omni_patterns, filetype)
- let pattern = g:neocomplcache_omni_patterns[filetype]
+ if has_key(g:neocomplcache_force_omni_patterns, omnifunc)
+ let pattern = g:neocomplcache_force_omni_patterns[omnifunc]
+ elseif filetype != '' && has_key(g:neocomplcache_force_omni_patterns, filetype)
+ let pattern = g:neocomplcache_force_omni_patterns[filetype]
else
return 0
endif
- " For rubycomplete only.
- return &l:omnifunc ==# 'rubycomplete#Complete'
- \ && a:cur_text =~ pattern
+ return a:cur_text =~# '\%(' . pattern . '\m\)$'
endfunction"}}}
function! neocomplcache#is_source_enabled(plugin_name)"{{{
return !get(g:neocomplcache_source_disable, a:plugin_name, 0)
@@ -1291,34 +1460,38 @@ function! neocomplcache#trunk_string(string, max)"{{{
return printf('%.' . a:max-10 . 's..%%s', a:string, a:string[-8:])
endfunction"}}}
function! neocomplcache#head_match(checkstr, headstr)"{{{
- return stridx(a:checkstr, a:headstr) == 0
+ let checkstr = &ignorecase ?
+ \ tolower(a:checkstr) : a:checkstr
+ let headstr = &ignorecase ?
+ \ tolower(a:headstr) : a:headstr
+ return stridx(checkstr, headstr) == 0
endfunction"}}}
function! neocomplcache#get_source_filetypes(filetype)"{{{
let filetype = (a:filetype == '') ? 'nothing' : a:filetype
let filetype_dict = {}
- let filetypes = [filetype]
+ let filetypes = [filetype, '_']
if filetype =~ '\.'
if has_key(g:neocomplcache_ignore_composite_filetype_lists, filetype)
let filetypes = [g:neocomplcache_ignore_composite_filetype_lists[filetype]]
else
- " Set compound filetype.
+ " Set composite filetype.
let filetypes += split(filetype, '\.')
endif
endif
- for ft in filter(copy(filetypes),
- \ 'has_key(g:neocomplcache_same_filetype_lists, v:val)')
- for same_ft in split(g:neocomplcache_same_filetype_lists[ft], ',')
- if index(filetypes, same_ft) < 0
+ for ft in filetypes
+ for same_ft in split(get(g:neocomplcache_same_filetype_lists, ft,
+ \ get(g:neocomplcache_same_filetype_lists, '_', '')), ',')
+ if same_ft != '' && index(filetypes, same_ft) < 0
" Add same filetype.
call add(filetypes, same_ft)
endif
endfor
endfor
- return filetypes
+ return neocomplcache#util#uniq(filetypes)
endfunction"}}}
function! neocomplcache#get_sources_list(dictionary, filetype)"{{{
let list = []
@@ -1334,11 +1507,19 @@ function! neocomplcache#escape_match(str)"{{{
return escape(a:str, '~"*\.^$[]')
endfunction"}}}
function! neocomplcache#get_context_filetype(...)"{{{
- if a:0 != 0 || s:context_filetype == ''
+ if !neocomplcache#is_enabled()
+ return &filetype
+ endif
+
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ if a:0 != 0 || b:neocomplcache.context_filetype == ''
call s:set_context_filetype()
endif
- return s:context_filetype
+ return b:neocomplcache.context_filetype
endfunction"}}}
function! neocomplcache#get_source_rank(plugin_name)"{{{
if has_key(g:neocomplcache_source_rank, a:plugin_name)
@@ -1348,7 +1529,7 @@ function! neocomplcache#get_source_rank(plugin_name)"{{{
elseif has_key(s:ftplugin_sources, a:plugin_name)
return 100
elseif has_key(s:plugin_sources, a:plugin_name)
- return neocomplcache#get_source_rank('keyword_complete')
+ return 5
else
" unknown.
return 1
@@ -1400,8 +1581,7 @@ function! neocomplcache#get_cur_keyword_pos(complete_results)"{{{
return cur_keyword_pos
endfunction"}}}
-function! neocomplcache#get_complete_words(complete_results,
- \ cur_keyword_pos, cur_keyword_str) "{{{
+function! neocomplcache#get_complete_words(complete_results, cur_keyword_pos, cur_keyword_str) "{{{
let frequencies = s:get_frequencies()
let sources = neocomplcache#available_sources()
@@ -1477,44 +1657,43 @@ function! neocomplcache#get_complete_words(complete_results,
endfor
let complete_words = words
- " Delimiter check.
+ " Delimiter check. "{{{
let filetype = neocomplcache#get_context_filetype()
- if has_key(g:neocomplcache_delimiter_patterns, filetype)"{{{
- for delimiter in g:neocomplcache_delimiter_patterns[filetype]
- " Count match.
- let delim_cnt = 0
- let matchend = matchend(a:cur_keyword_str, delimiter)
- while matchend >= 0
- let matchend = matchend(a:cur_keyword_str, delimiter, matchend)
- let delim_cnt += 1
- endwhile
+ for delimiter in ['/'] +
+ \ get(g:neocomplcache_delimiter_patterns, filetype, [])
+ " Count match.
+ let delim_cnt = 0
+ let matchend = matchend(a:cur_keyword_str, delimiter)
+ while matchend >= 0
+ let matchend = matchend(a:cur_keyword_str, delimiter, matchend)
+ let delim_cnt += 1
+ endwhile
- for keyword in complete_words
- let split_list = split(keyword.word, delimiter, 1)
- if len(split_list) > 1
- let delimiter_sub = substitute(delimiter, '\\\([.^$]\)', '\1', 'g')
- let keyword.word = join(split_list[ : delim_cnt], delimiter_sub)
- let keyword.abbr = join(
- \ split(keyword.abbr, delimiter, 1)[ : delim_cnt],
- \ delimiter_sub)
-
- if g:neocomplcache_max_keyword_width >= 0
- \ && len(keyword.abbr) > g:neocomplcache_max_keyword_width
- let keyword.abbr = substitute(keyword.abbr,
- \ '\(\h\)\w*'.delimiter, '\1'.delimiter_sub, 'g')
- endif
- if delim_cnt+1 < len(split_list)
- let keyword.abbr .= delimiter_sub . '~'
- let keyword.dup = 0
+ for keyword in complete_words
+ let split_list = split(keyword.word, delimiter.'\ze.', 1)
+ if len(split_list) > 1
+ let delimiter_sub = substitute(delimiter, '\\\([.^$]\)', '\1', 'g')
+ let keyword.word = join(split_list[ : delim_cnt], delimiter_sub)
+ let keyword.abbr = join(
+ \ split(keyword.abbr, delimiter.'\ze.', 1)[ : delim_cnt],
+ \ delimiter_sub)
+
+ if g:neocomplcache_max_keyword_width >= 0
+ \ && len(keyword.abbr) > g:neocomplcache_max_keyword_width
+ let keyword.abbr = substitute(keyword.abbr,
+ \ '\(\h\)\w*'.delimiter, '\1'.delimiter_sub, 'g')
+ endif
+ if delim_cnt+1 < len(split_list)
+ let keyword.abbr .= delimiter_sub . '~'
+ let keyword.dup = 0
- if g:neocomplcache_enable_auto_delimiter
- let keyword.word .= delimiter_sub
- endif
+ if g:neocomplcache_enable_auto_delimiter
+ let keyword.word .= delimiter_sub
endif
endif
- endfor
+ endif
endfor
- endif"}}}
+ endfor"}}}
if neocomplcache#complete_check()
return []
@@ -1522,20 +1701,26 @@ function! neocomplcache#get_complete_words(complete_results,
" Convert words.
if neocomplcache#is_text_mode() "{{{
+ let convert_candidates = filter(copy(complete_words),
+ \ "get(v:val, 'neocomplcache__convertable', 1)
+ \ && v:val.word =~ '^\\u\\+$\\|^\\u\\?\\l\\+$'")
+
if a:cur_keyword_str =~ '^\l\+$'
- for keyword in complete_words
+ for keyword in convert_candidates
let keyword.word = tolower(keyword.word)
let keyword.abbr = tolower(keyword.abbr)
endfor
elseif a:cur_keyword_str =~ '^\u\+$'
- for keyword in complete_words
+ for keyword in convert_candidates
let keyword.word = toupper(keyword.word)
let keyword.abbr = toupper(keyword.abbr)
endfor
elseif a:cur_keyword_str =~ '^\u\l\+$'
- for keyword in complete_words
- let keyword.word = toupper(keyword.word[0]).tolower(keyword.word[1:])
- let keyword.abbr = toupper(keyword.abbr[0]).tolower(keyword.abbr[1:])
+ for keyword in convert_candidates
+ let keyword.word = toupper(keyword.word[0]).
+ \ tolower(keyword.word[1:])
+ let keyword.abbr = toupper(keyword.abbr[0]).
+ \ tolower(keyword.abbr[1:])
endfor
endif
endif"}}}
@@ -1564,6 +1749,65 @@ function! neocomplcache#get_complete_words(complete_results,
return complete_words
endfunction"}}}
+function! s:set_complete_results_pos(cur_text, ...)"{{{
+ " Set context filetype.
+ call s:set_context_filetype()
+
+ let sources = copy(get(a:000, 0, s:get_sources_list()))
+ if a:0 < 1
+ call filter(sources, 'neocomplcache#is_source_enabled(v:key)
+ \ && !neocomplcache#is_plugin_locked(v:key)')
+ endif
+
+ " Try source completion."{{{
+ let complete_results = {}
+ for [source_name, source] in items(sources)
+ if source.kind ==# 'plugin'
+ " Plugin default keyword position.
+ let [cur_keyword_pos, cur_keyword_str] = neocomplcache#match_word(a:cur_text)
+ else
+ let pos = getpos('.')
+
+ try
+ let cur_keyword_pos = source.get_keyword_pos(a:cur_text)
+ catch
+ call neocomplcache#print_error(v:throwpoint)
+ call neocomplcache#print_error(v:exception)
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s get_keyword_pos()!')
+ call neocomplcache#print_error(
+ \ 'Source name is ' . source_name)
+ return complete_results
+ finally
+ if getpos('.') != pos
+ call setpos('.', pos)
+ endif
+ endtry
+ endif
+
+ if cur_keyword_pos < 0
+ continue
+ endif
+
+ let cur_keyword_str = a:cur_text[cur_keyword_pos :]
+ if neocomplcache#is_auto_complete() &&
+ \ neocomplcache#util#mb_strlen(cur_keyword_str)
+ \ < neocomplcache#get_completion_length(source_name)
+ " Skip.
+ continue
+ endif
+
+ let complete_results[source_name] = {
+ \ 'complete_words' : [],
+ \ 'cur_keyword_pos' : cur_keyword_pos,
+ \ 'cur_keyword_str' : cur_keyword_str,
+ \ 'source' : source,
+ \}
+ endfor
+ "}}}
+
+ return complete_results
+endfunction"}}}
function! s:set_complete_results_words(complete_results)"{{{
" Try source completion.
for [source_name, result] in items(a:complete_results)
@@ -1586,15 +1830,22 @@ function! s:set_complete_results_words(complete_results)"{{{
let pos = getpos('.')
try
- let words = result.source.get_complete_words(
- \ result.cur_keyword_pos, result.cur_keyword_str)
+ let words = result.source.kind ==# 'plugin' ?
+ \ result.source.get_keyword_list(result.cur_keyword_str) :
+ \ result.source.get_complete_words(
+ \ result.cur_keyword_pos, result.cur_keyword_str)
catch
call neocomplcache#print_error(v:throwpoint)
call neocomplcache#print_error(v:exception)
call neocomplcache#print_error(
- \ 'Error occured in complfunc''s get_complete_words()!')
- call neocomplcache#print_error(
\ 'Source name is ' . source_name)
+ if result.source.kind ==# 'plugin'
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s get_keyword_list()!')
+ else
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s get_complete_words()!')
+ endif
return
finally
if getpos('.') != pos
@@ -1607,76 +1858,26 @@ function! s:set_complete_results_words(complete_results)"{{{
let result.complete_words = words
endfor
endfunction"}}}
-function! s:set_complete_results_pos(cur_text, ...)"{{{
- " Set context filetype.
- call s:set_context_filetype()
-
- let sources = copy(get(a:000, 0, extend(copy(neocomplcache#available_complfuncs()),
- \ neocomplcache#available_loaded_ftplugins())))
- if neocomplcache#is_eskk_enabled() && eskk#get_mode() !=# 'ascii'
- " omni_complete only.
- let sources = filter(sources, 'v:key ==# "omni_complete"')
- endif
- if a:0 < 1
- call filter(sources, 'neocomplcache#is_source_enabled(v:key)
- \ && !neocomplcache#is_plugin_locked(v:key)')
- endif
-
- " Try source completion."{{{
- let complete_results = {}
- for [source_name, source] in items(sources)
- let pos = getpos('.')
-
- try
- let cur_keyword_pos = source.get_keyword_pos(a:cur_text)
- catch
- call neocomplcache#print_error(v:throwpoint)
- call neocomplcache#print_error(v:exception)
- call neocomplcache#print_error(
- \ 'Error occured in complfunc''s get_keyword_pos()!')
- call neocomplcache#print_error(
- \ 'Source name is ' . source_name)
- return complete_results
- finally
- if getpos('.') != pos
- call setpos('.', pos)
- endif
- endtry
-
- if cur_keyword_pos < 0
- continue
- endif
-
- let cur_keyword_str = a:cur_text[cur_keyword_pos :]
- if neocomplcache#is_auto_complete() &&
- \ neocomplcache#util#mb_strlen(cur_keyword_str)
- \ < neocomplcache#get_completion_length(source_name)
- " Skip.
- continue
- endif
-
- let complete_results[source_name] = {
- \ 'complete_words' : [],
- \ 'cur_keyword_pos' : cur_keyword_pos,
- \ 'cur_keyword_str' : cur_keyword_str,
- \ 'source' : source,
- \}
- endfor
- "}}}
-
- return complete_results
-endfunction"}}}
" Set default pattern helper.
function! neocomplcache#set_dictionary_helper(variable, keys, value)"{{{
- return neocomplcache#util#set_default_dictionary_helper(a:variable, a:keys, a:value)
+ return neocomplcache#util#set_dictionary_helper(
+ \ a:variable, a:keys, a:value)
+endfunction"}}}
+
+function! neocomplcache#disable_default_dictionary(variable)"{{{
+ return neocomplcache#util#disable_default_dictionary(a:variable)
endfunction"}}}
" Complete filetype helper.
function! neocomplcache#filetype_complete(arglead, cmdline, cursorpos)"{{{
" Dup check.
let ret = {}
- for item in map(split(globpath(&runtimepath, 'syntax/*.vim'), '\n'), 'fnamemodify(v:val, ":t:r")')
+ 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
@@ -1693,12 +1894,16 @@ function! neocomplcache#toggle_lock()"{{{
return
endif
- if !get(s:complete_lock, bufnr('%'), 0)
- echo 'neocomplcache is locked!'
- call neocomplcache#lock()
- else
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ if b:neocomplcache.lock
echo 'neocomplcache is unlocked!'
call neocomplcache#unlock()
+ else
+ echo 'neocomplcache is locked!'
+ call neocomplcache#lock()
endif
endfunction"}}}
function! neocomplcache#lock()"{{{
@@ -1708,7 +1913,11 @@ function! neocomplcache#lock()"{{{
return
endif
- let s:complete_lock[bufnr('%')] = 1
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ let b:neocomplcache.lock = 1
endfunction"}}}
function! neocomplcache#unlock()"{{{
if !neocomplcache#is_enabled()
@@ -1717,7 +1926,11 @@ function! neocomplcache#unlock()"{{{
return
endif
- let s:complete_lock[bufnr('%')] = 0
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ let b:neocomplcache.lock = 0
endfunction"}}}
function! neocomplcache#lock_source(source_name)"{{{
if !neocomplcache#is_enabled()
@@ -1903,8 +2116,19 @@ function! s:display_neco(number)"{{{
let &cmdheight = cmdheight_save
endfunction"}}}
+function! neocomplcache#set_file_type(filetype)"{{{
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ let b:neocomplcache.filetype = a:filetype
+endfunction"}}}
function! s:set_auto_completion_length(len)"{{{
- let s:auto_completion_length[bufnr('%')] = a:len
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ let b:neocomplcache.completion_length = a:len
endfunction"}}}
"}}}
@@ -1956,7 +2180,8 @@ function! neocomplcache#complete_common_string()"{{{
let ignorecase_save = &ignorecase
" Get cursor word.
- let [cur_keyword_pos, cur_keyword_str] = neocomplcache#match_word(s:get_cur_text())
+ let [cur_keyword_pos, cur_keyword_str] =
+ \ neocomplcache#match_word(s:get_cur_text())
if neocomplcache#is_text_mode()
let &ignorecase = 1
@@ -1987,6 +2212,10 @@ function! neocomplcache#complete_common_string()"{{{
let &ignorecase = ignorecase_save
+ if common_str == ''
+ return ''
+ endif
+
return (pumvisible() ? "\<C-e>" : '')
\ . repeat("\<BS>", len(cur_keyword_str)) . common_str
endfunction"}}}
@@ -1998,9 +2227,6 @@ endfunction"}}}
function! neocomplcache#manual_omni_complete()"{{{
return neocomplcache#start_manual_complete('omni_complete')
endfunction"}}}
-function! neocomplcache#manual_keyword_complete()"{{{
- return neocomplcache#start_manual_complete('keyword_complete')
-endfunction"}}}
" Manual complete wrapper.
function! neocomplcache#start_manual_complete(...)"{{{
@@ -2010,20 +2236,10 @@ function! neocomplcache#start_manual_complete(...)"{{{
" Set function.
let &l:completefunc = 'neocomplcache#sources_manual_complete'
- let s:use_sources = {}
- let all_sources = extend(copy(neocomplcache#available_complfuncs()),
- \ neocomplcache#available_loaded_ftplugins())
+ let all_sources = neocomplcache#available_sources()
let sources = get(a:000, 0, keys(all_sources))
- for source_name in type(sources) == type([]) ?
- \ sources : [sources]
- if has_key(all_sources, source_name)
- let s:use_sources[source_name] = all_sources[source_name]
- else
- call neocomplcache#print_warning(printf(
- \ "Invalid completefunc name %s is given.", a:complfunc_name))
- return ''
- endif
- endfor
+ let s:use_sources = s:get_sources_list(type(sources) == type([]) ?
+ \ sources : [sources])
" Start complete.
return "\<C-x>\<C-u>\<C-p>"
@@ -2045,13 +2261,17 @@ function! s:on_moved_i()"{{{
" Get cursor word.
let cur_text = s:get_cur_text()
+ let sources = neocomplcache#available_sources()
+
" Make cache.
if cur_text =~ '^\s*$\|\s\+$'
if neocomplcache#is_source_enabled('buffer_complete')
+ \ && has_key(sources, 'buffer_complete')
" Caching current cache line.
call neocomplcache#sources#buffer_complete#caching_current_line()
endif
if neocomplcache#is_source_enabled('member_complete')
+ \ && has_key(sources, 'member_complete')
" Caching current cache line.
call neocomplcache#sources#member_complete#caching_current_line()
endif
@@ -2061,7 +2281,6 @@ function! s:on_insert_leave()"{{{
let s:cur_text = ''
let s:cur_keyword_str = ''
let s:complete_words = []
- let s:context_filetype = ''
let s:is_text_mode = 0
let s:skip_next_complete = 0
let s:is_prefetch = 0
@@ -2095,34 +2314,35 @@ function! s:restore_update_time()"{{{
let &updatetime = s:update_time_save
endif
endfunction"}}}
-function! s:remove_next_keyword(plugin_name, list)"{{{
- let list = a:list
- " Remove next keyword."{{{
- if a:plugin_name == 'filename_complete'
- let pattern = '^\%(' . neocomplcache#get_next_keyword_pattern('filename') . '\m\)'
- else
- let pattern = '^\%(' . neocomplcache#get_next_keyword_pattern() . '\m\)'
- endif
+function! s:remove_next_keyword(source_name, list)"{{{
+ " Remove next keyword.
+ let pattern = '^\%(' .
+ \ (a:source_name == 'filename_complete' ?
+ \ neocomplcache#get_next_keyword_pattern('filename') :
+ \ neocomplcache#get_next_keyword_pattern()) . '\m\)'
let next_keyword_str = matchstr('a'.
\ getline('.')[len(neocomplcache#get_cur_text(1)) :], pattern)[1:]
- if next_keyword_str != ''
- let next_keyword_str = substitute(escape(next_keyword_str, '~" \.^$*[]'), "'", "''", 'g').'$'
+ if next_keyword_str == ''
+ return a:list
+ endif
- " No ignorecase.
- let ignorecase_save = &ignorecase
- let &ignorecase = 0
+ let next_keyword_str = substitute(escape(next_keyword_str,
+ \ '~" \.^$*[]'), "'", "''", 'g').'$'
- for r in list
- if r.word =~ next_keyword_str
- let r.word = r.word[:match(r.word, next_keyword_str)-1]
- endif
- endfor
+ " No ignorecase.
+ let ignorecase_save = &ignorecase
+ let &ignorecase = 0
- let &ignorecase = ignorecase_save
- endif"}}}
+ for r in a:list
+ if r.word =~ next_keyword_str
+ let r.word = r.word[:match(r.word, next_keyword_str)-1]
+ endif
+ endfor
- return list
+ let &ignorecase = ignorecase_save
+
+ return a:list
endfunction"}}}
function! neocomplcache#popup_post()"{{{
return !pumvisible() ? "" :
@@ -2130,21 +2350,53 @@ function! neocomplcache#popup_post()"{{{
\ || neocomplcache#is_eskk_enabled()) ? "\<C-p>" :
\ "\<C-p>\<Down>"
endfunction"}}}
+
"}}}
" Internal helper functions."{{{
function! s:get_cur_text()"{{{
- let s: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 cur_keyword_str = matchstr(cur_text, '\S\+$')
+ let cur_text = matchstr(cur_text, '^.\{-}\ze\S\+$')
+ else
+ let cur_keyword_str = ''
+ 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(cur_keyword_str, wildcard)
+ if index <= 0
+ break
+ endif
+
+ let cur_keyword_str = cur_keyword_str[: index-1]
+ \ . '*' . cur_keyword_str[index+1: ]
+ endwhile
+ endif
+
+ let s:cur_text = cur_text . cur_keyword_str
+
" Save cur_text.
return s:cur_text
endfunction"}}}
function! s:set_context_filetype()"{{{
- let old_filetype = &filetype
+ if !exists('b:neocomplcache')
+ call s:initialize_buffer_variable()
+ endif
+
+ let old_filetype = (b:neocomplcache.filetype == '') ?
+ \ &filetype : b:neocomplcache.filetype
if old_filetype == ''
let old_filetype = 'nothing'
endif
@@ -2154,8 +2406,8 @@ function! s:set_context_filetype()"{{{
let new_filetype = s:get_context_filetype(old_filetype)
" Check filetype root.
- if has_key(dup_check, old_filetype) && dup_check[old_filetype] ==# new_filetype
- let s:context_filetype = old_filetype
+ if get(dup_check, old_filetype, '') ==# new_filetype
+ let b:neocomplcache.context_filetype = old_filetype
break
endif
@@ -2167,28 +2419,37 @@ function! s:set_context_filetype()"{{{
" Set text mode or not.
let syn_name = neocomplcache#get_syn_name(1)
let s:is_text_mode =
- \ (has_key(g:neocomplcache_text_mode_filetypes, s:context_filetype)
- \ && g:neocomplcache_text_mode_filetypes[s:context_filetype])
+ \ get(g:neocomplcache_text_mode_filetypes,
+ \ b:neocomplcache.context_filetype, 0)
let s:within_comment = (syn_name ==# 'Comment')
" Set filetype plugins.
let s:loaded_ftplugin_sources = {}
- for [source_name, source] in items(neocomplcache#available_ftplugins())
- if has_key(source.filetypes, s:context_filetype)
- let s:loaded_ftplugin_sources[source_name] = source
-
- if !source.loaded
- " Initialize.
- if has_key(source, 'initialize')
+ for [source_name, source] in
+ \ items(filter(copy(neocomplcache#available_ftplugins()),
+ \ 'has_key(v:val.filetypes, b:neocomplcache.context_filetype)'))
+ let s:loaded_ftplugin_sources[source_name] = source
+
+ if !source.loaded
+ " Initialize.
+ if has_key(source, 'initialize')
+ try
call source.initialize()
- endif
-
- let source.loaded = 1
+ catch
+ call neocomplcache#print_error(v:throwpoint)
+ call neocomplcache#print_error(v:exception)
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s initialize()!')
+ call neocomplcache#print_error(
+ \ 'Source name is ' . source.name)
+ endtry
endif
+
+ let source.loaded = 1
endif
endfor
- return s:context_filetype
+ return b:neocomplcache.context_filetype
endfunction"}}}
function! s:get_context_filetype(filetype)"{{{
let filetype = a:filetype
@@ -2198,10 +2459,7 @@ function! s:get_context_filetype(filetype)"{{{
" Default.
let context_filetype = filetype
- if neocomplcache#is_eskk_enabled()
- let context_filetype = 'eskk'
- let filetype = 'eskk'
- elseif has_key(g:neocomplcache_context_filetype_lists, filetype)
+ if has_key(g:neocomplcache_context_filetype_lists, filetype)
\ && !empty(g:neocomplcache_context_filetype_lists[filetype])
let pos = [line('.'), col('.')]
@@ -2236,10 +2494,6 @@ function! s:get_context_filetype(filetype)"{{{
endfunction"}}}
function! s:match_wildcard(cur_text, pattern, cur_keyword_pos)"{{{
let cur_keyword_pos = a:cur_keyword_pos
- if neocomplcache#is_eskk_enabled() || !g:neocomplcache_enable_wildcard
- return cur_keyword_pos
- endif
-
while cur_keyword_pos > 1 && a:cur_text[cur_keyword_pos - 1] == '*'
let left_text = a:cur_text[: cur_keyword_pos - 2]
if left_text == '' || left_text !~ a:pattern
@@ -2255,7 +2509,7 @@ function! s:unite_patterns(pattern_var, filetype)"{{{
let keyword_patterns = []
let dup_check = {}
- " Compound filetype.
+ " 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
@@ -2273,8 +2527,11 @@ function! s:unite_patterns(pattern_var, filetype)"{{{
endif
endfor
- if empty(keyword_patterns) && has_key(a:pattern_var, 'default')
- call add(keyword_patterns, g:neocomplcache_keyword_patterns['default'])
+ 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\|')
@@ -2287,6 +2544,99 @@ function! s:get_frequencies()"{{{
return s:filetype_frequencies[filetype]
endfunction"}}}
+function! s:initialize_buffer_variable()"{{{
+ let b:neocomplcache = {
+ \ 'lock' : 0,
+ \ 'filetype' : '',
+ \ 'context_filetype' : '',
+ \ 'completion_length' : -1,
+ \}
+endfunction"}}}
+function! s:initialize_sources(source_names)"{{{
+ " Initialize sources table.
+
+ for name in a:source_names
+ if has_key(s:complfunc_sources, name)
+ \ || has_key(s:ftplugin_sources, name)
+ \ || has_key(s:plugin_sources, name)
+ \ || s:loaded_all_sources
+ continue
+ endif
+
+ " Search autoload.
+ for source_name in filter(map(split(globpath(&runtimepath,
+ \ 'autoload/neocomplcache/sources/*.vim'), '\n'),
+ \ "fnamemodify(v:val, ':t:r')"),
+ \ "neocomplcache#is_source_enabled(v:val)")
+ let source = neocomplcache#sources#{source_name}#define()
+ if empty(source) || has_key(s:complfunc_sources, source.name)
+ \ || has_key(s:ftplugin_sources, source.name)
+ \ || has_key(s:plugin_sources, source.name)
+ " Ignore.
+ continue
+ endif
+
+ if source.kind ==# 'complfunc'
+ let s:complfunc_sources[source_name] = source
+ let source.loaded = 1
+ elseif source.kind ==# 'ftplugin'
+ let s:ftplugin_sources[source_name] = source
+
+ " Clear loaded flag.
+ let s:ftplugin_sources[source_name].loaded = 0
+ elseif source.kind ==# 'plugin'
+ let s:plugin_sources[source_name] = source
+ let source.loaded = 1
+ endif
+
+ if (source.kind ==# 'complfunc' || source.kind ==# 'plugin')
+ \ && 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 occured in source''s initialize()!')
+ call neocomplcache#print_error(
+ \ 'Source name is ' . source.name)
+ endtry
+ endif
+ endfor
+
+ if name == ''
+ let s:loaded_all_sources = 1
+ endif
+ endfor
+endfunction"}}}
+function! s:get_sources_list(...)"{{{
+ let filetype = neocomplcache#get_context_filetype()
+
+ let source_names = get(a:000, 0,
+ \ get(g:neocomplcache_sources_list, filetype,
+ \ get(g:neocomplcache_sources_list, '_', [''])))
+ call s:initialize_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
+
+ return sources
+endfunction"}}}
"}}}
let &cpo = s:save_cpo
16 .vim/bundle/neocomplcache/autoload/neocomplcache/async_cache.vim
View
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: async_cache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Jun 2012.
+" Last Modified: 18 Aug 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@@ -72,7 +72,7 @@ function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilenam
endif
let lines = map(readfile(a:filename),
- \ 'iconv(v:val, a:fileencoding, &encoding)')
+ \ 's:iconv(v:val, a:fileencoding, &encoding)')
let pattern = get(readfile(a:pattern_file_name), 0, '\h\w*')
@@ -122,7 +122,7 @@ function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilenam
if filereadable(tags_file_name)