Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated vim bundles

  • Loading branch information...
commit 173a82f78b5bc63f67d7b9fa4bc7700f05495f88 1 parent 1072ca8
Tammer Saleh authored
Showing with 4,687 additions and 2,116 deletions.
  1. +1 −1  vim/after/indent/html.vim
  2. +36 −15 vim/bundle/Gist.vim/autoload/gist.vim
  3. +23 −13 vim/bundle/ctrlp.vim/autoload/ctrlp.vim
  4. +1 −1  vim/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim
  5. +34 −15 vim/bundle/ctrlp.vim/autoload/ctrlp/mrufiles.vim
  6. +1 −1  vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim
  7. +15 −3 vim/bundle/ctrlp.vim/doc/ctrlp.txt
  8. +9 −8 vim/bundle/neocomplcache/README.md
  9. +1,109 −716 vim/bundle/neocomplcache/autoload/neocomplcache.vim
  10. +13 −13 vim/bundle/neocomplcache/autoload/neocomplcache/async_cache.vim
  11. +18 −19 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
  12. +4 −4 vim/bundle/neocomplcache/autoload/neocomplcache/sources/abbrev_complete.vim
  13. +33 −69 vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
  14. +21 −21 vim/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim
  15. +25 −197 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim
  16. +241 −0 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_include.vim
  17. +92 −79 vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
  18. +34 −28 vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
  19. +56 −39 vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
  20. +20 −22 vim/bundle/neocomplcache/autoload/neocomplcache/sources/syntax_complete.vim
  21. +14 −16 vim/bundle/neocomplcache/autoload/neocomplcache/sources/tags_complete.vim
  22. +23 −13 vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete.vim
  23. +122 −108 vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/helper.vim
  24. +51 −32 vim/bundle/neocomplcache/autoload/neocomplcache/util.vim
  25. +2 −2 vim/bundle/neocomplcache/autoload/unite/sources/file_include.vim
  26. +29 −19 vim/bundle/neocomplcache/autoload/unite/sources/neocomplcache.vim
  27. +23 −23 vim/bundle/neocomplcache/autoload/vital/_9813ec6/prelude.vim
  28. +628 −250 vim/bundle/neocomplcache/doc/neocomplcache.txt
  29. +26 −14 vim/bundle/neocomplcache/plugin/neocomplcache.vim
  30. +37 −0 vim/bundle/neocomplcache/plugin/neocomplcache/buffer_complete.vim
  31. +25 −0 vim/bundle/neocomplcache/plugin/neocomplcache/dictionary_complete.vim
  32. +24 −0 vim/bundle/neocomplcache/plugin/neocomplcache/include_complete.vim
  33. +25 −0 vim/bundle/neocomplcache/plugin/neocomplcache/syntax_complete.vim
  34. +25 −0 vim/bundle/neocomplcache/plugin/neocomplcache/tags_complete.vim
  35. +24 −0 vim/bundle/neocomplcache/vest/test-neocomplcache.vim
  36. +31 −0 vim/bundle/nerdtree/doc/NERD_tree.txt
  37. +43 −5 vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim
  38. +58 −5 vim/bundle/nerdtree/plugin/NERD_tree.vim
  39. +72 −25 vim/bundle/tabular/autoload/tabular.vim
  40. +35 −17 vim/bundle/tabular/plugin/Tabular.vim
  41. +1 −0  vim/bundle/tcomment_vim/.gitignore
  42. +41 −0 vim/bundle/tcomment_vim/CHANGES.TXT
  43. +37 −3 vim/bundle/tcomment_vim/README
  44. +222 −53 vim/bundle/tcomment_vim/autoload/tcomment.vim
  45. +49 −3 vim/bundle/tcomment_vim/doc/tcomment.txt
  46. +18 −6 vim/bundle/tcomment_vim/plugin/tcomment.vim
  47. +3 −3 vim/bundle/tcomment_vim/spec/tcomment/issue30_sel=exclusive.vim
  48. +1 −3 vim/bundle/tcomment_vim/spec/tcomment/issue30_sel=inclusive.vim
  49. +2 −3 vim/bundle/vim-coffee-script/Readme.md
  50. +11 −11 vim/bundle/vim-coffee-script/compiler/coffee.vim
  51. +1 −1  vim/bundle/vim-coffee-script/ftdetect/coffee.vim
  52. +1 −1  vim/bundle/vim-endwise/README.markdown
  53. +7 −2 vim/bundle/vim-endwise/plugin/endwise.vim
  54. +5 −4 vim/bundle/vim-fugitive/README.markdown
  55. +6 −4 vim/bundle/vim-fugitive/doc/fugitive.txt
  56. +58 −30 vim/bundle/vim-fugitive/plugin/fugitive.vim
  57. +1 −1  vim/bundle/vim-git/ftdetect/git.vim
  58. +23 −0 vim/bundle/vim-haml/compiler/haml.vim
  59. +25 −0 vim/bundle/vim-haml/compiler/sass.vim
  60. +2 −0  vim/bundle/vim-haml/syntax/sass.vim
  61. +1 −0  vim/bundle/vim-json/.gitignore
  62. +5 −0 vim/bundle/vim-json/ftplugin/json.vim
  63. +3 −2 vim/bundle/vim-json/readme.md
  64. +10 −2 vim/bundle/vim-json/syntax/json.vim
  65. +1 −0  vim/bundle/vim-less/ftplugin/less.vim
  66. +24 −1 vim/bundle/vim-markdown/syntax/markdown.vim
  67. +20 −0 vim/bundle/vim-pasta/LICENSE.txt
  68. +7 −0 vim/bundle/vim-powerline/README.rst
  69. +5 −4 vim/bundle/vim-powerline/autoload/Pl.vim
  70. +2 −2 vim/bundle/vim-powerline/autoload/Pl/Match.vim
  71. +154 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/solarized.vim
  72. +195 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/solarized16.vim
  73. +8 −5 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/{skwp.vim → solarized256.vim}
  74. +1 −1  vim/bundle/vim-powerline/autoload/Powerline/Functions.vim
  75. +11 −11 vim/bundle/vim-powerline/autoload/Powerline/Matches.vim
  76. +114 −0 vim/bundle/vim-powerline/autoload/Powerline/Themes/solarized16.vim
  77. +4 −1 vim/bundle/vim-powerline/autoload/Powerline/Themes/{skwp.vim → solarized256.vim}
  78. +14 −4 vim/bundle/vim-powerline/doc/Powerline.txt
  79. +14 −5 vim/bundle/vim-powerline/plugin/Powerline.vim
  80. +34 −19 vim/bundle/vim-rails/autoload/rails.vim
  81. +1 −1  vim/bundle/vim-rails/doc/rails.txt
  82. +3 −3 vim/bundle/vim-repeat/autoload/repeat.vim
  83. +5 −5 vim/bundle/vim-ruby/autoload/rubycomplete.vim
  84. +42 −16 vim/bundle/vim-ruby/doc/ft-ruby-syntax.txt
  85. +16 −0 vim/bundle/vim-ruby/etc/examples/indent/closing_brackets.rb
  86. +14 −0 vim/bundle/vim-ruby/etc/examples/indent/continuations.rb
  87. +2 −0  vim/bundle/vim-ruby/etc/examples/indent/strings.rb
  88. +4 −0 vim/bundle/vim-ruby/ftdetect/ruby.vim
  89. +5 −1 vim/bundle/vim-ruby/ftplugin/ruby.vim
  90. +78 −28 vim/bundle/vim-ruby/indent/ruby.vim
  91. +4 −4 vim/bundle/vim-ruby/syntax/ruby.vim
  92. +19 −0 vim/bundle/vim-slim/LICENSE.txt
  93. +2 −0  vim/bundle/vim-slim/ftdetect/slim.vim
  94. +6 −0 vim/bundle/vim-slim/ftplugin/slim.vim
  95. +75 −0 vim/bundle/vim-slim/indent/slim.vim
  96. +95 −0 vim/bundle/vim-slim/syntax/slim.vim
  97. +0 −79 vim/bundle/vim-textobj-rubyblock/test/basic.input
  98. +66 −0 vim/bundle/vim-textobj-rubyblock/test/rubyblock_test.vim
  99. +3 −0  vim/bundle/vim-textobj-rubyblock/test/samples/class.rb
  100. +1 −0  vim/update_bundles
  101. +2 −1  vim/vimrc
