Skip to content
Browse files

installed powerline

  • Loading branch information...
1 parent 078a522 commit b1a0be48e38814bab3a2f83a4ac87c2917f99319 Tammer Saleh committed Sep 13, 2012
Showing with 4,081 additions and 535 deletions.
  1. +142 −110 vim/bundle/ctrlp.vim/autoload/ctrlp.vim
  2. +1 −1 vim/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim
  3. +2 −1 vim/bundle/ctrlp.vim/autoload/ctrlp/tag.vim
  4. +47 −13 vim/bundle/ctrlp.vim/doc/ctrlp.txt
  5. +128 −79 vim/bundle/neocomplcache/autoload/neocomplcache.vim
  6. +8 −5 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
  7. +28 −58 vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
  8. +26 −9 vim/bundle/neocomplcache/autoload/neocomplcache/sources/filename_complete.vim
  9. +25 −12 vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
  10. +7 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
  11. +2 −2 vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
  12. +9 −5 vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/helper.vim
  13. +7 −3 vim/bundle/neocomplcache/autoload/neocomplcache/util.vim
  14. +194 −226 vim/bundle/neocomplcache/doc/neocomplcache.txt
  15. +1 −2 vim/bundle/neocomplcache/plugin/neocomplcache.vim
  16. +3 −0 vim/bundle/tcomment_vim/.gitignore
  17. +3 −1 vim/bundle/tcomment_vim/autoload/tcomment.vim
  18. +25 −4 vim/bundle/vim-fugitive/plugin/fugitive.vim
  19. +1 −2 vim/bundle/vim-git/ftdetect/git.vim
  20. +2 −0 vim/bundle/vim-powerline/.gitignore
  21. +107 −0 vim/bundle/vim-powerline/README.rst
  22. +183 −0 vim/bundle/vim-powerline/autoload/Pl.vim
  23. +145 −0 vim/bundle/vim-powerline/autoload/Pl/Colorscheme.vim
  24. +140 −0 vim/bundle/vim-powerline/autoload/Pl/Hi.vim
  25. +43 −0 vim/bundle/vim-powerline/autoload/Pl/Match.vim
  26. +40 −0 vim/bundle/vim-powerline/autoload/Pl/Mod.vim
  27. +371 −0 vim/bundle/vim-powerline/autoload/Pl/Parser.vim
  28. +188 −0 vim/bundle/vim-powerline/autoload/Pl/Segment.vim
  29. +100 −0 vim/bundle/vim-powerline/autoload/Pl/Theme.vim
  30. +166 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/default.vim
  31. +192 −0 vim/bundle/vim-powerline/autoload/Powerline/Colorschemes/skwp.vim
  32. +141 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions.vim
  33. +12 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/ft_man.vim
  34. +7 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/fugitive.vim
  35. +17 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/hgrev.vim
  36. +16 −0 vim/bundle/vim-powerline/autoload/Powerline/Functions/syntastic.vim
  37. +13 −0 vim/bundle/vim-powerline/autoload/Powerline/Matches.vim
  38. +30 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments.vim
  39. +20 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/ctrlp.vim
  40. +3 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/ft_man.vim
  41. +5 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/fugitive.vim
  42. +4 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/hgrev.vim
  43. +6 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/rvm.vim
  44. +5 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/syntastic.vim
  45. +6 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/tagbar.vim
  46. +5 −0 vim/bundle/vim-powerline/autoload/Powerline/Segments/virtualenv.vim
  47. +116 −0 vim/bundle/vim-powerline/autoload/Powerline/Themes/default.vim
  48. +116 −0 vim/bundle/vim-powerline/autoload/Powerline/Themes/skwp.vim
  49. +429 −0 vim/bundle/vim-powerline/doc/Powerline.txt
  50. +319 −0 vim/bundle/vim-powerline/fontpatcher/PowerlineSymbols.sfd
  51. +164 −0 vim/bundle/vim-powerline/fontpatcher/README.rst
  52. +240 −0 vim/bundle/vim-powerline/fontpatcher/fontpatcher
  53. +69 −0 vim/bundle/vim-powerline/plugin/Powerline.vim
  54. +1 −0 vim/update_bundles
  55. +1 −0 vim/vimrc