View
2  vim/after/indent/html.vim
@@ -1 +1 @@
-let g:html_indent_tags = g:html_indent_tags.'\|p\|li'
+let g:html_indent_inctags = "p,li,body"
View
51 vim/bundle/Gist.vim/autoload/gist.vim
@@ -1,8 +1,8 @@
"=============================================================================
" File: gist.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 07-Sep-2012.
-" Version: 6.9
+" Last Change: 27-Sep-2012.
+" Version: 7.0
" WebPage: http://github.com/mattn/gist-vim
" License: BSD
@@ -113,7 +113,7 @@ function! s:GistList(gistls, page)
silent %d _
redraw | echon 'Listing gists... '
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
bw!
redraw
@@ -157,8 +157,28 @@ function! s:GistList(gistls, page)
redraw | echo ''
endfunction
+function! gist#list(user, ...)
+ let page = get(a:000, 0, 0)
+ if a:user == '-all'
+ let url = 'https://api.github.com/gists/public'
+ elseif get(g:, 'gist_show_privates', 0) && a:user == 'starred'
+ let url = 'https://api.github.com/gists/starred'
+ elseif get(g:, 'gist_show_privates') && a:user == 'mine'
+ let url = 'https://api.github.com/gists'
+ else
+ let url = 'https://api.github.com/users/'.a:user.'/gists'
+ endif
+
+ let auth = s:GistGetAuthHeader()
+ if len(auth) == 0
+ return []
+ endif
+ let res = webapi#http#get(url, '', { "Authorization": auth })
+ return webapi#json#decode(res.content)
+endfunction
+
function! s:GistGetFileName(gistid)
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
return ''
endif
@@ -171,7 +191,7 @@ function! s:GistGetFileName(gistid)
endfunction
function! s:GistDetectFiletype(gistid)
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
return ''
endif
@@ -199,7 +219,7 @@ endfunction
function! s:GistGet(gistid, clipboard)
redraw | echon 'Getting gist... '
- let res = webapi#http#get('https://api.github.com/gists/'.a:gistid, '', { "Authorization": s:GetAuthHeader() })
+ let res = webapi#http#get('https://api.github.com/gists/'.a:gistid, '', { "Authorization": s:GistGetAuthHeader() })
let status = matchstr(matchstr(res.header, '^Status:'), '^[^:]\+: \zs.*')
if status =~ '^2'
let gist = webapi#json#decode(res.content)
@@ -208,8 +228,8 @@ function! s:GistGet(gistid, clipboard)
else
let num_file = 1
endif
+ redraw
if num_file > len(keys(gist.files))
- redraw
echohl ErrorMsg | echomsg 'Gist not found' | echohl None
return
endif
@@ -306,7 +326,7 @@ function! s:GistUpdate(content, gistid, gistnm, desc)
if len(filename) == 0 | let filename = s:get_current_filename(1) | endif
endif
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
redraw
echohl ErrorMsg | echomsg 'Canceled' | echohl None
@@ -350,7 +370,7 @@ function! s:GistUpdate(content, gistid, gistnm, desc)
endfunction
function! s:GistDelete(gistid)
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
redraw
echohl ErrorMsg | echomsg 'Canceled' | echohl None
@@ -412,7 +432,7 @@ function! s:GistPost(content, private, desc, anonymous)
let header = {"Content-Type": "application/json"}
if !a:anonymous
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
redraw
echohl ErrorMsg | echomsg 'Canceled' | echohl None
@@ -467,6 +487,7 @@ function! s:GistPostBuffers(private, desc, anonymous)
let header = {"Content-Type": "application/json"}
if !a:anonymous
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
redraw
echohl ErrorMsg | echomsg 'Canceled' | echohl None
@@ -551,7 +572,7 @@ function! gist#Gist(count, line1, line2, ...)
let gistid = gistidbuf
let editpost = 1
elseif arg =~ '^\(+1\|--star\)$\C' && gistidbuf != ''
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
echohl ErrorMsg | echomsg 'Canceled' | echohl None
else
@@ -566,7 +587,7 @@ function! gist#Gist(count, line1, line2, ...)
endif
return
elseif arg =~ '^\(-1\|--unstar\)$\C' && gistidbuf != ''
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
echohl ErrorMsg | echomsg 'Canceled' | echohl None
else
@@ -580,7 +601,7 @@ function! gist#Gist(count, line1, line2, ...)
endif
return
elseif arg =~ '^\(-f\|--fork\)$\C' && gistidbuf != ''
- let auth = s:GetAuthHeader()
+ let auth = s:GistGetAuthHeader()
if len(auth) == 0
echohl ErrorMsg | echomsg 'Canceled' | echohl None
return
@@ -682,7 +703,7 @@ function! gist#Gist(count, line1, line2, ...)
return 1
endfunction
-function! s:GetAuthHeader()
+function! s:GistGetAuthHeader()
if get(g:, 'gist_use_password_in_gitconfig', 0) != 0
let password = substitute(system('git config --get github.password'), "\n", '', '')
if password =~ '^!' | let password = system(password[1:]) | endif
@@ -804,7 +825,7 @@ let s:extmap = {
\".man": "man",
\".mao": "mao",
\".matlab": "matlab",
-\".md": "md",
+\".md": "markdown",
\".minid": "minid",
\".ml": "ml",
\".moo": "moo",
View
36 vim/bundle/ctrlp.vim/autoload/ctrlp.vim
@@ -273,7 +273,7 @@ fu! s:Close()
if exists('s:glb_acd') | let &acd = s:glb_acd | en
let g:ctrlp_lines = []
if s:winres[1] >= &lines && s:winres[2] == winnr('$')
- exe s:winres[0]
+ exe s:winres[0].s:winres[0]
en
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
\ s:mrbs s:did_exp
@@ -432,7 +432,7 @@ fu! s:MatchedItems(items, pat, limit)
let items = s:narrowable() ? s:matched + s:mdata[3] : a:items
if s:matcher != {}
let argms = [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp]
- let lines = call(s:matcher['match'], argms)
+ let lines = call(s:matcher['match'], argms, s:matcher)
el
let lines = s:MatchIt(items, a:pat, a:limit, exc)
en
@@ -1140,7 +1140,7 @@ fu! s:OpenNoMarks(md, line)
cal s:remarksigns()
cal s:BuildPrompt(0)
elsei a:md == 'x'
- cal call(s:openfunc[s:ctype], [a:md, a:line])
+ cal call(s:openfunc[s:ctype], [a:md, a:line], s:openfunc)
elsei a:md == 'd'
let dir = fnamemodify(a:line, ':h')
if isdirectory(dir)
@@ -1276,7 +1276,7 @@ fu! ctrlp#statusline()
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''
if s:status != {}
let args = [focus, byfname, s:regexp, prv, s:ctype, nxt, marked]
- let &l:stl = call(s:status['main'], args)
+ let &l:stl = call(s:status['main'], args, s:status)
el
let item = '%#CtrlPMode1# '.s:ctype.' %*'
let focus = '%#CtrlPMode2# '.focus.' %*'
@@ -1296,15 +1296,24 @@ endf
fu! ctrlp#progress(enum, ...)
if has('macunix') || has('mac') | sl 1m | en
let txt = a:0 ? '(press ctrl-c to abort)' : ''
- let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum])
+ let &l:stl = s:status != {} ? call(s:status['prog'], [a:enum], s:status)
\ : '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*'
redraws
endf
" *** Paths {{{2
" Line formatting {{{3
fu! s:formatline(str)
- let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str)
- retu '> '.( cond ? s:pathshorten(a:str) : a:str )
+ let str = a:str
+ if s:itemtype == 1
+ let bfnr = bufnr('^'.fnamemodify(str, ':p').'$')
+ let idc = ( bfnr == bufnr('#') ? '#' : '' )
+ \ . ( getbufvar(bfnr, '&ma') ? '' : '-' )
+ \ . ( getbufvar(bfnr, '&ro') ? '=' : '' )
+ \ . ( getbufvar(bfnr, '&mod') ? '+' : '' )
+ let str .= idc != '' ? ' '.idc : ''
+ en
+ let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str)
+ retu '> '.( cond ? s:pathshorten(str) : str )
endf
fu! s:pathshorten(str)
@@ -1386,8 +1395,9 @@ fu! s:samerootsyml(each, isfile, cwd)
endf
fu! ctrlp#rmbasedir(items)
- if a:items != [] && !stridx(a:items[0], s:dyncwd)
- let idx = strlen(s:dyncwd) + ( s:dyncwd !~ '[\/]$' )
+ let cwd = s:dyncwd.( s:dyncwd !~ '[\/]$' ? s:lash : '' )
+ if a:items != [] && !stridx(a:items[0], cwd)
+ let idx = strlen(cwd)
retu map(a:items, 'strpart(v:val, idx)')
en
retu a:items
@@ -1860,9 +1870,9 @@ endf
fu! s:buffunc(e)
if a:e && has_key(s:buffunc, 'enter')
- cal call(s:buffunc['enter'], [])
+ cal call(s:buffunc['enter'], [], s:buffunc)
elsei !a:e && has_key(s:buffunc, 'exit')
- cal call(s:buffunc['exit'], [])
+ cal call(s:buffunc['exit'], [], s:buffunc)
en
endf
@@ -1980,7 +1990,7 @@ endf
fu! s:insertcache(str)
let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str]
- if strlen(str) <= strlen(data[0])
+ if data == [] || strlen(str) <= strlen(data[0])
let pos = 0
elsei strlen(str) >= strlen(data[-1])
let pos = len(data) - 1
@@ -2045,7 +2055,7 @@ fu! ctrlp#hicheck(grp, defgrp)
endf
fu! ctrlp#call(func, ...)
- cal call(a:func, a:000)
+ retu call(a:func, a:000)
endf
"}}}1
" * Initialization {{{1
View
2  vim/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim
@@ -158,7 +158,7 @@ fu! s:esctagscmd(bin, args, ...)
let &ssl = ssl
en
if has('iconv')
- let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
+ let last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc
let cmd = iconv(cmd, &enc, last)
en
retu cmd
View
49 vim/bundle/ctrlp.vim/autoload/ctrlp/mrufiles.vim
@@ -14,6 +14,7 @@ fu! ctrlp#mrufiles#opts()
\ 'exclude': ['s:ex', ''],
\ 'case_sensitive': ['s:cseno', 1],
\ 'relative': ['s:re', 0],
+ \ 'save_on_update': ['s:soup', 1],
\ }]
for [ke, va] in items(opts)
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
@@ -38,11 +39,18 @@ fu! s:chop(mrufs)
endf
fu! s:reformat(mrufs)
+ let cwd = getcwd()
+ let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : ''
if {s:re}
- let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
+ let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd
cal filter(a:mrufs, '!stridx(v:val, cwd)')
en
- retu map(a:mrufs, 'fnamemodify(v:val, ":.")')
+ let idx = strlen(cwd)
+ if exists('+ssl') && &ssl
+ let cwd = tr(cwd, '\', '/')
+ cal map(a:mrufs, 'tr(v:val, "\\", "/")')
+ en
+ retu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val')
endf
fu! s:record(bufnr)
@@ -62,8 +70,14 @@ fu! s:addtomrufs(fname)
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
en
- cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
- cal insert(s:mrufs, fn)
+ let idx = index(s:mrufs, fn, 0, !{s:cseno})
+ if idx
+ cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
+ cal insert(s:mrufs, fn)
+ if {s:soup} && idx < 0
+ cal s:savetofile(s:mergelists())
+ en
+ en
endf
fu! s:savetofile(mrufs)
@@ -71,24 +85,29 @@ fu! s:savetofile(mrufs)
endf
" Public {{{1
fu! ctrlp#mrufiles#refresh(...)
- let s:mrufs = s:mergelists()
- cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
+ let mrufs = s:mergelists()
+ cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
if exists('+ssl')
+ cal map(mrufs, 'tr(v:val, "/", "\\")')
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
- cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1')
+ let cond = 'count(mrufs, v:val, !{s:cseno}) == 1'
+ cal filter(mrufs, cond)
+ cal filter(s:mrufs, cond)
en
- cal s:savetofile(s:mrufs)
- retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs))
+ cal s:savetofile(mrufs)
+ retu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs)
endf
fu! ctrlp#mrufiles#remove(files)
- let s:mrufs = []
+ let mrufs = []
if a:files != []
- let s:mrufs = s:mergelists()
- cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0')
+ let mrufs = s:mergelists()
+ let cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0'
+ cal filter(mrufs, cond)
+ cal filter(s:mrufs, cond)
en
- cal s:savetofile(s:mrufs)
- retu s:reformat(copy(s:mrufs))
+ cal s:savetofile(mrufs)
+ retu s:reformat(mrufs)
endf
fu! ctrlp#mrufiles#add(fn)
@@ -118,7 +137,7 @@ fu! ctrlp#mrufiles#init()
let s:locked = 0
aug CtrlPMRUF
au!
- au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('<abuf>', 1))
+ au BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('<abuf>', 1))
au QuickFixCmdPre *vimgrep* let s:locked = 1
au QuickFixCmdPost *vimgrep* let s:locked = 0
au VimLeavePre * cal s:savetofile(s:mergelists())
View
2  vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim
@@ -15,7 +15,7 @@ endf
fu! ctrlp#utils#opts()
let s:lash = ctrlp#utils#lash()
- let usrhome = $HOME.s:lash($HOME)
+ let usrhome = $HOME . s:lash( $HOME )
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
let cadir = isdirectory(usrhome.'.ctrlp_cache')
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
View
18 vim/bundle/ctrlp.vim/doc/ctrlp.txt
@@ -75,6 +75,7 @@ Overview:~
|ctrlp_mruf_relative|.........Show only MRU files in the working directory.
|ctrlp_mruf_default_order|....Disable sorting.
|ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
+ |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added.
Advanced options:
|ctrlp_open_func|.............Use custom file opening functions.
@@ -574,6 +575,12 @@ MRU entries: >
let g:ctrlp_mruf_case_sensitive = 1
<
+ *'g:ctrlp_mruf_save_on_update'*
+Set this to 0 to disable saving of the MRU list to hard drive whenever a new
+entry is added, saving will then only occur when exiting Vim: >
+ let g:ctrlp_mruf_save_on_update = 1
+<
+
----------------------------------------
Advanced options:~
@@ -1157,8 +1164,8 @@ Highlighting:~
Statuslines:~
* Highlight groups:
- CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character)
- CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|)
+ CtrlPMode1 : 'file' or 'path', and the current mode (Character)
+ CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)
CtrlPStats : the scanning status (Function)
For rebuilding the statuslines, see |g:ctrlp_status_func|.
@@ -1240,14 +1247,19 @@ Special thanks:~
* Seth Fowler <github.com/sfowler>
* Lowe Thiderman <github.com/thiderman>
* Christopher Fredén <github.com/icetan>
+ * Zahary Karadjov <github.com/zah>
+ * Jo De Boeck <github.com/grimpy>
===============================================================================
CHANGELOG *ctrlp-changelog*
+Before 2012/11/30~
+
+ New options: |g:ctrlp_abbrev|,
|g:ctrlp_key_loop|,
|g:ctrlp_open_func|,
- |g:ctrlp_tabpage_position|
+ |g:ctrlp_tabpage_position|,
+ |g:ctrlp_mruf_save_on_update|
+ Rename:
*g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
+ Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
View
17 vim/bundle/neocomplcache/README.md
@@ -66,28 +66,29 @@ Vim completion
Setting examples
```vim
-" Disable AutoComplPop.
+" Disable AutoComplPop. Comment out this line if AutoComplPop is not installed.
let g:acp_enableAtStartup = 0
-" Use neocomplcache.
+" Launches neocomplcache automatically on vim startup.
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.
+" Use underscore completion.
let g:neocomplcache_enable_underbar_completion = 1
-" Set minimum syntax keyword length.
+" Sets minimum char length of syntax keyword.
let g:neocomplcache_min_syntax_length = 3
+" buffer file name pattern that locks neocomplcache. e.g. ku.vim or fuzzyfinder
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
-" Define dictionary.
+" Define file-type dependent dictionaries.
let g:neocomplcache_dictionary_filetype_lists = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
-" Define keyword.
+" Define keyword, for minor languages
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
endif
@@ -123,14 +124,14 @@ inoremap <expr><C-e> neocomplcache#cancel_popup()
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<TAB>"
"inoremap <expr><CR> neocomplcache#smart_close_popup() . "\<CR>"
-" Enable omni completion.
+" Enable omni completion. Not required if they are already set elsewhere in .vimrc
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.
+" Enable heavy omni completion, which require computational power and may stall the vim.
if !exists('g:neocomplcache_omni_patterns')
let g:neocomplcache_omni_patterns = {}
endif
View
1,825 vim/bundle/neocomplcache/autoload/neocomplcache.vim
1,109 additions, 716 deletions not shown
View
26 vim/bundle/neocomplcache/autoload/neocomplcache/async_cache.vim
@@ -27,7 +27,7 @@
let s:save_cpo = &cpo
set cpo&vim
-function! s:main(argv)"{{{
+function! s:main(argv) "{{{
" args: funcname, outputname filename pattern_file_name mark minlen maxfilename
let [funcname, outputname, filename, pattern_file_name, mark, minlen, maxfilename, fileencoding]
\ = a:argv
@@ -65,7 +65,7 @@ function! s:main(argv)"{{{
call writefile([string(keyword_list)], outputname)
endfunction"}}}
-function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding)"{{{
+function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding) "{{{
if !filereadable(a:filename)
" File not found.
return []
@@ -84,9 +84,9 @@ function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilenam
let dup_check = {}
let keyword_pattern2 = '^\%('.pattern.'\m\)'
- for line in lines"{{{
+ for line in lines "{{{
let match = match(line, pattern)
- while match >= 0"{{{
+ while match >= 0 "{{{
let match_str = matchstr(line, keyword_pattern2, match)
if !has_key(dup_check, match_str) && len(match_str) >= a:minlen
@@ -103,7 +103,7 @@ function! s:load_from_file(filename, pattern_file_name, mark, minlen, maxfilenam
return keyword_list
endfunction"}}}
-function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding)"{{{
+function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilename, fileencoding) "{{{
let menu = '[' . a:mark . '] ' . s:strwidthpart(
\ fnamemodify(a:filename, ':t'), a:maxfilename)
@@ -145,7 +145,7 @@ function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilenam
\ a:mark, a:minlen, a:maxfilename, a:fileencoding)
endif
- for line in tags_list"{{{
+ for line in tags_list "{{{
let tag = split(substitute(line, "\<CR>", '', 'g'), '\t', 1)
" Add keywords.
@@ -221,7 +221,7 @@ function! s:load_from_tags(filename, pattern_file_name, mark, minlen, maxfilenam
return keyword_lists
endfunction"}}}
-function! s:truncate(str, width)"{{{
+function! s:truncate(str, width) "{{{
" Original function is from mattn.
" http://github.com/mattn/googlereader-vim/tree/master
@@ -244,7 +244,7 @@ function! s:truncate(str, width)"{{{
return ret
endfunction"}}}
-function! s:strwidthpart(str, width)"{{{
+function! s:strwidthpart(str, width) "{{{
let ret = a:str
let width = s:wcswidth(a:str)
while width > a:width
@@ -266,14 +266,14 @@ endfunction
if v:version >= 703
" Use builtin function.
- function! s:wcswidth(str)"{{{
+ function! s:wcswidth(str) "{{{
return strdisplaywidth(a:str)
endfunction"}}}
- function! s:wcwidth(str)"{{{
+ function! s:wcwidth(str) "{{{
return strwidth(a:str)
endfunction"}}}
else
- function! s:wcswidth(str)"{{{
+ function! s:wcswidth(str) "{{{
if a:str =~# '^[\x00-\x7f]*$'
return strlen(a:str)
end
@@ -293,7 +293,7 @@ else
endfunction"}}}
" UTF-8 only.
- function! s:wcwidth(ucs)"{{{
+ function! s:wcwidth(ucs) "{{{
let ucs = a:ucs
if (ucs >= 0x1100
\ && (ucs <= 0x115f
@@ -326,7 +326,7 @@ if argc() == 8 &&
qall!
else
- function! neocomplcache#async_cache#main(argv)"{{{
+ function! neocomplcache#async_cache#main(argv) "{{{
call s:main(a:argv)
endfunction"}}}
endif
View
37 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: cache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Sep 2012.
+" Last Modified: 02 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
@@ -61,7 +61,7 @@ function! neocomplcache#cache#check_cache(cache_dir, key, async_cache_dictionary
\ a:cache_dir, a:key, a:async_cache_dictionary,
\ a:keyword_list_dictionary[a:key])
endfunction"}}}
-function! neocomplcache#cache#load_from_cache(cache_dir, filename)"{{{
+function! neocomplcache#cache#load_from_cache(cache_dir, filename) "{{{
try
return eval(get(neocomplcache#cache#readfile(
\ a:cache_dir, a:filename), 0, '[]'))
@@ -75,7 +75,7 @@ function! neocomplcache#cache#load_from_cache(cache_dir, filename)"{{{
return []
endtry
endfunction"}}}
-function! neocomplcache#cache#load_from_cache_old(cache_dir, filename)"{{{
+function! neocomplcache#cache#load_from_cache_old(cache_dir, filename) "{{{
try
return map(map(neocomplcache#cache#readfile(a:cache_dir, a:filename),
\ 'split(v:val, "|||", 1)'), '{
@@ -88,7 +88,7 @@ function! neocomplcache#cache#load_from_cache_old(cache_dir, filename)"{{{
return []
endtry
endfunction"}}}
-function! neocomplcache#cache#index_load_from_cache(cache_dir, filename)"{{{
+function! neocomplcache#cache#index_load_from_cache(cache_dir, filename) "{{{
let keyword_lists = {}
let completion_length = 2
@@ -102,7 +102,7 @@ function! neocomplcache#cache#index_load_from_cache(cache_dir, filename)"{{{
return keyword_lists
endfunction"}}}
-function! neocomplcache#cache#list2index(list, dictionary)"{{{
+function! neocomplcache#cache#list2index(list, dictionary) "{{{
let completion_length = 2
for keyword in a:list
let key = tolower(keyword.word[: completion_length-1])
@@ -115,11 +115,11 @@ function! neocomplcache#cache#list2index(list, dictionary)"{{{
return a:dictionary
endfunction"}}}
-function! neocomplcache#cache#save_cache(cache_dir, filename, keyword_list)"{{{
+function! neocomplcache#cache#save_cache(cache_dir, filename, keyword_list) "{{{
call neocomplcache#cache#writefile(
\ a:cache_dir, a:filename, [string(a:keyword_list)])
endfunction"}}}
-function! neocomplcache#cache#save_cache_old(cache_dir, filename, keyword_list)"{{{
+function! neocomplcache#cache#save_cache_old(cache_dir, filename, keyword_list) "{{{
" Create dictionary key.
for keyword in a:keyword_list
if !has_key(keyword, 'abbr')
@@ -145,19 +145,19 @@ function! neocomplcache#cache#save_cache_old(cache_dir, filename, keyword_list)"
endfunction"}}}
" Cache helper.
-function! neocomplcache#cache#getfilename(cache_dir, filename)"{{{
+function! neocomplcache#cache#getfilename(cache_dir, filename) "{{{
let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir
return s:Cache.getfilename(cache_dir, a:filename)
endfunction"}}}
-function! neocomplcache#cache#filereadable(cache_dir, filename)"{{{
+function! neocomplcache#cache#filereadable(cache_dir, filename) "{{{
let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir
return s:Cache.filereadable(cache_dir, a:filename)
endfunction"}}}
-function! neocomplcache#cache#readfile(cache_dir, filename)"{{{
+function! neocomplcache#cache#readfile(cache_dir, filename) "{{{
let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir
return s:Cache.readfile(cache_dir, a:filename)
endfunction"}}}
-function! neocomplcache#cache#writefile(cache_dir, filename, list)"{{{
+function! neocomplcache#cache#writefile(cache_dir, filename, list) "{{{
let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir
return s:Cache.writefile(cache_dir, a:filename, a:list)
endfunction"}}}
@@ -166,7 +166,7 @@ function! neocomplcache#cache#encode_name(cache_dir, filename)
let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir
return s:Cache.getfilename(cache_dir, a:filename)
endfunction
-function! neocomplcache#cache#check_old_cache(cache_dir, filename)"{{{
+function! neocomplcache#cache#check_old_cache(cache_dir, filename) "{{{
let cache_dir = neocomplcache#get_temporary_directory() . '/' . a:cache_dir
return s:Cache.check_old_cache(cache_dir, a:filename)
endfunction"}}}
@@ -175,7 +175,7 @@ let s:sdir = neocomplcache#util#substitute_path_separator(
\ fnamemodify(expand('<sfile>'), ':p:h'))
" Async test.
-function! neocomplcache#cache#test_async()"{{{
+function! neocomplcache#cache#test_async() "{{{
if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename)
return neocomplcache#cache#encode_name(a:cache_dir, a:filename)
endif
@@ -203,7 +203,7 @@ function! neocomplcache#cache#test_async()"{{{
return s:async_load(argv, 'test_cache', filename)
endfunction"}}}
-function! neocomplcache#cache#async_load_from_file(cache_dir, filename, pattern, mark)"{{{
+function! neocomplcache#cache#async_load_from_file(cache_dir, filename, pattern, mark) "{{{
if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename)
return neocomplcache#cache#encode_name(a:cache_dir, a:filename)
endif
@@ -228,7 +228,7 @@ function! neocomplcache#cache#async_load_from_file(cache_dir, filename, pattern,
\ ]
return s:async_load(argv, a:cache_dir, a:filename)
endfunction"}}}
-function! neocomplcache#cache#async_load_from_tags(cache_dir, filename, filetype, mark, is_create_tags)"{{{
+function! neocomplcache#cache#async_load_from_tags(cache_dir, filename, filetype, mark, is_create_tags) "{{{
if !neocomplcache#cache#check_old_cache(a:cache_dir, a:filename)
return neocomplcache#cache#encode_name(a:cache_dir, a:filename)
endif
@@ -249,9 +249,8 @@ function! neocomplcache#cache#async_load_from_tags(cache_dir, filename, filetype
let tags_file_name =
\ neocomplcache#cache#encode_name('tags_output', a:filename)
- let args = has_key(g:neocomplcache_ctags_arguments_list, a:filetype) ?
- \ g:neocomplcache_ctags_arguments_list[a:filetype]
- \ : g:neocomplcache_ctags_arguments_list['default']
+ let default = get(g:neocomplcache_ctags_arguments_list, '_', '')
+ let args = get(g:neocomplcache_ctags_arguments_list, a:filetype, default)
if has('win32') || has('win64')
let filename =
@@ -288,7 +287,7 @@ function! neocomplcache#cache#async_load_from_tags(cache_dir, filename, filetype
\ ]
return s:async_load(argv, a:cache_dir, a:filename)
endfunction"}}}
-function! s:async_load(argv, cache_dir, filename)"{{{
+function! s:async_load(argv, cache_dir, filename) "{{{
" if 0
if neocomplcache#has_vimproc()
let paths = vimproc#get_command_name(v:progname, $PATH, -1)
View
8 vim/bundle/neocomplcache/autoload/neocomplcache/sources/abbrev_complete.vim
@@ -32,14 +32,14 @@ let s:source = {
\ 'kind' : 'plugin',
\}
-function! s:source.initialize()"{{{
+function! s:source.initialize() "{{{
" Initialize.
endfunction"}}}
-function! s:source.finalize()"{{{
+function! s:source.finalize() "{{{
endfunction"}}}
-function! s:source.get_keyword_list(cur_keyword_str)"{{{
+function! s:source.get_keyword_list(cur_keyword_str) "{{{
" Get current abbrev list.
let abbrev_list = ''
redir => abbrev_list
@@ -62,7 +62,7 @@ function! s:source.get_keyword_list(cur_keyword_str)"{{{
return neocomplcache#keyword_filter(list, a:cur_keyword_str)
endfunction"}}}
-function! neocomplcache#sources#abbrev_complete#define()"{{{
+function! neocomplcache#sources#abbrev_complete#define() "{{{
return s:source
endfunction"}}}
View
102 vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: buffer_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Sep 2012.
+" Last Modified: 29 Nov 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
@@ -37,8 +37,8 @@ let s:source = {
\ 'kind' : 'complfunc',
\}
-function! s:source.initialize()"{{{
- augroup neocomplcache"{{{
+function! s:source.initialize() "{{{
+ augroup neocomplcache "{{{
" Caching events
autocmd CursorHold *
\ call s:check_cache()
@@ -46,11 +46,12 @@ function! s:source.initialize()"{{{
\ call s:check_recache()
autocmd InsertEnter,InsertLeave *
\ call s:caching_current_buffer(
- \ line('.') - 1, line('.') + 1, 1)
+ \ line('.') - 1, line('.') + 1)
augroup END"}}}
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_source_rank',
\ 'buffer_complete', 5)
" Create cache directory.
@@ -58,7 +59,7 @@ function! s:source.initialize()"{{{
call mkdir(neocomplcache#get_temporary_directory() . '/buffer_cache', 'p')
endif
- " Initialize script variables."{{{
+ " Initialize script variables. "{{{
let s:buffer_sources = {}
let s:cache_line_count = 70
let s:rank_cache_count = 1
@@ -69,24 +70,11 @@ function! s:source.initialize()"{{{
call neocomplcache#set_completion_length('buffer_complete',
\ g:neocomplcache_auto_completion_start_length)
- " Add commands."{{{
- command! -nargs=? -complete=file -bar
- \ NeoComplCacheCachingBuffer call s:caching_buffer(<q-args>)
- command! -nargs=? -complete=buffer -bar
- \ NeoComplCachePrintSource call s:print_source(<q-args>)
- command! -nargs=? -complete=buffer -bar
- \ NeoComplCacheOutputKeyword call s:output_keyword(<q-args>)
- command! -nargs=? -complete=buffer -bar
- \ NeoComplCacheDisableCaching call s:disable_caching(<q-args>)
- command! -nargs=? -complete=buffer -bar
- \ NeoComplCacheEnableCaching call s:enable_caching(<q-args>)
- "}}}
-
call s:check_source()
endfunction
"}}}
-function! s:source.finalize()"{{{
+function! s:source.finalize() "{{{
delcommand NeoComplCacheCachingBuffer
delcommand NeoComplCachePrintSource
delcommand NeoComplCacheOutputKeyword
@@ -96,13 +84,13 @@ function! s:source.finalize()"{{{
let s:buffer_sources = {}
endfunction"}}}
-function! s:source.get_keyword_pos(cur_text)"{{{
+function! s:source.get_keyword_pos(cur_text) "{{{
let [cur_keyword_pos, _] = neocomplcache#match_word(a:cur_text)
return cur_keyword_pos
endfunction"}}}
-function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
+function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str) "{{{
call s:check_source()
let keyword_list = []
@@ -120,15 +108,15 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
return keyword_list
endfunction"}}}
-function! neocomplcache#sources#buffer_complete#define()"{{{
+function! neocomplcache#sources#buffer_complete#define() "{{{
return s:source
endfunction"}}}
-function! neocomplcache#sources#buffer_complete#caching_current_line()"{{{
+function! neocomplcache#sources#buffer_complete#caching_current_line() "{{{
" Current line caching.
- return s:caching_current_buffer(line('.') - 1, line('.') + 1, 1)
+ return s:caching_current_buffer(line('.') - 1, line('.') + 1)
endfunction"}}}
-function! s:caching_current_buffer(start, end, is_auto)"{{{
+function! s:caching_current_buffer(start, end) "{{{
" Current line caching.
if !s:exists_current_source()
@@ -149,11 +137,11 @@ function! s:caching_current_buffer(start, end, is_auto)"{{{
let completion_length = 2
let line = join(getline(a:start, a:end))
let match = match(line, keyword_pattern)
- while match >= 0"{{{
+ while match >= 0 "{{{
let match_str = matchstr(line, keyword_pattern2, match)
" Ignore too short keyword.
- if len(match_str) >= g:neocomplcache_min_keyword_length"{{{
+ if len(match_str) >= g:neocomplcache_min_keyword_length "{{{
" Check dup.
let key = tolower(match_str[: completion_length-1])
if !has_key(keywords, key)
@@ -163,10 +151,6 @@ function! s:caching_current_buffer(start, end, is_auto)"{{{
" Append list.
let keywords[key][match_str] =
\ { 'word' : match_str, 'menu' : menu, 'rank' : 0 }
- if a:is_auto
- " Save line number.
- let keywords[key][match_str].line = a:start
- endif
endif
endif"}}}
@@ -175,7 +159,7 @@ function! s:caching_current_buffer(start, end, is_auto)"{{{
endwhile"}}}
endfunction"}}}
-function! s:get_sources_list()"{{{
+function! s:get_sources_list() "{{{
let sources_list = []
let filetypes_dict = {}
@@ -196,7 +180,7 @@ function! s:get_sources_list()"{{{
return sources_list
endfunction"}}}
-function! s:initialize_source(srcname)"{{{
+function! s:initialize_source(srcname) "{{{
let path = fnamemodify(bufname(a:srcname), ':p')
let filename = fnamemodify(path, ':t')
if filename == ''
@@ -225,7 +209,7 @@ function! s:initialize_source(srcname)"{{{
\}
endfunction"}}}
-function! s:word_caching(srcname)"{{{
+function! s:word_caching(srcname) "{{{
" Initialize source.
call s:initialize_source(a:srcname)
@@ -235,7 +219,7 @@ function! s:word_caching(srcname)"{{{
\ || getbufvar(a:srcname, '&buftype') =~ 'nofile'
if a:srcname == bufnr('%')
" Make buffer cache.
- call s:caching_current_buffer(1, min([1000, line('$')]), 0)
+ call s:caching_current_buffer(1, min([1000, line('$')]))
endif
return
@@ -253,7 +237,7 @@ function! s:word_caching(srcname)"{{{
\ }]
endfunction"}}}
-function! s:check_changed_buffer(bufnumber)"{{{
+function! s:check_changed_buffer(bufnumber) "{{{
let source = s:buffer_sources[a:bufnumber]
let ft = getbufvar(a:bufnumber, '&filetype')
@@ -270,7 +254,7 @@ function! s:check_changed_buffer(bufnumber)"{{{
\ || s:buffer_sources[a:bufnumber].filetype != ft
endfunction"}}}
-function! s:check_source()"{{{
+function! s:check_source() "{{{
let bufnumber = bufnr('%')
" Check new buffer.
@@ -295,7 +279,7 @@ function! s:check_source()"{{{
call neocomplcache#cache#check_cache_list('buffer_cache',
\ source.path, s:async_dictionary_list, source.keyword_cache)
endfunction"}}}
-function! s:check_cache()"{{{
+function! s:check_cache() "{{{
let release_accessd_time =
\ localtime() - g:neocomplcache_release_cache_time
@@ -308,23 +292,8 @@ function! s:check_cache()"{{{
call remove(s:buffer_sources, key)
endif
endfor
-
- if !s:exists_current_source()
- return
- endif
-
- let bufnumber = bufnr('%')
- let source = s:buffer_sources[bufnumber]
-
- " Check current line caching.
- for cache in values(source.keyword_cache)
- call filter(cache, "!has_key(v:val, 'line')
- \ || stridx(getline(v:val.line), v:val.word) >= 0
- \ || search('\\<'.neocomplcache#util#escape_pattern(
- \ v:val.word).'\\>', 'wn', 0, 300) > 0")
- endfor
endfunction"}}}
-function! s:check_recache()"{{{
+function! s:check_recache() "{{{
if !s:exists_current_source()
return
endif
@@ -337,23 +306,18 @@ function! s:check_recache()"{{{
" Check buffer access time.
if source.cached_time > 0 &&
\ (source.cached_time < release_accessd_time
- \ || (abs(source.end_line - line('$')) * 10)/source.end_line > 1)
- " Member recache.
- if neocomplcache#is_source_enabled('member_complete')
- call neocomplcache#sources#member_complete#caching_current_buffer()
- endif
-
+ \ || (neocomplcache#util#has_vimproc() && line('$') != source.end_line))
" Buffer recache.
call s:word_caching(bufnr('%'))
endif
endfunction"}}}
-function! s:exists_current_source()"{{{
+function! s:exists_current_source() "{{{
return has_key(s:buffer_sources, bufnr('%'))
endfunction"}}}
-" Command functions."{{{
-function! s:caching_buffer(name)"{{{
+" Command functions. "{{{
+function! neocomplcache#sources#buffer_complete#caching_buffer(name) "{{{
if a:name == ''
let number = bufnr('%')
else
@@ -382,9 +346,9 @@ function! s:caching_buffer(name)"{{{
" Word recaching.
call s:word_caching(number)
- call s:caching_current_buffer(1, line('$'), 0)
+ call s:caching_current_buffer(1, line('$'))
endfunction"}}}
-function! s:print_source(name)"{{{
+function! neocomplcache#sources#buffer_complete#print_source(name) "{{{
if a:name == ''
let number = bufnr('%')
else
@@ -405,7 +369,7 @@ function! s:print_source(name)"{{{
silent put =printf('%s => %s', key, string(s:buffer_sources[number][key]))
endfor
endfunction"}}}
-function! s:output_keyword(name)"{{{
+function! neocomplcache#sources#buffer_complete#output_keyword(name) "{{{
if a:name == ''
let number = bufnr('%')
else
@@ -427,7 +391,7 @@ function! s:output_keyword(name)"{{{
silent put=string(keyword)
endfor
endfunction "}}}
-function! s:disable_caching(name)"{{{
+function! neocomplcache#sources#buffer_complete#disable_caching(name) "{{{
if a:name == ''
let number = bufnr('%')
else
@@ -446,7 +410,7 @@ function! s:disable_caching(name)"{{{
call remove(s:buffer_sources, number)
endif
endfunction"}}}
-function! s:enable_caching(name)"{{{
+function! neocomplcache#sources#buffer_complete#enable_caching(name) "{{{
if a:name == ''
let number = bufnr('%')
else
View
42 vim/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: dictionary_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Sep 2012.
+" Last Modified: 17 Nov 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
@@ -27,7 +27,13 @@
let s:save_cpo = &cpo
set cpo&vim
-function! neocomplcache#sources#dictionary_complete#define()"{{{
+" Important variables.
+if !exists('s:dictionary_list')
+ let s:dictionary_list = {}
+ let s:async_dictionary_list = {}
+endif
+
+function! neocomplcache#sources#dictionary_complete#define() "{{{
return s:source
endfunction"}}}
@@ -36,12 +42,8 @@ let s:source = {
\ 'kind' : 'plugin',
\}
-function! s:source.initialize()"{{{
- " Initialize.
- let s:dictionary_list = {}
- let s:async_dictionary_list = {}
-
- " Initialize dictionary."{{{
+function! s:source.initialize() "{{{
+ " Initialize dictionary. "{{{
if !exists('g:neocomplcache_dictionary_filetype_lists')
let g:neocomplcache_dictionary_filetype_lists = {}
endif
@@ -50,7 +52,7 @@ function! s:source.initialize()"{{{
endif
"}}}
- " Initialize dictionary completion pattern."{{{
+ " Initialize dictionary completion pattern. "{{{
if !exists('g:neocomplcache_dictionary_patterns')
let g:neocomplcache_dictionary_patterns = {}
endif
@@ -59,14 +61,10 @@ function! s:source.initialize()"{{{
" Set caching event.
autocmd neocomplcache FileType * call s:caching()
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_source_rank,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_source_rank',
\ 'dictionary_complete', 4)
- " Add command.
- command! -nargs=? -complete=customlist,neocomplcache#filetype_complete
- \ NeoComplCacheCachingDictionary call s:recaching(<q-args>)
-
" Create cache directory.
if !isdirectory(neocomplcache#get_temporary_directory() . '/dictionary_cache')
call mkdir(neocomplcache#get_temporary_directory() . '/dictionary_cache')
@@ -76,11 +74,11 @@ function! s:source.initialize()"{{{
call s:caching()
endfunction"}}}
-function! s:source.finalize()"{{{
+function! s:source.finalize() "{{{
delcommand NeoComplCacheCachingDictionary
endfunction"}}}
-function! s:source.get_keyword_list(cur_keyword_str)"{{{
+function! s:source.get_keyword_list(cur_keyword_str) "{{{
let list = []
let filetype = neocomplcache#is_text_mode() ?
@@ -102,7 +100,7 @@ function! s:source.get_keyword_list(cur_keyword_str)"{{{
return list
endfunction"}}}
-function! s:caching()"{{{
+function! s:caching() "{{{
if !bufloaded(bufnr('%'))
return
endif
@@ -112,7 +110,7 @@ function! s:caching()"{{{
for filetype in neocomplcache#get_source_filetypes(key)
if !has_key(s:dictionary_list, filetype)
\ && !has_key(s:async_dictionary_list, filetype)
- call s:recaching(filetype)
+ call neocomplcache#sources#dictionary_complete#recaching(filetype)
endif
endfor
endfunction"}}}
@@ -129,9 +127,9 @@ function! s:caching_dictionary(filetype)
call delete(s:async_dictionary_list[filetype].cache_name)
endif
- call s:recaching(filetype)
+ call neocomplcache#sources#dictionary_complete#recaching(filetype)
endfunction
-function! s:recaching(filetype)"{{{
+function! neocomplcache#sources#dictionary_complete#recaching(filetype) "{{{
let filetype = a:filetype
if filetype == ''
let filetype = neocomplcache#get_context_filetype(1)
@@ -157,6 +155,8 @@ function! s:recaching(filetype)"{{{
let pattern = get(g:neocomplcache_dictionary_patterns, filetype,
\ neocomplcache#get_keyword_pattern(filetype))
for dictionary in split(dictionaries, ',')
+ let dictionary = neocomplcache#util#substitute_path_separator(
+ \ fnamemodify(dictionary, ':p'))
if filereadable(dictionary)
call neocomplcache#print_debug('Caching dictionary: ' . dictionary)
call add(s:async_dictionary_list[filetype], {
View
222 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: filename_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 04 Sep 2012.
+" Last Modified: 24 Nov 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
@@ -27,119 +27,41 @@
let s:save_cpo = &cpo
set cpo&vim
-" Global options definition."{{{
-if !exists('g:neocomplcache_include_patterns')
- let g:neocomplcache_include_patterns = {}
-endif
-if !exists('g:neocomplcache_include_exprs')
- let g:neocomplcache_include_exprs = {}
-endif
-if !exists('g:neocomplcache_include_paths')
- let g:neocomplcache_include_paths = {}
-endif
-if !exists('g:neocomplcache_include_suffixes')
- let g:neocomplcache_include_suffixes = {}
-endif
-"}}}
-
let s:source = {
\ 'name' : 'filename_complete',
\ 'kind' : 'complfunc',
\}
-function! s:source.initialize()"{{{
+function! s:source.initialize() "{{{
" Initialize.
call neocomplcache#set_completion_length(
\ 'filename_complete', g:neocomplcache_auto_completion_start_length)
- " Set filename pattern.
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_keyword_patterns,
- \'filename',
- \ neocomplcache#util#is_windows() ?
- \'\%(\a\+:[/\\]\)\?[\\/[:alnum:]()$+_\~.-]\+' :
- \'\%(\\.\|[/\[\][:alnum:]()$+_\~.-]\)\+')
-
- " Initialize filename include expr."{{{
- let g:neocomplcache_filename_include_exprs =
- \ get(g:, 'neocomplcache_filename_include_exprs', {})
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_filename_include_exprs,
- \ 'perl',
- \ 'fnamemodify(substitute(v:fname, "/", "::", "g"), ":r")')
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_filename_include_exprs,
- \ 'ruby,python,java,d',
- \ 'fnamemodify(substitute(v:fname, "/", ".", "g"), ":r")')
- "}}}
-
- " Initialize filename include extensions."{{{
- let g:neocomplcache_filename_include_exts =
- \ get(g:, 'neocomplcache_filename_include_exts', {})
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_filename_include_exts,
- \ 'c', ['h'])
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_filename_include_exts,
- \ 'cpp', ['', 'h', 'hpp', 'hxx'])
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_filename_include_exts,
- \ 'perl', ['pm'])
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_filename_include_exts,
- \ 'java', ['java'])
- "}}}
-
" Set rank.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_source_rank,
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_source_rank',
\ 'filename_complete', 3)
endfunction"}}}
-function! s:source.finalize()"{{{
+function! s:source.finalize() "{{{
endfunction"}}}
-function! s:source.get_keyword_pos(cur_text)"{{{
+function! s:source.get_keyword_pos(cur_text) "{{{
let filetype = neocomplcache#get_context_filetype()
if filetype ==# 'vimshell' || filetype ==# 'unite'
return -1
endif
- " Not Filename pattern.
- if exists('g:neocomplcache_include_patterns')
- let pattern = get(g:neocomplcache_include_patterns, filetype,
- \ getbufvar(bufnr('%'), '&include'))
- else
- let pattern = ''
- endif
- if neocomplcache#is_auto_complete()
- \ && (pattern == '' || a:cur_text !~ pattern)
- \ && a:cur_text =~ '\*$\|\.\.\+$\|/c\%[ygdrive/]$'
- " Skip filename completion.
+ " Filename pattern.
+ let pattern = neocomplcache#get_keyword_pattern_end('filename')
+ let [cur_keyword_pos, cur_keyword_str] =
+ \ neocomplcache#match_word(a:cur_text, pattern)
+ if cur_keyword_str =~ '//' ||
+ \ (neocomplcache#is_auto_complete() &&
+ \ cur_keyword_str =~# '\*\|\.\.\+$\|/c\%[ygdrive/]$')
+ " Not filename pattern.
return -1
endif
- " Check include pattern.
- let pattern = get(g:neocomplcache_include_patterns, filetype,
- \ getbufvar(bufnr('%'), '&include'))
- if pattern == '' || a:cur_text !~ pattern
- " Filename pattern.
- let pattern = neocomplcache#get_keyword_pattern_end('filename')
- let [cur_keyword_pos, _] =
- \ neocomplcache#match_word(a:cur_text, pattern)
- else
- let match_end = matchend(a:cur_text, pattern)
- let cur_keyword_str = matchstr(a:cur_text[match_end :], '\f\+')
-
- let expr = get(g:neocomplcache_include_exprs, filetype,
- \ getbufvar(bufnr('%'), '&includeexpr'))
- if expr != ''
- let cur_text =
- \ substitute(eval(substitute(expr,
- \ 'v:fname', string(cur_keyword_str), 'g')),
- \ '\.\w*$', '', '')
- endif
-
- let cur_keyword_pos = len(a:cur_text) - len(cur_keyword_str)
- endif
if neocomplcache#is_sources_complete() && cur_keyword_pos < 0
let cur_keyword_pos = len(a:cur_text)
endif
@@ -147,111 +69,13 @@ function! s:source.get_keyword_pos(cur_text)"{{{
return cur_keyword_pos
endfunction"}}}
-function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
- let filetype = neocomplcache#get_context_filetype()
- if !exists('g:neocomplcache_include_patterns')
- return s:get_glob_files(a:cur_keyword_str, '')
- endif
-
- " Check include pattern.
- let pattern = get(g:neocomplcache_include_patterns, filetype,
- \ getbufvar(bufnr('%'), '&include'))
- let line = neocomplcache#get_cur_text()
- return (pattern == '' || line !~ 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 filetype = neocomplcache#get_context_filetype()
-
- let path = neocomplcache#util#substitute_path_separator(
- \ get(g:neocomplcache_include_paths, filetype,
- \ getbufvar(bufnr('%'), '&path')))
- let pattern = get(g:neocomplcache_include_patterns, filetype,
- \ getbufvar(bufnr('%'), '&include'))
- let expr = get(g:neocomplcache_include_exprs, filetype,
- \ getbufvar(bufnr('%'), '&includeexpr'))
- let reverse_expr = get(g:neocomplcache_filename_include_exprs, filetype,
- \ '')
- let exts = get(g:neocomplcache_filename_include_exts, filetype,
- \ [])
- let line = neocomplcache#get_cur_text()
- let match_end = matchend(line, pattern)
- let cur_keyword_str = matchstr(line[match_end :], '\f\+')
- if expr != ''
- let cur_keyword_str =
- \ substitute(eval(substitute(expr,
- \ 'v:fname', string(cur_keyword_str), 'g')), '\.\w*$', '', '')
- endif
-
- " Path search.
- let glob = (cur_keyword_str !~ '\*$')?
- \ cur_keyword_str . '*' : cur_keyword_str
- let cwd = getcwd()
- let bufdirectory = neocomplcache#util#substitute_path_separator(
- \ fnamemodify(expand('%'), ':p:h'))
- let dir_list = []
- let file_list = s:get_default_include_files(filetype)
- for subpath in split(path, '[,;]')
- let dir = (subpath == '.') ? bufdirectory : subpath
- if !isdirectory(dir)
- continue
- endif
-
- lcd `=dir`
-
- for word in split(
- \ neocomplcache#util#substitute_path_separator(
- \ glob(glob)), '\n')
- let dict = { 'word' : word, 'menu' : '[FI]' }
-
- call add(isdirectory(word) ? dir_list : file_list, dict)
-
- let abbr = dict.word
- if isdirectory(word)
- let abbr .= '/'
- if g:neocomplcache_enable_auto_delimiter
- let dict.word .= '/'
- endif
- elseif !empty(exts) &&
- \ index(exts, fnamemodify(dict.word, ':e')) < 0
- " Skip.
- continue
- endif
- let dict.abbr = abbr
-
- if reverse_expr != ''
- " Convert filename.
- let dict.word = eval(substitute(reverse_expr,
- \ 'v:fname', string(dict.word), 'g'))
- let dict.abbr = eval(substitute(reverse_expr,
- \ 'v:fname', string(dict.abbr), 'g'))
- else
- " Escape word.
- let dict.word = escape(dict.word, ' ;*?[]"={}''')
- endif
- endfor
- endfor
- lcd `=cwd`
-
- return neocomplcache#keyword_filter(dir_list, a:cur_keyword_str)
- \ + neocomplcache#keyword_filter(file_list, a:cur_keyword_str)
-endfunction"}}}
-
-function! s:get_default_include_files(filetype)"{{{
- let files = []
-
- if a:filetype ==# 'python' || a:filetype ==# 'python3'
- let files = ['sys']
- endif
-
- return map(files, "{ 'word' : v:val, 'menu' : '[FI]' }")
+function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str) "{{{
+ return s:get_glob_files(a:cur_keyword_str, '')
endfunction"}}}
let s:cached_files = {}
-function! s:get_glob_files(cur_keyword_str, path)"{{{
+function! s:get_glob_files(cur_keyword_str, path) "{{{
let path = ',,' . substitute(a:path, '\.\%(,\|$\)\|,,', '', 'g')
let cur_keyword_str = substitute(a:cur_keyword_str,
@@ -371,18 +195,22 @@ function! s:get_glob_files(cur_keyword_str, path)"{{{
return dir_list + file_list
endfunction"}}}
-function! s:caching_current_files()
+function! s:caching_current_files() "{{{
let s:cached_files[getcwd()] = neocomplcache#util#glob('*')
if !exists('vimproc#readdir')
let s:cached_files[getcwd()] += neocomplcache#util#glob('.*')
endif
-endfunction
+endfunction"}}}
-function! neocomplcache#sources#filename_complete#define()"{{{
+function! neocomplcache#sources#filename_complete#define() "{{{
return s:source
endfunction"}}}
-function! neocomplcache#sources#filename_complete#get_complete_words(cur_keyword_str, path)"{{{
+function! neocomplcache#sources#filename_complete#get_complete_words(cur_keyword_str, path) "{{{
+ if !neocomplcache#is_enabled()
+ return []
+ endif
+
return s:get_glob_files(a:cur_keyword_str, a:path)
endfunction"}}}
View
241 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_include.vim
@@ -0,0 +1,241 @@
+"=============================================================================
+" FILE: filename_include.vim
+" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
+" Last Modified: 17 Nov 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
+" "Software"), to deal in the Software without restriction, including
+" without limitation the rights to use, copy, modify, merge, publish,
+" distribute, sublicense, and/or sell copies of the Software, and to
+" permit persons to whom the Software is furnished to do so, subject to
+" the following conditions:
+"
+" The above copyright notice and this permission notice shall be included
+" in all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+" }}}
+"=============================================================================
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+" Global options definition. "{{{
+if !exists('g:neocomplcache_include_patterns')
+ let g:neocomplcache_include_patterns = {}
+endif
+if !exists('g:neocomplcache_include_exprs')
+ let g:neocomplcache_include_exprs = {}
+endif
+if !exists('g:neocomplcache_include_paths')
+ let g:neocomplcache_include_paths = {}
+endif
+if !exists('g:neocomplcache_include_suffixes')
+ let g:neocomplcache_include_suffixes = {}
+endif
+"}}}
+
+let s:source = {
+ \ 'name' : 'filename_include',
+ \ 'kind' : 'complfunc',
+ \}
+
+function! s:source.initialize() "{{{
+ " Initialize.
+ call neocomplcache#set_completion_length(
+ \ s:source.name, g:neocomplcache_auto_completion_start_length)
+
+ " Initialize filename include expr. "{{{
+ let g:neocomplcache_filename_include_exprs =
+ \ get(g:, 'neocomplcache_filename_include_exprs', {})
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_filename_include_exprs',
+ \ 'perl',
+ \ 'fnamemodify(substitute(v:fname, "/", "::", "g"), ":r")')
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_filename_include_exprs',
+ \ 'ruby,python,java,d',
+ \ 'fnamemodify(substitute(v:fname, "/", ".", "g"), ":r")')
+ "}}}
+
+ " Initialize filename include extensions. "{{{
+ let g:neocomplcache_filename_include_exts =
+ \ get(g:, 'neocomplcache_filename_include_exts', {})
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_filename_include_exts',
+ \ 'c', ['h'])
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_filename_include_exts',
+ \ 'cpp', ['', 'h', 'hpp', 'hxx'])
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_filename_include_exts',
+ \ 'perl', ['pm'])
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_filename_include_exts',
+ \ 'java', ['java'])
+ "}}}
+
+ " Set rank.
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_source_rank',
+ \ s:source.name, 10)
+endfunction"}}}
+function! s:source.finalize() "{{{
+endfunction"}}}
+
+function! s:source.get_keyword_pos(cur_text) "{{{
+ let filetype = neocomplcache#get_context_filetype()
+
+ " Not Filename pattern.
+ if exists('g:neocomplcache_include_patterns')
+ let pattern = get(g:neocomplcache_include_patterns, filetype,
+ \ getbufvar(bufnr('%'), '&include'))
+ else
+ let pattern = ''
+ endif
+ if neocomplcache#is_auto_complete()
+ \ && (pattern == '' || a:cur_text !~ pattern)
+ \ && a:cur_text =~ '\*$\|\.\.\+$\|/c\%[ygdrive/]$'
+ " Skip filename completion.
+ return -1
+ endif
+
+ " Check include pattern.
+ let pattern = get(g:neocomplcache_include_patterns, filetype,
+ \ getbufvar(bufnr('%'), '&include'))
+ if pattern == '' || a:cur_text !~ pattern
+ return -1
+ endif
+
+ let match_end = matchend(a:cur_text, pattern)
+ let cur_keyword_str = matchstr(a:cur_text[match_end :], '\f\+')
+
+ let expr = get(g:neocomplcache_include_exprs, filetype,
+ \ getbufvar(bufnr('%'), '&includeexpr'))
+ if expr != ''
+ let cur_text =
+ \ substitute(eval(substitute(expr,
+ \ 'v:fname', string(cur_keyword_str), 'g')),
+ \ '\.\w*$', '', '')
+ endif
+
+ let cur_keyword_pos = len(a:cur_text) - len(cur_keyword_str)
+ if neocomplcache#is_sources_complete() && cur_keyword_pos < 0
+ let cur_keyword_pos = len(a:cur_text)
+ endif
+
+ return cur_keyword_pos
+endfunction"}}}
+
+function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str) "{{{
+ return s:get_include_files(a:cur_keyword_str)
+endfunction"}}}
+
+function! s:get_include_files(cur_keyword_str) "{{{
+ let filetype = neocomplcache#get_context_filetype()
+
+ let path = neocomplcache#util#substitute_path_separator(
+ \ get(g:neocomplcache_include_paths, filetype,
+ \ getbufvar(bufnr('%'), '&path')))
+ let pattern = get(g:neocomplcache_include_patterns, filetype,
+ \ getbufvar(bufnr('%'), '&include'))
+ let expr = get(g:neocomplcache_include_exprs, filetype,
+ \ getbufvar(bufnr('%'), '&includeexpr'))
+ let reverse_expr = get(g:neocomplcache_filename_include_exprs, filetype,
+ \ '')
+ let exts = get(g:neocomplcache_filename_include_exts, filetype,
+ \ [])
+
+ let line = neocomplcache#get_cur_text()
+ if line =~ '^\s*\<require_relative\>' && &filetype =~# 'ruby'
+ " For require_relative.
+ let path = '.'
+ endif
+
+ let match_end = matchend(line, pattern)
+ let cur_keyword_str = matchstr(line[match_end :], '\f\+')
+ if expr != ''
+ let cur_keyword_str =
+ \ substitute(eval(substitute(expr,
+ \ 'v:fname', string(cur_keyword_str), 'g')), '\.\w*$', '', '')
+ endif
+
+ " Path search.
+ let glob = (cur_keyword_str !~ '\*$')?
+ \ cur_keyword_str . '*' : cur_keyword_str
+ let cwd = getcwd()
+ let bufdirectory = neocomplcache#util#substitute_path_separator(
+ \ fnamemodify(expand('%'), ':p:h'))
+ let dir_list = []
+ let file_list = s:get_default_include_files(filetype)
+ for subpath in split(path, '[,;]')
+ let dir = (subpath == '.') ? bufdirectory : subpath
+ if !isdirectory(dir)
+ continue
+ endif
+
+ execute 'lcd' fnameescape(dir)
+
+ for word in split(
+ \ neocomplcache#util#substitute_path_separator(
+ \ glob(glob)), '\n')
+ let dict = { 'word' : word, 'menu' : '[FI]' }
+
+ call add(isdirectory(word) ? dir_list : file_list, dict)
+
+ let abbr = dict.word
+ if isdirectory(word)
+ let abbr .= '/'
+ if g:neocomplcache_enable_auto_delimiter
+ let dict.word .= '/'
+ endif
+ elseif !empty(exts) &&
+ \ index(exts, fnamemodify(dict.word, ':e')) < 0
+ " Skip.
+ continue
+ endif
+ let dict.abbr = abbr
+
+ if reverse_expr != ''
+ " Convert filename.
+ let dict.word = eval(substitute(reverse_expr,
+ \ 'v:fname', string(dict.word), 'g'))
+ let dict.abbr = eval(substitute(reverse_expr,
+ \ 'v:fname', string(dict.abbr), 'g'))
+ else
+ " Escape word.
+ let dict.word = escape(dict.word, ' ;*?[]"={}''')
+ endif
+ endfor
+ endfor
+ execute 'lcd' fnameescape(cwd)
+
+ return neocomplcache#keyword_filter(dir_list, a:cur_keyword_str)
+ \ + neocomplcache#keyword_filter(file_list, a:cur_keyword_str)
+endfunction"}}}
+
+function! s:get_default_include_files(filetype) "{{{
+ let files = []
+
+ if a:filetype ==# 'python' || a:filetype ==# 'python3'
+ let files = ['sys']
+ endif
+
+ return map(files, "{ 'word' : v:val, 'menu' : '[FI]' }")
+endfunction"}}}
+
+function! neocomplcache#sources#filename_include#define() "{{{
+ return s:source
+endfunction"}}}
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: foldmethod=marker
View
171 vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: include_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Sep 2012.
+" Last Modified: 17 Nov 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
@@ -27,86 +27,89 @@
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
+if !exists('s:include_info')
let s:include_info = {}
let s:include_cache = {}
let s:cache_accessed_time = {}
let s:async_include_cache = {}
let s:cached_pattern = {}
- " Set rank.
- call neocomplcache#set_dictionary_helper(
- \ g:neocomplcache_source_rank, 'include_complete', 8)
-
- if neocomplcache#has_vimproc()
- augroup neocomplcache
- " Caching events
- autocmd BufWritePost * call s:check_buffer('', 0)
- autocmd CursorHold * call s:check_cache()
- augroup END
- endif
-
- " Initialize include pattern."{{{
+ " Initialize include pattern. "{{{
let g:neocomplcache_include_patterns =
\ get(g:, 'neocomplcache_include_patterns', {})
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_patterns,
- \ 'java,haskell', '\<import')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_patterns,
- \ 'cs', '\<using')
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_include_patterns',
+ \ 'java,haskell', '^\s*\<import')
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_include_patterns',
+ \ 'cs', '^\s*\<using')
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_include_patterns',
+ \ 'ruby', '^\s*\<\%(load\|require\|require_relative\)\>')
"}}}
- " Initialize expr pattern."{{{
- let g:neocomplcache_include_exprs =
- \ get(g:, 'neocomplcache_include_exprs', {})
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_exprs,
+ " Initialize expr pattern. "{{{
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_include_exprs', {})
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_include_exprs',
\ 'haskell,cs',
\ "substitute(v:fname, '\\.', '/', 'g')")
"}}}
- " Initialize path pattern."{{{
- let g:neocomplcache_include_paths =
- \ get(g:, 'neocomplcache_include_paths', {})
+ " Initialize path pattern. "{{{
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_include_paths', {})
"}}}
- " Initialize include suffixes."{{{
- let g:neocomplcache_include_suffixes =
- \ get(g:, 'neocomplcache_include_suffixes', {})
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_suffixes,
+ " Initialize include suffixes. "{{{
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_include_suffixes', {})
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_include_suffixes',
\ 'haskell', '.hs')
"}}}
- " Initialize include functions."{{{
- let g:neocomplcache_include_functions =
- \ get(g:, 'neocomplcache_include_functions', {})
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_functions,
- \ 'vim', 'neocomplcache#sources#include_complete#analyze_vim_include_files')
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_functions,
- \ 'ruby', 'neocomplcache#sources#include_complete#analyze_ruby_include_files')
+ " Initialize include functions. "{{{
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_include_functions', {})
+ " call neocomplcache#util#set_default_dictionary(
+ " \ 'g:neocomplcache_include_functions', 'vim',
+ " \ 'neocomplcache#sources#include_complete#analyze_vim_include_files')
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_include_functions', 'ruby',
+ \ 'neocomplcache#sources#include_complete#analyze_ruby_include_files')
"}}}
+endif
+
+let s:source = {
+ \ 'name' : 'include_complete',
+ \ 'kind' : 'plugin',
+ \}
- if !exists('g:neocomplcache_include_max_processes')
- let g:neocomplcache_include_max_processes = 20
+function! s:source.initialize() "{{{
+ " Set rank.
+ call neocomplcache#util#set_default_dictionary(
+ \ 'g:neocomplcache_source_rank', 'include_complete', 8)
+
+ if neocomplcache#has_vimproc()
+ augroup neocomplcache
+ " Caching events
+ autocmd BufWritePost * call s:check_buffer('', 0)
+ autocmd CursorHold * call s:check_cache()
+ augroup END
endif
+ call neocomplcache#util#set_default(
+ \ 'g:neocomplcache_include_max_processes', 20)
+
" Create cache directory.
if !isdirectory(neocomplcache#get_temporary_directory() . '/include_cache')
call mkdir(neocomplcache#get_temporary_directory() . '/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()"{{{
+function! s:source.finalize() "{{{
delcommand NeoComplCacheCachingInclude
if neocomplcache#exists_echodoc()
@@ -114,7 +117,7 @@ function! s:source.finalize()"{{{
endif
endfunction"}}}
-function! s:source.get_keyword_list(cur_keyword_str)"{{{
+function! s:source.get_keyword_list(cur_keyword_str) "{{{
if neocomplcache#within_comment()
return []
endif
@@ -137,39 +140,41 @@ function! s:source.get_keyword_list(cur_keyword_str)"{{{
endif
endfor
- return neocomplcache#keyword_filter(neocomplcache#dup_filter(keyword_list), a:cur_keyword_str)
+ return neocomplcache#keyword_filter(
+ \ neocomplcache#dup_filter(keyword_list), a:cur_keyword_str)
endfunction"}}}
-function! neocomplcache#sources#include_complete#define()"{{{
+function! neocomplcache#sources#include_complete#define() "{{{
return s:source
endfunction"}}}
-function! neocomplcache#sources#include_complete#get_include_files(bufnumber)"{{{
+function! neocomplcache#sources#include_complete#get_include_files(bufnumber) "{{{
if has_key(s:include_info, a:bufnumber)
return copy(s:include_info[a:bufnumber].include_files)
else
- return []
+ return s:get_buffer_include_files(a:bufnumber)
endif
endfunction"}}}
-function! neocomplcache#sources#include_complete#get_include_tags(bufnumber)"{{{
- return filter(map(neocomplcache#sources#include_complete#get_include_files(a:bufnumber),
+function! neocomplcache#sources#include_complete#get_include_tags(bufnumber) "{{{
+ return filter(map(