View
252 vim/bundle/ctrlp.vim/autoload/ctrlp.vim
@@ -61,7 +61,7 @@ let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
\ 'extensions': ['s:extensions', []],
\ 'follow_symlinks': ['s:folsym', 0],
\ 'highlight_match': ['s:mathi', [1, 'CtrlPMatch']],
- \ 'jump_to_buffer': ['s:jmptobuf', 2],
+ \ 'jump_to_buffer': ['s:jmptobuf', 'Et'],
\ 'lazy_update': ['s:lazy', 0],
\ 'match_func': ['s:matcher', {}],
\ 'match_window_bottom': ['s:mwbottom', 1],
@@ -154,22 +154,6 @@ let s:fpats = {
\ '^\S\\?$': '\\?',
\ }
-" Specials
-let s:prtunmaps = [
- \ 'PrtBS()',
- \ 'PrtDelete()',
- \ 'PrtDeleteWord()',
- \ 'PrtClear()',
- \ 'PrtCurStart()',
- \ 'PrtCurEnd()',
- \ 'PrtCurLeft()',
- \ 'PrtCurRight()',
- \ 'PrtHistory(-1)',
- \ 'PrtHistory(1)',
- \ 'PrtInsert("c")',
- \ 'PrtInsert()',
- \ ]
-
" Keypad
let s:kprange = {
\ 'Plus': '+',
@@ -235,7 +219,8 @@ fu! s:Open()
cal s:execextvar('enter')
sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP'
cal s:buffunc(1)
- let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)]
+ let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)]
+ let [s:focus, s:prompt] = [1, ['', '', '']]
abc <buffer>
if !exists('s:hstry')
let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : ['']
@@ -517,7 +502,7 @@ fu! s:ForceUpdate()
sil! cal s:Update(join(prt, ''))
endf
-fu! s:BuildPrompt(upd, ...)
+fu! s:BuildPrompt(upd)
let base = ( s:regexp ? 'r' : '>' ).( s:byfname ? 'd' : '>' ).'> '
let [estr, prt] = ['"\', copy(s:prompt)]
cal map(prt, 'escape(v:val, estr)')
@@ -529,9 +514,9 @@ fu! s:BuildPrompt(upd, ...)
en
sil! cal ctrlp#statusline()
" Toggling
- let [hiactive, hicursor, base] = a:0 && !a:1
- \ ? ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')]
- \ : ['CtrlPPrtText', 'CtrlPPrtCursor', base]
+ let [hiactive, hicursor, base] = s:focus
+ \ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base]
+ \ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')]
let hibase = 'CtrlPPrtBase'
" Build it
redr
@@ -540,7 +525,7 @@ fu! s:BuildPrompt(upd, ...)
\ | echoh' hicursor '| echon "'.prt[1].'"
\ | echoh' hiactive '| echon "'.prt[2].'" | echoh None'
" Append the cursor at the end
- if empty(prt[1]) && !( a:0 && !a:1 )
+ if empty(prt[1]) && s:focus
exe 'echoh' hibase '| echon "_" | echoh None'
en
endf
@@ -560,6 +545,7 @@ endf
" ** Prt Actions {{{1
" Editing {{{2
fu! s:PrtClear()
+ if !s:focus | retu | en
unl! s:hstgot
let [s:prompt, s:matches] = [['', '', ''], 1]
cal s:BuildPrompt(1)
@@ -574,12 +560,14 @@ fu! s:PrtAdd(char)
endf
fu! s:PrtBS()
+ if !s:focus | retu | en
unl! s:hstgot
let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1]
cal s:BuildPrompt(1)
endf
fu! s:PrtDelete()
+ if !s:focus | retu | en
unl! s:hstgot
let [prt, s:matches] = [s:prompt, 1]
let prt[1] = matchstr(prt[2], '^.')
@@ -588,6 +576,7 @@ fu! s:PrtDelete()
endf
fu! s:PrtDeleteWord()
+ if !s:focus | retu | en
unl! s:hstgot
let [str, s:matches] = [s:prompt[0], 1]
let str = str =~ '\W\w\+$' ? matchstr(str, '^.\+\W\ze\w\+$')
@@ -599,6 +588,7 @@ fu! s:PrtDeleteWord()
endf
fu! s:PrtInsert(...)
+ if !s:focus | retu | en
let type = !a:0 ? '' : a:1
if !a:0
let type = s:insertstr()
@@ -621,6 +611,7 @@ fu! s:PrtInsert(...)
endf
fu! s:PrtExpandDir()
+ if !s:focus | retu | en
let str = s:prompt[0]
if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi
let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs')
@@ -642,6 +633,7 @@ fu! s:PrtExpandDir()
endf
" Movement {{{2
fu! s:PrtCurLeft()
+ if !s:focus | retu | en
let prt = s:prompt
if !empty(prt[0])
let s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'),
@@ -651,19 +643,22 @@ fu! s:PrtCurLeft()
endf
fu! s:PrtCurRight()
+ if !s:focus | retu | en
let prt = s:prompt
let s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'),
\ substitute(prt[2], '^.', '', '')]
cal s:BuildPrompt(0)
endf
fu! s:PrtCurStart()
+ if !s:focus | retu | en
let str = join(s:prompt, '')
let s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')]
cal s:BuildPrompt(0)
endf
fu! s:PrtCurEnd()
+ if !s:focus | retu | en
let s:prompt = [join(s:prompt, ''), '', '']
cal s:BuildPrompt(0)
endf
@@ -673,33 +668,38 @@ fu! s:PrtSelectMove(dir)
let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
exe 'keepj norm!' dirs[a:dir]
if s:nolim != 1 | let s:cline = line('.') | en
- if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en
+ if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
endf
-fu! s:PrtSelectJump(char, ...)
+fu! s:PrtSelectJump(char)
let lines = copy(s:lines)
- if a:0
+ if s:byfname
cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]')
en
" Cycle through matches, use s:jmpchr to store last jump
- let chr = escape(a:char, '.~')
- if match(lines, '\c^'.chr) >= 0
+ let chr = escape(matchstr(a:char, '^.'), '.~')
+ let smartcs = &scs && chr =~ '\u' ? '\C' : ''
+ if match(lines, smartcs.'^'.chr) >= 0
" If not exists or does but not for the same char
- let pos = match(lines, '\c^'.chr)
+ let pos = match(lines, smartcs.'^'.chr)
if !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr )
let [jmpln, s:jmpchr] = [pos, [chr, pos]]
elsei exists('s:jmpchr') && s:jmpchr[0] == chr
" Start of lines
if s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en
- let npos = match(lines, '\c^'.chr, s:jmpchr[1] + 1)
+ let npos = match(lines, smartcs.'^'.chr, s:jmpchr[1] + 1)
let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
en
keepj exe jmpln + 1
if s:nolim != 1 | let s:cline = line('.') | en
- if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en
+ if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
en
endf
" Misc {{{2
+fu! s:PrtFocusMap(char)
+ cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char])
+endf
+
fu! s:PrtClearCache()
if s:itemtype == 0
cal ctrlp#clr()
@@ -736,7 +736,7 @@ fu! s:PrtExit()
endf
fu! s:PrtHistory(...)
- if !s:maxhst | retu | en
+ if !s:focus || !s:maxhst | retu | en
let [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1]
" Save to history if not saved before
let [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)]
@@ -749,55 +749,48 @@ fu! s:PrtHistory(...)
unl s:force
endf
"}}}1
-" * MapKeys() {{{1
-fu! s:MapKeys(...)
- " Normal keys
- let pfunc = a:0 && !a:1 ? 'PrtSelectJump' : 'PrtAdd'
- let dojmp = s:byfname && a:0 && !a:1 ? ', 1' : ''
- let pcmd = "nn \<buffer> \<silent> \<k%s> :\<c-u>cal \<SID>%s(\"%s\"%s)\<cr>"
+" * Mappings {{{1
+fu! s:MapNorms()
+ if exists('s:nmapped') && s:nmapped == s:bufnr | retu | en
+ let pcmd = "nn \<buffer> \<silent> \<k%s> :\<c-u>cal \<SID>%s(\"%s\")\<cr>"
let cmd = substitute(pcmd, 'k%s', 'char-%d', '')
- for each in range(32, 126)
- exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp)
+ let pfunc = 'PrtFocusMap'
+ let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123)
+ \ + range(128, 255)
+ for each in [34, 92, 124]
+ exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'))
+ endfo
+ for each in ranges
+ exe printf(cmd, each, pfunc, nr2char(each))
endfo
for each in range(0, 9)
- exe printf(pcmd, each, pfunc, each, dojmp)
+ exe printf(pcmd, each, pfunc, each)
endfo
for [ke, va] in items(s:kprange)
- exe printf(pcmd, ke, pfunc, va, dojmp)
+ exe printf(pcmd, ke, pfunc, va)
endfo
- " Special keys
- if a:0 < 2
- cal call('s:MapSpecs', a:0 && !a:1 ? [1] : [])
- en
+ let s:nmapped = s:bufnr
endf
-fu! s:MapSpecs(...)
- " Correct arrow keys in terminal
- if ( has('termresponse') && v:termresponse =~ "\<ESC>" )
- \ || &term =~? '\vxterm|<k?vt|gnome|screen|linux|ansi'
- for each in ['\A <up>','\B <down>','\C <right>','\D <left>']
- exe s:lcmap.' <esc>['.each
- endfo
- en
- if a:0
- for ke in s:prtunmaps | for kp in s:prtmaps[ke]
- exe s:lcmap kp '<Nop>'
- endfo | endfo
- el
- for [ke, va] in items(s:prtmaps) | for kp in va
- exe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>'
- endfo | endfo
+fu! s:MapSpecs()
+ if !( exists('s:smapped') && s:smapped == s:bufnr )
+ " Correct arrow keys in terminal
+ if ( has('termresponse') && v:termresponse =~ "\<ESC>" )
+ \ || &term =~? '\vxterm|<k?vt|gnome|screen|linux|ansi'
+ for each in ['\A <up>','\B <down>','\C <right>','\D <left>']
+ exe s:lcmap.' <esc>['.each
+ endfo
+ en
en
+ for [ke, va] in items(s:prtmaps) | for kp in va
+ exe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>'
+ endfo | endfo
+ let s:smapped = s:bufnr
endf
" * Toggling {{{1
-fu! s:Focus()
- retu !exists('s:focus') ? 1 : s:focus
-endf
-
fu! s:ToggleFocus()
- let s:focus = !exists('s:focus') || s:focus ? 0 : 1
- cal s:MapKeys(s:focus)
- cal s:BuildPrompt(0, s:focus)
+ let s:focus = s:focus ? 0 : 1
+ cal s:BuildPrompt(0)
endf
fu! s:ToggleRegex()
@@ -809,7 +802,6 @@ fu! s:ToggleByFname()
if s:ispath
let s:byfname = s:byfname ? 0 : 1
let s:mfunc = s:mfunc()
- cal s:MapKeys(s:Focus(), 1)
cal s:PrtSwitcher()
en
endf
@@ -824,7 +816,7 @@ endf
fu! s:PrtSwitcher()
let [s:force, s:matches] = [1, 1]
- cal s:BuildPrompt(1, s:Focus())
+ cal s:BuildPrompt(1)
unl s:force
endf
" - SetWD() {{{1
@@ -855,16 +847,19 @@ fu! ctrlp#acceptfile(mode, line, ...)
cal s:PrtExit()
let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()]
let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*'))
- if s:jmptobuf && bufnr > 0 && md =~ 'e\|t'
+ if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0
\ && !( md == 'e' && bufnr == bufnr('%') )
let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)]
- let buftab = s:jmptobuf > 1 ? s:buftab(bufnr, md) : [0, 0]
+ let buftab = ( s:jmptobuf =~# '[tTVH]' || s:jmptobuf > 1 )
+ \ ? s:buftab(bufnr, md) : [0, 0]
en
" Switch to existing buffer or open new one
- if exists('jmpb') && bufwinnr > 0 && md != 't'
+ if exists('jmpb') && bufwinnr > 0
+ \ && !( md == 't' && ( s:jmptobuf !~# toupper(md) || buftab[0] ) )
exe bufwinnr.'winc w'
if j2l | cal ctrlp#j2l(j2l) | en
elsei exists('jmpb') && buftab[0]
+ \ && !( md =~ '[evh]' && s:jmptobuf !~# toupper(md) )
exe 'tabn' buftab[0]
exe buftab[1].'winc w'
if j2l | cal ctrlp#j2l(j2l) | en
@@ -879,7 +874,8 @@ fu! ctrlp#acceptfile(mode, line, ...)
" Reset &switchbuf option
let [swb, &swb] = [&swb, '']
" Open new window/buffer
- let args = [cmd, useb ? bufnr : filpath, a:0 ? ' +'.a:1 : tail, useb, j2l]
+ let [fid, tail] = [( useb ? bufnr : filpath ), ( a:0 ? ' +'.a:1 : tail )]
+ let args = [cmd, fid, tail, 1, [useb, j2l]]
cal call('s:openfile', args)
let &swb = swb
en
@@ -914,7 +910,7 @@ fu! s:AcceptSelection(mode)
let str = join(s:prompt, '')
if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en
" Get the selected line
- let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
+ let line = ctrlp#getcline()
if a:mode != 'e' && !s:itemtype && line == ''
\ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$'
cal s:CreateNewFile(a:mode) | retu
@@ -958,15 +954,15 @@ fu! s:CreateNewFile(...)
\ s:newfop =~ '2\|h' || ( a:0 && a:1 == 'h' ) || md == 'h' ? 'new' :
\ s:newfop =~ '3\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' :
\ ctrlp#normcmd('e')
- cal s:openfile(cmd, filpath, tail)
+ cal s:openfile(cmd, filpath, tail, 1)
endf
" * OpenMulti() {{{1
fu! s:MarkToOpen()
if s:bufnr <= 0 || s:opmul == '0'
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
retu
en
- let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
+ let line = ctrlp#getcline()
if empty(line) | retu | en
let filpath = s:ispath ? fnamemodify(line, ':p') : line
if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
@@ -1005,7 +1001,7 @@ fu! s:OpenMulti(...)
let md = a:0 ? a:1 : ( md == '' ? 'v' : md )
let nopt = exists('g:ctrlp_open_multiple_files')
if !has_marked
- let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
+ let line = ctrlp#getcline()
if line == '' | retu | en
let marked = { 1 : fnamemodify(line, ':p') }
let [nr, ur, jf, nopt] = ['1', 0, 0, 1]
@@ -1016,16 +1012,8 @@ fu! s:OpenMulti(...)
cal s:unmarksigns()
unl! s:marked
cal s:BuildPrompt(0)
- elsei !has_marked && md == 'a'
- let [s:marked, key] = [{}, 1]
- for line in s:lines
- let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') })
- let key += 1
- endfo
- cal s:remarksigns()
- retu s:BuildPrompt(0)
- elsei !has_marked && md == 'x'
- retu call(s:openfunc[s:ctype], [md, line])
+ elsei !has_marked && md =~ '[axd]'
+ retu s:OpenNoMarks(md, line)
en
if md =~ '\v^c(ancel)?$' | retu | en
let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr
@@ -1035,9 +1023,9 @@ fu! s:OpenMulti(...)
cal s:sanstail(join(s:prompt, ''))
cal s:PrtExit()
if nr == '0' || md == 'i'
- retu map(mkd, "s:openfile('bad', fnamemodify(v:val, ':.'), '')")
+ retu map(mkd, "s:openfile('bad', v:val, '', 0)")
en
- let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701]
+ let tail = s:tail()
let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')]
let useb = bufnr > 0 && buflisted(bufnr) && emptytail
" Move to a replaceable window
@@ -1064,19 +1052,16 @@ fu! s:OpenMulti(...)
let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ),
\ nr != '' && nr < ic]
if conds[nopt]
- if bufnr <= 0 | if fnesc
- cal s:openfile('bad', fnamemodify(va, ':.'), '')
- el
- cal s:openfile(cmd, va, tail) | sil! hid clo!
- en | en
+ if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en
el
- cal s:openfile(cmd, useb ? bufnr : va, tail) | let ic += 1
- if jf | if ic == 2
+ cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1 ? 1 : 0)
+ if jf | if ic == 1
let crpos = [tabpagenr(), winnr()]
el
let crpos[0] += tabpagenr() <= crpos[0]
- let crpos[1] += winnr() == crpos[1]
+ let crpos[1] += winnr() <= crpos[1]
en | en
+ let ic += 1
en
endfo
if jf && exists('crpos') && ic > 2
@@ -1085,6 +1070,28 @@ fu! s:OpenMulti(...)
let &swb = swb
unl! s:tabct
endf
+
+fu! s:OpenNoMarks(md, line)
+ if a:md == 'a'
+ let [s:marked, key] = [{}, 1]
+ for line in s:lines
+ let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') })
+ let key += 1
+ endfo
+ cal s:remarksigns()
+ cal s:BuildPrompt(0)
+ elsei a:md == 'x'
+ cal call(s:openfunc[s:ctype], [a:md, a:line])
+ elsei a:md == 'd'
+ let dir = fnamemodify(a:line, ':h')
+ if isdirectory(dir)
+ cal ctrlp#setdir(dir)
+ cal ctrlp#switchtype(0)
+ cal ctrlp#recordhist()
+ cal s:PrtClear()
+ en
+ en
+endf
" ** Helper functions {{{1
" Sorting {{{2
fu! ctrlp#complen(...)
@@ -1204,7 +1211,7 @@ fu! ctrlp#statusline()
let nxt = tps[s:walker(max, s:itemtype, 1)][1]
let prv = tps[s:walker(max, s:itemtype, -1)][1]
let s:ctype = tps[s:itemtype][0]
- let focus = s:Focus() ? 'prt' : 'win'
+ let focus = s:focus ? 'prt' : 'win'
let byfname = s:byfname ? 'file' : 'path'
let marked = s:opmul != '0' ?
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''
@@ -1489,6 +1496,14 @@ fu! s:buftab(bufnr, md)
retu [0, 0]
endf
+fu! s:bufwins(bufnr)
+ let winns = 0
+ for tabnr in range(1, tabpagenr('$'))
+ let winns += count(tabpagebuflist(tabnr), a:bufnr)
+ endfo
+ retu winns
+endf
+
fu! ctrlp#normcmd(cmd, ...)
if a:0 < 2 && s:nosplit() | retu a:cmd | en
let norwins = filter(range(1, winnr('$')),
@@ -1509,6 +1524,11 @@ fu! ctrlp#normcmd(cmd, ...)
retu a:0 ? a:1 : 'bo vne'
endf
+fu! ctrlp#modfilecond()
+ retu &mod && !&hid && &bh != 'hide' && !&cf && !&awa
+ \ && s:bufwins(bufnr('%')) == 1
+endf
+
fu! s:nosplit()
retu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0
endf
@@ -1586,11 +1606,17 @@ fu! s:argmaps(md, i)
let roh = [
\ ['Open Multiple Files', '/h[i]dden/[c]lear', ['i', 'c']],
\ ['Create a New File', '/[r]eplace', ['r']],
- \ ['Open Selected', '/[r]eplace/h[i]dden? Mark [a]ll', ['r', 'i', 'a']],
+ \ ['Open Selected', '/[r]eplace', ['r', 'd', 'a']],
\ ]
- if a:i == 2 && s:openfunc != {} && has_key(s:openfunc, s:ctype)
- let roh[2][1] = '/[r]eplace/h[i]dden/e[x]ternal? Mark [a]ll'
- let roh[2][2] = ['r', 'i', 'x', 'a']
+ if a:i == 2
+ if !buflisted(bufnr('^'.fnamemodify(ctrlp#getcline(), ':p').'$'))
+ let roh[2][1] .= '/h[i]dden'
+ let roh[2][2] += ['i']
+ en
+ if s:openfunc != {} && has_key(s:openfunc, s:ctype)
+ let roh[2][1] .= '/e[x]ternal'
+ let roh[2][2] += ['x']
+ en
en
let str = roh[a:i][0].': [t]ab/[v]ertical/[h]orizontal'.roh[a:i][1].'? '
retu s:choices(str, ['t', 'v', 'h'] + roh[a:i][2], 's:argmaps', [a:md, a:i])
@@ -1693,7 +1719,7 @@ fu! s:regexfilter(str)
endf
fu! s:walker(m, p, d)
- retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
+ retu a:d >= 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
endf
fu! s:delent(rfunc)
@@ -1755,11 +1781,12 @@ fu! s:buffunc(e)
en
endf
-fu! s:openfile(cmd, fid, tail, ...)
- let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
+fu! s:openfile(cmd, fid, tail, chkmod, ...)
+ let cmd = a:chkmod && a:cmd =~ '^[eb]$' && ctrlp#modfilecond()
+ \ && !( a:cmd == 'b' && &aw ) ? ( a:cmd == 'b' ? 'sb' : 'sp' ) : a:cmd
let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd
- let j2l = a:0 && a:1 ? a:2 : 0
- exe cmd.( a:0 && a:1 ? '' : a:tail ) ctrlp#fnesc(a:fid)
+ let j2l = a:0 && a:1[0] ? a:1[1] : 0
+ exe cmd.( a:0 && a:1[0] ? '' : a:tail ) ctrlp#fnesc(a:fid)
if j2l
exe j2l
en
@@ -1900,6 +1927,10 @@ fu! s:getextvar(key)
retu -1
endf
+fu! ctrlp#getcline()
+ retu !empty(s:lines) ? s:lines[line('.') - 1] : ''
+endf
+
fu! ctrlp#exit()
cal s:PrtExit()
endf
@@ -1943,7 +1974,8 @@ fu! ctrlp#init(type, ...)
cal ctrlp#reset()
noa cal s:Open()
cal s:SetWD(a:0 ? a:1 : {})
- cal s:MapKeys()
+ cal s:MapNorms()
+ cal s:MapSpecs()
cal ctrlp#syntax()
cal ctrlp#setlines(s:settype(a:type))
cal s:SetDefTxt()
View
2 vim/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim
@@ -47,7 +47,7 @@ fu! ctrlp#quickfix#accept(mode, str)
cal ctrlp#exit()
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
- let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
+ let cmd = cmd == 'e' && ctrlp#modfilecond() ? 'new' : cmd
exe cmd ctrlp#fnesc(filpath)
cal cursor(items[2], items[3])
sil! norm! zvzz
View
3 vim/bundle/ctrlp.vim/autoload/ctrlp/tag.vim
@@ -97,7 +97,8 @@ fu! ctrlp#tag#accept(mode, str)
\ 'e': ['', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
- let cmd = cmd == 'tj' && &mod ? 'hid '.cmd : cmd
+ let cmd = a:mode == 'e' && ctrlp#modfilecond() && !&aw
+ \ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
if fnd[0] == 1
if cmd != ''
View
60 vim/bundle/ctrlp.vim/doc/ctrlp.txt
@@ -128,13 +128,16 @@ Set the maximum height of the match window: >
<
*'g:ctrlp_switch_buffer'*
-When opening a file with <cr> or <c-t>, if the file's already opened somewhere
-CtrlP will try to jump to it instead of opening a new instance: >
- let g:ctrlp_switch_buffer = 2
+When opening a file, if it's already opened in a window somewhere CtrlP will
+try to jump to it instead of opening a new instance: >
+ let g:ctrlp_switch_buffer = 'Et'
<
- 1 - only jump to the buffer if it's opened in the current tab.
- 2 - jump tab as well if the buffer's opened in another tab.
- 0 - disable this feature.
+ e - jump when <cr> is pressed, but only to windows in the current tab.
+ t - jump when <c-t> is pressed, but only to windows in another tab.
+ v - like e, but jump when <c-v> is pressed.
+ h - like e, but jump when <c-x> is pressed.
+ E, T, V, H - like e, t, v and h respectively, but jump to windows anywhere.
+ 0 or <empty-string> - disable this feature.
*'g:ctrlp_reuse_window'*
When opening a file with <cr>, CtrlP avoids opening it in windows created by
@@ -165,7 +168,7 @@ variable: >
c - the directory of the current file.
r - the nearest ancestor that contains one of these directories or files:
.git .hg .svn .bzr _darcs
- 0 or [empty-string] - don't manage working directory.
+ 0 or <empty-string> - don't manage working directory.
Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option
on a per buffer basis.
@@ -265,8 +268,10 @@ Examples: >
<
You can also use 'grep', 'findstr' or something else to filter the results.
Examples: >
- let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)'
- let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$'
+ let g:ctrlp_user_command =
+ \ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " MacOSX/Linux
+ let g:ctrlp_user_command =
+ \ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
<
Use a version control listing command when inside a repository, this is faster
when scanning large projects: >
@@ -280,17 +285,29 @@ when scanning large projects: >
\ 'ignore': 0 or 1
\ }
<
-Examples: >
+Some examples: >
+ " Single VCS, listing command does not list untracked files:
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']
+
+ " Multiple VCS's:
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
- \ 'fallback': 'find %s -type f',
- \ 'ignore': 0
+ \ 'fallback': 'find %s -type f'
\ }
+
+ " Single VCS, listing command lists untracked files (slower):
+ let g:ctrlp_user_command =
+ \ ['.git', 'cd %s && git ls-files . -co --exclude-standard']
+
+ let g:ctrlp_user_command =
+ \ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
+
+ let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') '
+ \ . 'do hg --cwd %s status -numac -I . %%a'] " Windows
<
Note #1: if the fallback_command is empty or not defined, |globpath()| will
then be used when searching outside a repo.
@@ -785,7 +802,22 @@ Opening multiple files:~
- Mark/unmark a file to create a new file in its directory using <c-y>.
<c-o>
- Open files marked by <c-z>.
+ - Open files marked by <c-z>.
+ - When no file has been marked by <c-z>, open a console dialog with the
+ following options:
+
+ Open the selected file:
+ t - in a tab page.
+ v - in a vertical split.
+ h - in a horizontal split.
+ r - in the current window.
+ i - as a hidden buffer.
+ x - (optional) with the function defined in |g:ctrlp_open_func|.
+
+ Other options (not shown):
+ a - mark all files in the match window.
+ d - change CtrlP's local working directory to the selected file's
+ directory and switch to find file mode.
Function keys:~
@@ -1131,6 +1163,8 @@ Special thanks:~
===============================================================================
CHANGELOG *ctrlp-changelog*
+ + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
+ (old values still work).
+ New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.
+ New options: |g:ctrlp_open_func|.
|g:ctrlp_tabpage_position|.
View
207 vim/bundle/neocomplcache/autoload/neocomplcache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: neocomplcache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 28 Aug 2012.
+" Last Modified: 08 Sep 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,15 +22,39 @@
" 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
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
+endfunction"}}}
+
if !exists('s:is_enabled')
+ call s:initialize_variables()
let s:is_enabled = 0
endif
@@ -66,29 +90,7 @@ 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: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
- "}}}
+ call s:initialize_variables()
" Initialize sources table."{{{
" Search autoload.
@@ -151,7 +153,7 @@ function! neocomplcache#enable() "{{{
\'\\\a{\a\{1,2}}\|\\[[:alpha:]@][[:alnum:]@]*\%({\%([[:alnum:]:_]\+\*\?}\?\)\?\)\?\|\a[[:alnum:]:_]*\*\?')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'sh,zsh,int-zsh,int-bash,int-sh',
- \'\$\w\+\|[[:alpha:]_.-][[:alnum:]_.-]*')
+ \'[[:alpha:]_.-][[:alnum:]_.-]*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'vimshell',
\'\$\$\?\w*\|[[:alpha:]_.\\/~-][[:alnum:]_.\\/~-]*\|\d\+\%(\.\d\+\)\+')
@@ -207,7 +209,7 @@ function! neocomplcache#enable() "{{{
\'html,xhtml,xml,markdown,eruby',
\'</\?\%([[:alnum:]_:-]\+\s*\)\?\%(/\?>\)\?\|&\h\%(\w*;\)\?\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
- \'css,stylus',
+ \'css,stylus,scss',
\'[@#.]\?[[:alpha:]_:-][[:alnum:]_:-]*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'tags',
@@ -310,6 +312,10 @@ function! neocomplcache#enable() "{{{
call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
\ 'html,xhtml', 'css,stylus')
call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ \ 'css', 'scss')
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
+ \ 'scss', 'css')
+ call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
\ 'stylus', 'css')
call neocomplcache#set_dictionary_helper(g:neocomplcache_same_filetype_lists,
\ 'xhtml', 'html,xml')
@@ -377,52 +383,79 @@ function! neocomplcache#enable() "{{{
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#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ g:neocomplcache_context_filetype_lists,
\ 'eruby', [
\ {'filetype' : 'ruby', 'start' : '<%[=#]\?', 'end' : '%>'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ 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#set_dictionary_helper(
+ \ g:neocomplcache_context_filetype_lists,
\ 'help', [
\ {'filetype' : 'vim', 'start' : '^>', 'end' : '^<'},
\])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_context_filetype_lists,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_context_filetype_lists,
\ 'nyaos,int-nyaos', [
- \ {'filetype' : 'lua', 'start' : '\<lua_e\s\+\(["'']\)', 'end' : '^\1'},
+ \ {'filetype' : 'lua',
+ \ 'start' : '\<lua_e\s\+\(["'']\)', 'end' : '^\1'},
\])
"}}}
@@ -494,6 +527,14 @@ function! neocomplcache#enable() "{{{
\'v:val.word !~ ''^[~_]''')
"}}}
+ " Initialize force omni completion pattern."{{{
+ if !exists('g:neocomplcache_force_omni_patterns')
+ let g:neocomplcache_force_omni_patterns = {}
+ endif
+ call neocomplcache#set_dictionary_helper(
+ \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 = {}
@@ -582,11 +623,14 @@ 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
@@ -597,7 +641,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)
@@ -607,30 +651,32 @@ function! neocomplcache#manual_complete(findstart, base)"{{{
let s:complete_words = []
let s:is_prefetch = 0
let s:complete_results = {}
- return g:neocomplcache_enable_prefetch ? -1 : -3
+ return (g:neocomplcache_enable_prefetch
+ \ || g:neocomplcache_enable_insert_char_pre) ?
+ \ -1 : -3
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 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'
+ 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"}}}
@@ -1261,17 +1307,15 @@ function! neocomplcache#is_omni_complete(cur_text)"{{{
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)
@@ -1536,20 +1580,25 @@ function! neocomplcache#get_complete_words(complete_results, cur_keyword_pos, cu
" Convert words.
if neocomplcache#is_text_mode() "{{{
+ let convert_candidates = filter(copy(complete_words),
+ \ "get(v:val, 'neocomplcache__convertable', 1)")
+
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"}}}
View
13 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: cache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Jun 2012.
+" Last Modified: 08 Sep 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
@@ -35,9 +35,9 @@ function! neocomplcache#cache#check_cache_list(cache_dir, key, async_cache_dicti
return
endif
- let cache_list = a:async_cache_dictionary[a:key]
let keyword_list = []
- for cache in a:async_cache_dictionary[a:key]
+ let cache_list = a:async_cache_dictionary[a:key]
+ for cache in cache_list
if filereadable(cache.cachename)
let keyword_list +=
\ neocomplcache#cache#load_from_cache(a:cache_dir, cache.filename)
@@ -46,9 +46,12 @@ function! neocomplcache#cache#check_cache_list(cache_dir, key, async_cache_dicti
call neocomplcache#cache#list2index(keyword_list,
\ a:index_keyword_list, a:completion_length)
+ call filter(cache_list, '!filereadable(v:val.cachename)')
- " Delete from dictionary.
- call remove(a:async_cache_dictionary, a:key)
+ if empty(cache_list)
+ " Delete from dictionary.
+ call remove(a:async_cache_dictionary, a:key)
+ endif
endfunction"}}}
function! neocomplcache#cache#check_cache(cache_dir, key, async_cache_dictionary, keyword_list_dictionary, completion_length) "{{{
" Caching.
View
86 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: 22 Aug 2012.
+" Last Modified: 11 Sep 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
@@ -44,10 +44,11 @@ function! s:source.initialize()"{{{
\ call s:check_source()
autocmd CursorHold *
\ call s:check_cache()
+ autocmd BufWritePost *
+ \ call s:check_recache()
autocmd InsertEnter,InsertLeave *
\ call s:caching_current_buffer(
\ line('.') - 1, line('.') + 1, 1)
- autocmd VimLeavePre * call s:save_all_cache()
augroup END"}}}
" Set rank.
@@ -80,8 +81,6 @@ function! s:source.initialize()"{{{
command! -nargs=? -complete=buffer -bar
\ NeoComplCacheOutputKeyword call s:output_keyword(<q-args>)
command! -nargs=? -complete=buffer -bar
- \ NeoComplCacheSaveCache call s:save_all_cache()
- command! -nargs=? -complete=buffer -bar
\ NeoComplCacheDisableCaching call s:disable_caching(<q-args>)
command! -nargs=? -complete=buffer -bar
\ NeoComplCacheEnableCaching call s:enable_caching(<q-args>)
@@ -95,12 +94,9 @@ function! s:source.finalize()"{{{
delcommand NeoComplCacheCachingBuffer
delcommand NeoComplCachePrintSource
delcommand NeoComplCacheOutputKeyword
- delcommand NeoComplCacheSaveCache
delcommand NeoComplCacheDisableCaching
delcommand NeoComplCacheEnableCaching
- call s:save_all_cache()
-
let s:buffer_sources = {}
endfunction"}}}
@@ -228,7 +224,8 @@ function! s:initialize_source(srcname)"{{{
\ 'name' : filename, 'filetype' : ft,
\ 'keyword_pattern' : keyword_pattern,
\ 'end_line' : len(buflines),
- \ 'accessed_time' : localtime(),
+ \ 'accessed_time' : 0,
+ \ 'cached_time' : 0,
\ 'path' : path, 'loaded_cache' : 0,
\ 'cache_name' : neocomplcache#cache#encode_name(
\ 'buffer_cache', path),
@@ -245,7 +242,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([100, line('$')]), 0)
+ call s:caching_current_buffer(1, min([1000, line('$')]), 0)
endif
return
@@ -255,6 +252,8 @@ function! s:word_caching(srcname)"{{{
\ neocomplcache#cache#async_load_from_file(
\ 'buffer_cache', source.path,
\ source.keyword_pattern, 'B')
+ let source.cached_time = localtime()
+ let source.end_line = len(getbufline(a:srcname, 1, '$'))
let s:async_dictionary_list[source.path] = [{
\ 'filename' : source.path,
\ 'cachename' : source.cache_name,
@@ -291,7 +290,6 @@ function! s:check_source()"{{{
\ && !getwinvar(bufwinnr(bufnumber), '&previewwindow')
\ && getfsize(bufname) <
\ g:neocomplcache_caching_limit_file_size
-
" Caching.
call s:word_caching(bufnumber)
endif
@@ -313,11 +311,8 @@ function! s:check_cache()"{{{
for [key, source] in items(s:buffer_sources)
" Check deleted buffer and access time.
if !bufloaded(str2nr(key))
- \ || source.accessed_time < release_accessd_time
-
- " Save cache.
- call s:save_cache(key)
-
+ \ || (source.accessed_time > 0 &&
+ \ source.accessed_time < release_accessd_time)
" Remove item.
call remove(s:buffer_sources, key)
endif
@@ -338,57 +333,32 @@ function! s:check_cache()"{{{
\ v:val.word).'\\>', 'wn', 0, 300) > 0")
endfor
endfunction"}}}
-
-function! s:exists_current_source()"{{{
- return has_key(s:buffer_sources, bufnr('%'))
-endfunction"}}}
-
-function! s:save_cache(srcname)"{{{
- let source = s:buffer_sources[a:srcname]
- if source.end_line < 500
- return
- endif
-
- if getbufvar(a:srcname, '&buftype') =~ 'nofile'
+function! s:check_recache()"{{{
+ if !s:exists_current_source()
return
endif
- let srcname = fnamemodify(bufname(str2nr(a:srcname)), ':p')
- if !filereadable(srcname) ||
- \ (g:neocomplcache_disable_caching_file_path_pattern != ''
- \ && srcname =~ g:neocomplcache_disable_caching_file_path_pattern)
- return
- endif
+ let release_accessd_time =
+ \ localtime() - g:neocomplcache_release_cache_time
- let cache_name = neocomplcache#cache#encode_name('buffer_cache', srcname)
+ let source = s:buffer_sources[bufnr('%')]
- if filereadable(cache_name) &&
- \ (g:neocomplcache_disable_caching_file_path_pattern != ''
- \ && srcname =~ g:neocomplcache_disable_caching_file_path_pattern)
- " Delete cache file.
- call delete(cache_name)
- return
- endif
+ " 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
- if getftime(cache_name) >= getftime(srcname)
- return
+ " Buffer recache.
+ call s:word_caching(bufnr('%'))
endif
+endfunction"}}}
- " Output buffer.
- call neocomplcache#cache#save_cache('buffer_cache', srcname,
- \ neocomplcache#unpack_dictionary(source.keyword_cache))
-endfunction "}}}
-function! s:save_all_cache()"{{{
- try
- for key in keys(s:buffer_sources)
- call s:save_cache(key)
- endfor
- catch
- call neocomplcache#print_error('Error occured while saving cache!')
- let error_file = neocomplcache#get_temporary_directory() . strftime('/error-%Y-%m-%d.log')
- call writefile([v:exception . ' ' . v:throwpoint], error_file)
- call neocomplcache#print_error('Please check error file: ' . error_file)
- endtry
+function! s:exists_current_source()"{{{
+ return has_key(s:buffer_sources, bufnr('%'))
endfunction"}}}
" Command functions."{{{
View
35 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: 07 Aug 2012.
+" Last Modified: 04 Sep 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
@@ -53,7 +53,8 @@ function! s:source.initialize()"{{{
\ 'filename_complete', g:neocomplcache_auto_completion_start_length)
" Set filename pattern.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_keyword_patterns,
\'filename',
\ neocomplcache#util#is_windows() ?
\'\%(\a\+:[/\\]\)\?[\\/[:alnum:]()$+_\~.-]\+' :
@@ -62,24 +63,30 @@ function! s:source.initialize()"{{{
" 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,
+ 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,
+ 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,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_filename_include_exts,
\ 'c', ['h'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filename_include_exts,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_filename_include_exts,
\ 'cpp', ['', 'h', 'hpp', 'hxx'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filename_include_exts,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_filename_include_exts,
\ 'perl', ['pm'])
- call neocomplcache#set_dictionary_helper(g:neocomplcache_filename_include_exts,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_filename_include_exts,
\ 'java', ['java'])
"}}}
@@ -185,7 +192,7 @@ function! s:get_include_files(cur_keyword_str)"{{{
let bufdirectory = neocomplcache#util#substitute_path_separator(
\ fnamemodify(expand('%'), ':p:h'))
let dir_list = []
- let file_list = []
+ let file_list = s:get_default_include_files(filetype)
for subpath in split(path, '[,;]')
let dir = (subpath == '.') ? bufdirectory : subpath
if !isdirectory(dir)
@@ -232,6 +239,16 @@ function! s:get_include_files(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"}}}
+
let s:cached_files = {}
function! s:get_glob_files(cur_keyword_str, path)"{{{
View
37 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: 19 May 2012.
+" Last Modified: 07 Sep 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
@@ -155,7 +155,8 @@ endfunction"}}}
function! neocomplcache#sources#include_complete#get_include_tags(bufnumber)"{{{
return filter(map(neocomplcache#sources#include_complete#get_include_files(a:bufnumber),
- \ "neocomplcache#cache#encode_name('tags_output', v:val)"), 'filereadable(v:val)')
+ \ "neocomplcache#cache#encode_name('tags_output', v:val)"),
+ \ 'filereadable(v:val)')
endfunction"}}}
" For Debug.
@@ -287,24 +288,36 @@ function! s:get_buffer_include_files(bufnumber)"{{{
return []
endif
- if filetype == 'python'
- \ && !has_key(g:neocomplcache_include_paths, 'python')
- \ && executable('python')
+ if (filetype ==# 'python' || filetype ==# 'python3')
+ \ && (executable('python') || executable('python3'))
" Initialize python path pattern.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_paths, 'python',
- \ neocomplcache#system('python -',
- \ 'import sys;sys.stdout.write(",".join(sys.path))'))
- elseif filetype == 'cpp' && isdirectory('/usr/include/c++')
+
+ let path = ''
+ if executable('python3')
+ let path .= ',' . neocomplcache#system('python3 -',
+ \ 'import sys;sys.stdout.write(",".join(sys.path))')
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_include_paths, 'python3', path)
+ endif
+ if executable('python')
+ let path .= ',' . neocomplcache#system('python -',
+ \ 'import sys;sys.stdout.write(",".join(sys.path))')
+ endif
+ let path = join(neocomplcache#util#uniq(filter(
+ \ split(path, ',', 1), "v:val != ''")), ',')
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_include_paths, 'python', path)
+ elseif filetype ==# 'cpp' && isdirectory('/usr/include/c++')
" Add cpp path.
- call neocomplcache#set_dictionary_helper(g:neocomplcache_include_paths, 'cpp',
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_include_paths, 'cpp',
\ getbufvar(a:bufnumber, '&path') .
\ ','.join(split(glob('/usr/include/c++/*'), '\n'), ','))
endif
let pattern = get(g:neocomplcache_include_patterns, filetype,
\ getbufvar(a:bufnumber, '&include'))
- if pattern == '' ||
- \ (filetype != 'c' && filetype != 'cpp' && pattern ==# '^\s*#\s*include')
+ if pattern == ''
return []
endif
let path = get(g:neocomplcache_include_paths, filetype,
View
9 vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: member_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 22 Apr 2012.
+" Last Modified: 04 Sep 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
@@ -70,7 +70,8 @@ function! s:source.initialize()"{{{
if !exists('g:neocomplcache_member_patterns')
let g:neocomplcache_member_patterns = {}
endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_member_patterns,
+ call neocomplcache#set_dictionary_helper(
+ \ g:neocomplcache_member_patterns,
\'default', '\h\w*\%(()\|\[\h\w*\]\)\?')
"}}}
@@ -117,6 +118,10 @@ function! neocomplcache#sources#member_complete#caching_current_line()"{{{
" Current line caching.
return s:caching_current_buffer(line('.')-1, line('.')+1)
endfunction"}}}
+function! neocomplcache#sources#member_complete#caching_current_buffer()"{{{
+ " Current line caching.
+ return s:caching_current_buffer(1, line('$'))
+endfunction"}}}
function! s:caching_current_buffer(start, end)"{{{
" Current line caching.
View
4 vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: omni_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 09 Aug 2012.
+" Last Modified: 08 Sep 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
@@ -44,7 +44,7 @@ function! s:source.initialize()"{{{
\'html,xhtml,xml,markdown',
\'<[^>]*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns,
- \'css',
+ \'css,scss',
\'^\s\+\w\+\|\w\+[):;]\?\s\+\w*\|[@!]')
call neocomplcache#set_dictionary_helper(g:neocomplcache_omni_patterns,
\'javascript',
View
14 vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/helper.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: helper.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 23 Aug 2012.
+" Last Modified: 02 Sep 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
@@ -372,11 +372,13 @@ function! neocomplcache#sources#vim_complete#helper#function(cur_text, cur_keywo
for function in values(s:internal_candidates_list.functions)
let function_prototypes[function.word] = function.abbr
endfor
- let s:internal_candidates_list.function_prototypes = s:caching_prototype_from_dict('functions')
+ let s:internal_candidates_list.function_prototypes =
+ \ s:caching_prototype_from_dict('functions')
for function in values(s:internal_candidates_list.functions)
if has_key(s:internal_candidates_list.function_prototypes, function.word)
- let function.description = function.word . s:internal_candidates_list.function_prototypes[function.word]
+ let function.description = function.word
+ \ . s:internal_candidates_list.function_prototypes[function.word]
endif
endfor
endif
@@ -392,7 +394,8 @@ function! neocomplcache#sources#vim_complete#helper#function(cur_text, cur_keywo
endfor
let list = functions
else
- let list = values(s:internal_candidates_list.functions) + values(s:global_candidates_list.functions)
+ let list = values(s:internal_candidates_list.functions)
+ \ + values(s:global_candidates_list.functions)
endif
return list
@@ -645,7 +648,8 @@ function! s:caching_completion_from_dict(dict_name)"{{{
return keyword_dict
endfunction"}}}
function! s:caching_prototype_from_dict(dict_name)"{{{
- let dict_files = split(globpath(&runtimepath, 'autoload/neocomplcache/sources/vim_complete/'.a:dict_name.'.dict'), '\n')
+ let dict_files = split(globpath(&runtimepath,
+ \ 'autoload/neocomplcache/sources/vim_complete/'.a:dict_name.'.dict'), '\n')
if empty(dict_files)
return {}
endif
View
10 vim/bundle/neocomplcache/autoload/neocomplcache/util.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: util.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 18 Aug 2012.
+" Last Modified: 04 Sep 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
@@ -28,6 +28,7 @@ let s:save_cpo = &cpo
set cpo&vim
let s:V = vital#of('neocomplcache')
+let s:List = vital#of('neocomplcache').import('Data.List')
function! neocomplcache#util#truncate_smart(...)"{{{
return call(s:V.truncate_smart, a:000)
@@ -84,9 +85,12 @@ endfunction"}}}
function! neocomplcache#util#escape_pattern(...)"{{{
return call(s:V.escape_pattern, a:000)
endfunction"}}}
-function! neocomplcache#util#iconv(...)
+function! neocomplcache#util#iconv(...)"{{{
return call(s:V.iconv, a:000)
-endfunction
+endfunction"}}}
+function! neocomplcache#util#uniq(...)"{{{
+ return call(s:List.uniq, a:000)
+endfunction"}}}
function! neocomplcache#util#glob(pattern, ...)"{{{
if a:pattern =~ "'"
View
420 vim/bundle/neocomplcache/doc/neocomplcache.txt
@@ -1,6 +1,6 @@
*neocomplcache.txt* Ultimate auto completion system for Vim
-Version: 7.1
+Version: 7.2
Author : Shougo <Shougo.Matsu@gmail.com>
License: MIT license {{{
Permission is hereby granted, free of charge, to any person obtaining
@@ -41,17 +41,12 @@ Changelog |neocomplcache-changelog|
==============================================================================
INTRODUCTION *neocomplcache-introduction*
-*neocomplcache* performs keyword completion by maintaining a cache of keywords in
-the current buffer. Because I implemented it by paying own expenses unlike the
-keyword completion including the Vim composing type, neocomplcache can be
-customized flexibly. Unfortunately neocomplcache may use more memory than
-other plugins.
-
- *neocomplcache-version5*
-Because all variable names are changed in neocomplcache Ver.5, there is no
-backward compatibility. In the case of an upgrade, you should use the next
-script which Mr.thinca made.
-http://gist.github.com/422503
+*neocomplcache* performs keyword completion by maintaining a cache of keywords
+in the current buffer. Because I implemented it by paying own expenses unlike
+the keyword completion including the Vim composing type, neocomplcache can be
+customized flexibly.
+Note that neocomplcache may consume more memory than other average plugins
+unfortunately.
==============================================================================
INSTALL *neocomplcache-install*
@@ -63,15 +58,16 @@ let g:neocomplcache_enable_at_startup = 1
in your .vimrc.
*neocomplcache-asyncronous*
-With neocomplcache Ver.6.0, if |vimproc| is installed, neocomplcache creates
-the cache asynchronously.
+With neocomplcache Ver.6.0 or later, when you have |vimproc| installed,
+neocomplcache creates caches asynchronously.
-vimproc is distributed at: http://github.com/Shougo/vimshell/tree/master
+vimproc is distributed at: http://github.com/Shougo/vimproc
To use vimproc, you must compile it. Refer to the vimproc documentation.
-Note: Snippets feature(snippets_complete source) was splitted from Ver.7.
- If you used it, please install snippets_complete source manually.
+Note: Snippets feature (snippets_complete source), which was originally
+ built-in, left since neocomplcache ver.7.
+ If you were using it, please install snippets_complete source manually.
https://github.com/Shougo/neocomplcache-snippets-complete
@@ -90,18 +86,19 @@ COMMANDS *neocomplcache-commands*
:NeoComplCacheToggle *:NeoComplCacheToggle*
Change a lock state of neocomplcache.
- While locking neocomplcache, automatic completion is not
- possible.
+ While neocomplcache is in locking, you can't use automatic
+ completions.
Note: This command enables neocomplcache when neocomplcache is
- disabled.
+ already disabled.
:Neco [{anim-number}] *:Neco*
Secret.
:NeoComplCacheLock *:NeoComplCacheLock*
Lock neocomplcache.
- While locking neocomplcache, manual completion is possible.
- The lock status is buffer local.
+ While neocomplcache is in locking, you can't use automatic
+ completions but can use manual completions.
+ The lock status is local to each buffer.
Note: This command is disabled when neocomplcache is disabled.
:NeoComplCacheUnlock *:NeoComplCacheUnlock*
@@ -110,20 +107,21 @@ COMMANDS *neocomplcache-commands*
:NeoComplCacheLockSource {source-name} *:NeoComplCacheLockSource*
Disable {source-name} source completion. Disable state is
- buffer local.
+ local to each buffer.
:NeoComplCacheUnlockSource {source-name} *:NeoComplCacheUnlockSource*
Unlock {source-name} source completion.
:NeoComplCacheAutoCompletionLength *:NeoComplCacheAutoCompletionLength*
Change start length of automatic completion.
- This length is buffer local.
+ This length value is local to each buffer.
:NeoComplCacheCachingBuffer [bufname] *:NeoComplCacheCachingBuffer*
- Caching [bufname] buffer. Warning: considerably take time,
- for the big buffer. Select current buffer when [bufname]
- omitted. When [bufname] buffer is not cacheed, perform only
- simple cacheing.
+ Cache [bufname] buffer.
+ Warning: it may take time considerably for the big buffer.
+ This selects current buffer when you omitted [bufname]. When
+ [bufname] buffer is not cached, this performs only simple
+ caching.
:NeoComplCacheCachingSyntax [filetype] *:NeoComplCacheCachingSyntax*
Caching [filetype] syntax file.
@@ -417,11 +415,14 @@ g:neocomplcache_next_keyword_patterns *g:neocomplcache_next_keyword_patterns*
autoload/neocomplcache.vim for the initial value.
g:neocomplcache_omni_patterns *g:neocomplcache_omni_patterns*
- This dictionary records keyword patterns to Omni completion.
- This is appointed in regular expression every file type.
- If this pattern is not defined, neocomplcache don't call
- |omnifunc|. For example, ruby and php omnifunc are disabled,
- because they are too slow.
+ This dictionary records keyword patterns used in
+ |omni_complete|. This is appointed in regular expression
+ every file type. If this pattern is not defined,
+ neocomplcache does't call 'omnifunc'.
+ Note: ruby and php omnifunc are disabled, because they are too
+ slow.
+ Note: Partial omnifunc has problem when neocomplcache call(Ex:
+ rubycomplete and cocoa.vim and clang_complete).
Because it is complicated, refer to s:source.initialize()
autoload/neocomplcache/sources/omni_complete.vim for the
@@ -436,6 +437,25 @@ g:neocomplcache_omni_patterns *g:neocomplcache_omni_patterns*
let g:neocomplcache_omni_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
let g:neocomplcache_omni_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
<
+g:neocomplcache_force_omni_patterns
+ *g:neocomplcache_force_omni_patterns*
+ This dictionary records keyword patterns to Omni completion.
+ This is appointed in regular expression every file type.
+ If this pattern is not defined, neocomplcache don't call
+ 'omnifunc'.
+ Note: If it is set, neocomplcache wil call 'omnifunc'
+ directly. So almost neocomplcache features are disabled. But
+ all Omni completion works instead of
+ |g:neocomplcache_omni_patterns|.
+>
+ if !exists('g:neocomplcache_force_omni_patterns')
+ let g:neocomplcache_force_omni_patterns = {}
+ endif
+ let g:neocomplcache_force_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
+<
+ Because it is complicated, refer to neocomplcache#enable() in
+ autoload/neocomplcache.vim for the initial value.
+>
g:neocomplcache_tags_filter_patterns *g:neocomplcache_tags_filter_patterns*
This dictionary records a pattern to filter a candidate in
the tag completion. For example, it can exclude a candidate
@@ -951,10 +971,10 @@ include_complete.vim *include_complete*
refers to to candidate. It is convenient, because you do
not need to prepare a tags file and a dictionary file.
But it is necessary for 'path' and 'include',
- 'includeexpr' to be set adequately. If vimproc is installed,
- neocomplcache will cache. But if not installed, auto caching
- feature is disabled. Please execute
- |:NeoComplCacheCachingInclude| manually.
+ 'includeexpr' to be set adequately.
+ Note: If vimproc is installed, neocomplcache will cache. But
+ if not installed, auto caching feature is disabled. Please
+ execute |:NeoComplCacheCachingInclude| manually.
vim_complete.vim *vim_complete*
This source analyzes context and start Omni completion of
@@ -982,6 +1002,26 @@ omni_complete.vim *omni_complete*
abbrev_complete.vim *abbrev_complete*
This source collects candidates from abbrev.
+
+suffix of complete candidates in popup menu declaration.
+(This will be good for user to know where candidate from and what it is.)
+
+ abbrev_complete -> [A]
+ filename_complete -> [F] {filename}
+ dictionary_complete -> [D] {words}
+ member_complete -> [M] member
+ buffer_complete -> [B] {buffername}
+ syntax_complete -> [S] {syntax-keyword}
+ include_complete -> [FI] or [I]
+ snippets_complete -> [Snip] (none placeholders) or
+ <Snip> (contains placeholders)
+ vim_complete -> [vim] type
+ omni_complete -> [O]
+ tags_complete -> [T]
+ other plugin sources -> [plugin-name-prefix]
+ other completefunc sources -> [plugin-name-prefix]
+ other ftplugin sources -> [plugin-name-prefix]
+
------------------------------------------------------------------------------
USER SOURCES *neocomplcache-user-sources*
@@ -1036,51 +1076,151 @@ A: Like this:
highlight PmenuSbar ctermbg=0 guibg=#d6d6d6
<
-Q: Python(or Ruby) interface crashes Vim using neocomplcache:
-
-A: This is not neocomplcache issue. Please report to omnicomplete(rubycomplete
-or pythoncomplete) and Vim interface maintainer.
+Q: Python (or Ruby) interface crashes Vim when I use neocomplcache or not
+responding when input ".":
+A: This is not neocomplcache's issue. Please report to the maintainers of the
+omnicomplete (rubycomplete or pythoncomplete) and its Vim interface. You
+should disable omni_complete in python or ruby.
+>
+ if !exists('g:neocomplcache_omni_patterns')
+ let g:neocomplcache_omni_patterns = {}
+ endif
+ let g:neocomplcache_omni_patterns.python = ''
+ let g:neocomplcache_omni_patterns.ruby = ''
+<
-Q: I like to move cursor by cursor keys. But neocomplcache popups menus...
+Q: I like moving cursor by cursor-keys. But neocomplcache popups menus...
-A: Please set this in your .vimrc. But this feature requires Vim 7.3.418 or
-above.
+A: Please set this in your .vimrc. Note that this feature requires Vim 7.3.418
+or later.
>
let g:neocomplcache_enable_insert_char_pre = 1
<
-Q: Where is snippets for neocomplcache?
+Q: Where is snippets set for neocomplcache?
A: https://github.com/Shougo/neocomplcache-snippets-complete
-Q: To disable python omni complete in neocomplcache?:
+
+Q: How I can disable python omni complete of neocomplcache?:
A:
>
- let g:neocomplcache_omni_patterns['python'] = ''
+ if !exists('g:neocomplcache_omni_patterns')
+ let g:neocomplcache_omni_patterns = {}
+ endif
+ let g:neocomplcache_omni_patterns.python = ''
<
+
Q: Can I enable quick match? :
-A: Quick match feature is removed in latest neocomplcache.
-Because quick match is hard to implement.
-But you can use |unite.vim| to quick match.
+A: Quick match feature had been removed in latest neocomplcache
+because quick match turned into hard to implement.
+But you can use |unite.vim| instead to use quick match.
>
imap <expr> - pumvisible() ?
\ "\<Plug>(neocomplcache_start_unite_quick_match)" : '-'
<
-Q: How can i change the order of candidates? :
-A: Please refer to g:neocomplcache_compare_function and
+Q: How can I change the order of candidates? :
+
+A: Please refer g:neocomplcache_compare_function and
g:neocomplcache_source_rank.
-Q: Input problem occurred in using uim-skk or other IME :
-A: It may be fixed |g:neocomplcache_enable_prefetch| is 1.
+Q: An input problem occurred in using uim-skk or other IMEs:
+
+A: It may be fixed with setting |g:neocomplcache_enable_prefetch| as 1.
+
+
+Q: include_complete does not work.
+
+A: include_complete depends on |vimproc|. I recommend you to install it. Also
+you can check 'path' option or change |g:neocomplcache_include_paths|.
+
+http://github.com/Shougo/vimproc
+
+
+Q: An error occurred in "sudo vim":
+
+A: neocomplcache does not support "sudo vim". You must use sudo.vim or set
+"Defaults always_set_home" in "/etc/sudoers", or must use "sudoedit" command.
+
+Ubuntu has a command "sudoedit" which can work well with neocomplcache.
+I'm not sure if other distros has this command...
+
+http://www.vim.org/scripts/script.php?script_id=729
+
+Q: Error occurred in ruby omni complete.
+https://github.com/vim-ruby/vim-ruby/issues/95
+
+A: Please set |g:neocomplcache_force_omni_patterns|.
+>
+ if !exists('g:neocomplcache_force_omni_patterns')
+ let g:neocomplcache_force_omni_patterns = {}
+ endif
+ let g:neocomplcache_force_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
+<
+
+Q: Does not work with clang_complete.
+
+A: Please try below settings.
+>
+ if !exists('g:neocomplcache_force_omni_patterns')
+ let g:neocomplcache_force_omni_patterns = {}
+ endif
+ let g:neocomplcache_force_overwrite_completefunc = 1
+ let g:neocomplcache_force_omni_patterns.c =
+ \ '[^.[:digit:] *\t]\%(\.\|->\)'
+ let g:neocomplcache_force_omni_patterns.cpp =
+ \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
+ let g:clang_complete_auto = 0
+ let g:clang_auto_select = 0
+ let g:clang_use_library = 0
+<
==============================================================================
CHANGELOG *neocomplcache-changelog*
+2012-09-10
+- Changed default cache lines in nofile buffer.
+
+2012-09-08
+- Deleted :NeoComplCacheSaveCache command.
+- Deleted save cache behavior.
+- Fixed caching behavior.
+- Added FAQ.
+
+2012-09-07
+- Fixed include_complete error.