Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated bundles and got embedded code in markdown working

  • Loading branch information...
commit 4a6a7e425697c867ad553107a4b75ded0349bf13 1 parent 12e5667
Tammer Saleh authored
Showing with 1,411 additions and 777 deletions.
  1. +9 −0 vim/after/syntax/markdown.vim
  2. +12 −6 vim/bundle/Gist.vim/autoload/gist.vim
  3. +167 −74 vim/bundle/ctrlp.vim/autoload/ctrlp.vim
  4. +25 −5 vim/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim
  5. +3 −2 vim/bundle/ctrlp.vim/autoload/ctrlp/dir.vim
  6. +8 −11 vim/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim
  7. +10 −7 vim/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim
  8. +1 −1  vim/bundle/ctrlp.vim/autoload/ctrlp/tag.vim
  9. +55 −7 vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim
  10. +172 −87 vim/bundle/ctrlp.vim/doc/ctrlp.txt
  11. +11 −8 vim/bundle/ctrlp.vim/plugin/ctrlp.vim
  12. +7 −9 vim/bundle/ctrlp.vim/readme.md
  13. +282 −197 vim/bundle/neocomplcache/autoload/neocomplcache.vim
  14. +12 −11 vim/bundle/neocomplcache/autoload/neocomplcache/cache.vim
  15. +26 −20 vim/bundle/neocomplcache/autoload/neocomplcache/sources/buffer_complete.vim
  16. +4 −7 vim/bundle/neocomplcache/autoload/neocomplcache/sources/dictionary_complete.vim
  17. +12 −11 vim/bundle/neocomplcache/autoload/neocomplcache/sources/include_complete.vim
  18. +0 −104 vim/bundle/neocomplcache/autoload/neocomplcache/sources/keyword_complete.vim
  19. +17 −11 vim/bundle/neocomplcache/autoload/neocomplcache/sources/member_complete.vim
  20. +9 −29 vim/bundle/neocomplcache/autoload/neocomplcache/sources/omni_complete.vim
  21. +8 −10 vim/bundle/neocomplcache/autoload/neocomplcache/sources/syntax_complete.vim
  22. +3 −6 vim/bundle/neocomplcache/autoload/neocomplcache/sources/tags_complete.vim
  23. +1 −0  vim/bundle/neocomplcache/autoload/neocomplcache/sources/vim_complete/autocmds.dict
  24. +259 −111 vim/bundle/neocomplcache/doc/neocomplcache.txt
  25. +5 −1 vim/bundle/neocomplcache/plugin/neocomplcache.vim
  26. +29 −7 vim/bundle/tcomment_vim/autoload/tcomment.vim
  27. +29 −1 vim/bundle/tcomment_vim/doc/tcomment.txt
  28. +3 −3 vim/bundle/tcomment_vim/plugin/tcomment.vim
  29. +12 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30.vim
  30. +14 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30_sel=exclusive.vim
  31. +13 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30_sel=inclusive.vim
  32. +4 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30_test.c
  33. +6 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30_test_1.c
  34. +4 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30_test_2.c
  35. +4 −0 vim/bundle/tcomment_vim/spec/tcomment/issue30_test_3.c
  36. +17 −14 vim/bundle/vim-endwise/plugin/endwise.vim
  37. +8 −7 vim/bundle/vim-fugitive/plugin/fugitive.vim
  38. +8 −0 vim/bundle/vim-json/.gitignore
  39. +1 −0  vim/bundle/vim-json/ftdetect/json.vim
  40. +32 −0 vim/bundle/vim-json/readme.md
  41. +95 −0 vim/bundle/vim-json/syntax/json.vim
  42. +5 −5 vim/bundle/vim-rails/autoload/rails.vim
  43. +1 −1  vim/bundle/vim-ruby/autoload/rubycomplete.vim
  44. +1 −0  vim/update_bundles
  45. +7 −4 vim/vimrc
View
9 vim/after/syntax/markdown.vim
@@ -0,0 +1,9 @@
+unlet b:current_syntax
+syntax include @Ruby syntax/ruby.vim
+syntax region rubyCode start=+\~\{3\}\s*ruby+ keepend end=+\~\{3\}+ contains=@Ruby
+
+unlet b:current_syntax
+syntax include @Json syntax/json.vim
+syntax region jsonCode start=+\~\{3\}\s*json+ keepend end=+\~\{3\}+ contains=@Json
+syntax region noCode start=+\~\{3\}\s*$+ keepend end=+\~\{3\}+ contains=NONE
+
View
18 vim/bundle/Gist.vim/autoload/gist.vim
@@ -1,8 +1,8 @@
"=============================================================================
" File: gist.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
-" Last Change: 09-Jul-2012.
-" Version: 6.8
+" Last Change: 07-Sep-2012.
+" Version: 6.9
" WebPage: http://github.com/mattn/gist-vim
" License: BSD
@@ -12,7 +12,8 @@ set cpo&vim
let s:configfile = expand('~/.gist-vim')
if !exists('g:github_user')
- let g:github_user = substitute(system('git config --get github.user'), "\n", '', '')
+ let s:system = function(get(g:, 'webapi#system_function', 'system'))
+ let g:github_user = substitute(s:system('git config --get github.user'), "\n", '', '')
if strlen(g:github_user) == 0
let g:github_user = $GITHUB_USER
end
@@ -23,7 +24,7 @@ function! s:get_browser_command()
if gist_browser_command == ''
if has('win32') || has('win64')
let gist_browser_command = '!start rundll32 url.dll,FileProtocolHandler %URL%'
- elseif has('mac')
+ elseif has('mac') || has('macunix') || has('gui_macvim') || system('uname') =~? '^darwin'
let gist_browser_command = 'open %URL%'
elseif executable('xdg-open')
let gist_browser_command = 'xdg-open %URL%'
@@ -224,7 +225,9 @@ function! s:GistGet(gistid, clipboard)
endif
setlocal modifiable
else
- exec 'silent noautocmd split' s:bufprefix.a:gistid."/".fnameescape(filename)
+ exec 'silent noautocmd new'
+ setlocal noswapfile
+ exec 'noautocmd file' s:bufprefix.a:gistid."/".fnameescape(filename)
endif
set undolevels=-1
filetype detect
@@ -516,7 +519,10 @@ function! gist#Gist(count, line1, line2, ...)
let args = (a:0 > 0) ? s:shellwords(a:1) : []
for arg in args
- if arg =~ '^\(-la\|--listall\)$\C'
+ if arg =~ '^\(-h\|--help\)$\C'
+ help :Gist
+ return
+ elseif arg =~ '^\(-la\|--listall\)$\C'
let gistls = '-all'
elseif arg =~ '^\(-ls\|--liststar\)$\C'
let gistls = 'starred'
View
241 vim/bundle/ctrlp.vim/autoload/ctrlp.vim
@@ -6,7 +6,8 @@
" =============================================================================
" ** Static variables {{{1
-fu! s:ignore() "{{{2
+" s:ignore() {{{2
+fu! s:ignore()
let igdirs = [
\ '\.git',
\ '\.hg',
@@ -48,20 +49,23 @@ fu! s:ignore() "{{{2
\ 'dir': '\v[\/]('.join(igdirs, '|').')$',
\ 'file': '\v'.join(igfiles, '|'),
\ }
-endf "}}}2
-" Options
-let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
+endf
+" Script local vars {{{2
+let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
+ \ ['g:ctrlp_', 'b:ctrlp_', {
+ \ 'abbrev': ['s:abbrev', {}],
\ 'arg_map': ['s:argmap', 0],
\ 'buffer_func': ['s:buffunc', {}],
\ 'by_filename': ['s:byfname', 0],
\ 'custom_ignore': ['s:usrign', s:ignore()],
\ 'default_input': ['s:deftxt', 0],
\ 'dont_split': ['s:nosplit', 'netrw'],
- \ 'dotfiles': ['s:dotfiles', 1],
+ \ 'dotfiles': ['s:showhidden', 0],
\ 'extensions': ['s:extensions', []],
\ 'follow_symlinks': ['s:folsym', 0],
\ 'highlight_match': ['s:mathi', [1, 'CtrlPMatch']],
\ 'jump_to_buffer': ['s:jmptobuf', 'Et'],
+ \ 'key_loop': ['s:keyloop', 0],
\ 'lazy_update': ['s:lazy', 0],
\ 'match_func': ['s:matcher', {}],
\ 'match_window_bottom': ['s:mwbottom', 1],
@@ -83,12 +87,17 @@ let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
\ 'use_caching': ['s:caching', 1],
\ 'use_migemo': ['s:migemo', 0],
\ 'user_command': ['s:usrcmd', ''],
- \ 'working_path_mode': ['s:pathmode', 'rc'],
+ \ 'working_path_mode': ['s:pathmode', 'ra'],
\ }, {
\ 'open_multiple_files': 's:opmul',
\ 'regexp': 's:regexp',
\ 'reuse_window': 's:nosplit',
+ \ 'show_hidden': 's:showhidden',
\ 'switch_buffer': 's:jmptobuf',
+ \ }, {
+ \ 'root_markers': 's:rmarkers',
+ \ 'user_command': 's:usrcmd',
+ \ 'working_path_mode': 's:pathmode',
\ }]
" Global options
@@ -138,8 +147,6 @@ if !has('gui_running')
cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0))
en
-let s:lash = ctrlp#utils#lash()
-
let s:compare_lim = 3000
let s:ficounts = {}
@@ -174,9 +181,8 @@ let s:hlgrps = {
\ 'PrtText': 'Normal',
\ 'PrtCursor': 'Constant',
\ }
-
-fu! s:opts() "{{{2
- " Options
+" s:opts() {{{2
+fu! s:opts(...)
unl! s:usrign s:usrcmd s:urprtmaps
for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each)
let {each} = s:{each}
@@ -188,14 +194,36 @@ fu! s:opts() "{{{2
for [ke, va] in items(s:new_opts)
let {va} = {exists(s:pref.ke) ? s:pref.ke : va}
endfo
+ unl va
+ for [ke, va] in items(s:lc_opts)
+ if exists(s:bpref.ke)
+ unl {va}
+ let {va} = {s:bpref.ke}
+ en
+ endfo
+ if a:0 && a:1 != {}
+ unl va
+ for [ke, va] in items(a:1)
+ let opke = substitute(ke, '\(\w:\)\?ctrlp_', '', '')
+ if has_key(s:lc_opts, opke)
+ let sva = s:lc_opts[opke]
+ unl {sva}
+ let {sva} = va
+ en
+ endfo
+ en
for each in ['byfname', 'regexp'] | if exists(each)
let s:{each} = {each}
en | endfo
if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en
let s:maxdepth = min([s:maxdepth, 100])
let s:mxheight = max([s:mxheight, 1])
- let s:glob = s:dotfiles ? '.*\|*' : '*'
+ let s:glob = s:showhidden ? '.*\|*' : '*'
let s:igntype = empty(s:usrign) ? -1 : type(s:usrign)
+ let s:lash = ctrlp#utils#lash()
+ if s:keyloop
+ let [s:lazy, s:glbs['imd']] = [0, 0]
+ en
if s:lazy
cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) })
en
@@ -213,7 +241,6 @@ endf
"}}}1
" * Open & Close {{{1
fu! s:Open()
- let s:ermsg = v:errmsg
cal s:log(1)
cal s:getenv()
cal s:execextvar('enter')
@@ -249,7 +276,7 @@ fu! s:Close()
exe s:winres[0]
en
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
- \ s:mrbs
+ \ s:mrbs s:did_exp
cal ctrlp#recordhist()
cal s:execextvar('exit')
cal s:log(0)
@@ -262,18 +289,19 @@ fu! ctrlp#clr(...)
endf
fu! ctrlp#clra()
- let cache_dir = ctrlp#utils#cachedir()
- if isdirectory(cache_dir)
- let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n")
+ let cadir = ctrlp#utils#cachedir()
+ if isdirectory(cadir)
+ let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n")
let eval = '!isdirectory(v:val) && fnamemodify(v:val, ":t") !~'
\ . ' ''\v^<cache>[.a-z]+$|\.log$'''
- sil! cal map(filter(cache_files, eval), 'delete(v:val)')
+ sil! cal map(filter(cafiles, eval), 'delete(v:val)')
en
cal ctrlp#clr()
endf
-fu! ctrlp#reset()
- cal s:opts()
+fu! s:Reset(args)
+ let opts = has_key(a:args, 'opts') ? [a:args['opts']] : []
+ cal call('s:opts', opts)
cal s:autocmds()
cal ctrlp#utils#opts()
cal s:execextvar('opts')
@@ -285,7 +313,7 @@ fu! ctrlp#files()
let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []]
" Get the list of files
if empty(lscmd)
- cal s:GlobPath(s:dyncwd, 0)
+ cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0)
el
sil! cal ctrlp#progress('Indexing...')
try | cal s:UserCmd(lscmd)
@@ -316,7 +344,7 @@ fu! s:GlobPath(dirs, depth)
cal extend(g:ctrlp_allfiles, dnf[1])
if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth
sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1)
- cal s:GlobPath(join(dnf[0], ','), depth)
+ cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth)
en
endf
@@ -355,7 +383,7 @@ fu! s:lsCmd()
if s:findroot(s:dyncwd, cmd[0], 0, 1) == []
retu len(cmd) == 3 ? cmd[2] : ''
en
- let s:vcscmd = s:lash == '\' ? 1 : 0
+ let s:vcscmd = s:lash == '\'
retu cmd[1]
elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') )
let fndroot = []
@@ -372,7 +400,7 @@ fu! s:lsCmd()
for pair in cmdtypes
if pair[0] == fndroot[0] | brea | en
endfo
- let s:vcscmd = s:lash == '\' ? 1 : 0
+ let s:vcscmd = s:lash == '\'
retu pair[1]
en
endf
@@ -385,8 +413,9 @@ endf
" * MatchedItems() {{{1
fu! s:MatchIt(items, pat, limit, exc)
let [lines, id] = [[], 0]
- let pat = s:byfname ?
- \ map(split(a:pat, '^[^;]\+\zs;', 1), 's:martcs.v:val') : s:martcs.a:pat
+ let pat =
+ \ s:byfname ? map(split(a:pat, '^[^;]\+\\\@<!\zs;', 1), 's:martcs.v:val')
+ \ : s:martcs.a:pat
for item in a:items
let id += 1
try | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0
@@ -408,6 +437,7 @@ fu! s:MatchedItems(items, pat, limit)
let lines = s:MatchIt(items, a:pat, a:limit, exc)
en
let s:matches = len(lines)
+ unl! s:did_exp
retu lines
endf
@@ -446,7 +476,7 @@ endf
" * BuildPrompt() {{{1
fu! s:Render(lines, pat)
let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])]
- let pat = s:byfname ? split(a:pat, '^[^;]\+\zs;', 1)[0] : a:pat
+ let pat = s:byfname ? split(a:pat, '^[^;]\+\\\@<!\zs;', 1)[0] : a:pat
" Setup the match window
sil! exe '%d _ | res' s:height
" Print the new items
@@ -497,18 +527,14 @@ fu! s:Update(str)
endf
fu! s:ForceUpdate()
- let [estr, prt] = ['"\', copy(s:prompt)]
- cal map(prt, 'escape(v:val, estr)')
- sil! cal s:Update(join(prt, ''))
+ sil! cal s:Update(escape(s:getinput(), '\'))
endf
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)')
- let str = join(prt, '')
- let lazy = empty(str) || exists('s:force') || !has('autocmd') ? 0 : s:lazy
- if a:upd && !lazy && ( s:matches || s:regexp
+ let str = escape(s:getinput(), '\')
+ let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy
+ if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp')
\ || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' )
sil! cal s:Update(str)
en
@@ -520,6 +546,8 @@ fu! s:BuildPrompt(upd)
let hibase = 'CtrlPPrtBase'
" Build it
redr
+ let prt = copy(s:prompt)
+ cal map(prt, 'escape(v:val, ''"\'')')
exe 'echoh' hibase '| echon "'.base.'"
\ | echoh' hiactive '| echon "'.prt[0].'"
\ | echoh' hicursor '| echon "'.prt[1].'"
@@ -612,7 +640,7 @@ endf
fu! s:PrtExpandDir()
if !s:focus | retu | en
- let str = s:prompt[0]
+ let str = s:getinput('c')
if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi
let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs')
let str = get(hasat, 1, '')
@@ -690,7 +718,7 @@ fu! s:PrtSelectJump(char)
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
+ exe 'keepj norm!' ( jmpln + 1 ).'G'
if s:nolim != 1 | let s:cline = line('.') | en
if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
en
@@ -756,7 +784,6 @@ fu! s:MapNorms()
let cmd = substitute(pcmd, 'k%s', 'char-%d', '')
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
@@ -787,20 +814,34 @@ fu! s:MapSpecs()
endfo | endfo
let s:smapped = s:bufnr
endf
+
+fu! s:KeyLoop()
+ wh exists('s:init') && s:keyloop
+ redr
+ let nr = getchar()
+ let chr = !type(nr) ? nr2char(nr) : nr
+ if nr >=# 0x20
+ cal s:PrtFocusMap(chr)
+ el
+ let cmd = matchstr(maparg(chr), ':<C-U>\zs.\+\ze<CR>$')
+ exe ( cmd != '' ? cmd : 'norm '.chr )
+ en
+ endw
+endf
" * Toggling {{{1
fu! s:ToggleFocus()
- let s:focus = s:focus ? 0 : 1
+ let s:focus = !s:focus
cal s:BuildPrompt(0)
endf
fu! s:ToggleRegex()
- let s:regexp = s:regexp ? 0 : 1
+ let s:regexp = !s:regexp
cal s:PrtSwitcher()
endf
fu! s:ToggleByFname()
if s:ispath
- let s:byfname = s:byfname ? 0 : 1
+ let s:byfname = !s:byfname
let s:mfunc = s:mfunc()
cal s:PrtSwitcher()
en
@@ -814,6 +855,19 @@ fu! s:ToggleType(dir)
cal s:PrtSwitcher()
endf
+fu! s:ToggleKeyLoop()
+ let s:keyloop = !s:keyloop
+ if exists('+imd')
+ let &imd = !s:keyloop
+ en
+ if s:keyloop
+ let [&ut, s:lazy] = [0, 0]
+ cal s:KeyLoop()
+ elsei has_key(s:glbs, 'ut')
+ let [&ut, s:lazy] = [s:glbs['ut'], 1]
+ en
+endf
+
fu! s:PrtSwitcher()
let [s:force, s:matches] = [1, 1]
cal s:BuildPrompt(1)
@@ -821,13 +875,18 @@ fu! s:PrtSwitcher()
endf
" - SetWD() {{{1
fu! s:SetWD(args)
- let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
- let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:wpmode
+ if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0
+ \ && exists('s:dyncwd')
+ cal ctrlp#setdir(s:dyncwd) | retu
+ en
if has_key(a:args, 'dir') && a:args['dir'] != ''
cal ctrlp#setdir(a:args['dir']) | retu
en
+ let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode
+ let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
if s:crfile =~ '^.\+://' | retu | en
- if pmode =~ 'c' || ( !type(pmode) && pmode )
+ if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 )
+ \ || ( !type(pmode) && pmode )
if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en
cal ctrlp#setdir(s:crfpath)
en
@@ -846,7 +905,7 @@ fu! ctrlp#acceptfile(mode, line, ...)
let [md, filpath] = [a:mode, fnamemodify(a:line, ':p')]
cal s:PrtExit()
let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()]
- let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*'))
+ let j2l = a:0 ? a:1 : matchstr(tail, '^ +\zs\d\+$')
if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0
\ && !( md == 'e' && bufnr == bufnr('%') )
let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)]
@@ -907,7 +966,7 @@ endf
fu! s:AcceptSelection(mode)
if a:mode != 'e' && s:OpenMulti(a:mode) != -1 | retu | en
- let str = join(s:prompt, '')
+ let str = s:getinput()
if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en
" Get the selected line
let line = ctrlp#getcline()
@@ -926,7 +985,7 @@ fu! s:AcceptSelection(mode)
endf
" - CreateNewFile() {{{1
fu! s:CreateNewFile(...)
- let [md, str] = ['', join(s:prompt, '')]
+ let [md, str] = ['', s:getinput('n')]
if empty(str) | retu | en
if s:argmap && !a:0
" Get the extra argument
@@ -1054,7 +1113,7 @@ fu! s:OpenMulti(...)
if conds[nopt]
if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en
el
- cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1 ? 1 : 0)
+ cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1)
if jf | if ic == 1
let crpos = [tabpagenr(), winnr()]
el
@@ -1256,7 +1315,7 @@ endf
fu! s:dircompl(be, sd)
if a:sd == '' | retu [] | en
let [be, sd] = a:be == '' ? [s:dyncwd, a:sd] : [a:be, a:be.s:lash(a:be).a:sd]
- let dirs = ctrlp#rmbasedir(split(globpath(be, a:sd.'*/'), "\n"))
+ let dirs = ctrlp#rmbasedir(split(globpath(s:fnesc(be, 'g', ','), a:sd.'*/'), "\n"))
cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))'
\ . ' && v:val !~ ''\v(^|[\/])\.{1,2}[\/]$''')
retu dirs
@@ -1295,7 +1354,7 @@ fu! ctrlp#dirnfile(entries)
let etype = getftype(each)
if s:igntype >= 0 && s:usrign(each, etype) | con | en
if etype == 'dir'
- if s:dotfiles | if each !~ '[\/]\.\{1,2}$'
+ if s:showhidden | if each !~ '[\/]\.\{1,2}$'
cal add(items[0], each)
en | el
cal add(items[0], each)
@@ -1345,10 +1404,13 @@ endf
fu! s:findroot(curr, mark, depth, type)
let [depth, fnd] = [a:depth + 1, 0]
if type(a:mark) == 1
- let fnd = s:glbpath(a:curr, a:mark, 1) != ''
+ let fnd = s:glbpath(s:fnesc(a:curr, 'g', ','), a:mark, 1) != ''
elsei type(a:mark) == 3
for markr in a:mark
- if s:glbpath(a:curr, markr, 1) != '' | let fnd = 1 | brea | en
+ if s:glbpath(s:fnesc(a:curr, 'g', ','), markr, 1) != ''
+ let fnd = 1
+ brea
+ en
endfo
en
if fnd
@@ -1367,17 +1429,16 @@ endf
fu! ctrlp#setdir(path, ...)
let cmd = a:0 ? a:1 : 'lc!'
- sil! exe cmd ctrlp#fnesc(a:path)
+ sil! exe cmd s:fnesc(a:path, 'c')
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
endf
" Fallbacks {{{3
fu! s:glbpath(...)
- let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
- retu call('globpath', cond ? a:000 : a:000[:1])
+ retu call('ctrlp#utils#globpath', a:000)
endf
-fu! ctrlp#fnesc(path)
- retu exists('*fnameescape') ? fnameescape(a:path) : escape(a:path, " %#*?|<\"\n")
+fu! s:fnesc(...)
+ retu call('ctrlp#utils#fnesc', a:000)
endf
fu! ctrlp#setlcdir()
@@ -1524,9 +1585,9 @@ 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
+fu! ctrlp#modfilecond(w)
+ retu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf &&
+ \ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 )
endf
fu! s:nosplit()
@@ -1678,14 +1739,40 @@ endf
fu! s:narrowable()
retu exists('s:act_add') && exists('s:matched') && s:matched != []
\ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp]
- \ && s:matcher == {}
+ \ && s:matcher == {} && !exists('s:did_exp')
+endf
+
+fu! s:getinput(...)
+ let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )]
+ if s:abbrev != {}
+ let gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : ''
+ let str = ( gmd =~ 't' && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '')
+ if gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\k'
+ retu join(prt, '')
+ en
+ let [pf, rz] = [( s:byfname ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )]
+ for dict in s:abbrev['abbrevs']
+ let dmd = has_key(dict, 'mode') ? dict['mode'] : ''
+ let pat = escape(dict['pattern'], '~')
+ if ( dmd == '' || ( dmd =~ pf && dmd =~ rz && !a:0 )
+ \ || dmd =~ '['.spi.']' ) && str =~ pat
+ let [str, s:did_exp] = [join(split(str, pat, 1), dict['expanded']), 1]
+ en
+ endfo
+ if gmd =~ 't' && !a:0
+ let prt[0] = str
+ el
+ retu str
+ en
+ en
+ retu spi == 'c' ? prt[0] : join(prt, '')
endf
fu! s:migemo(str)
- let str = a:str
- let dict = s:glbpath(&rtp, printf("dict/%s/migemo-dict", &enc), 1)
+ let [str, rtp] = [a:str, s:fnesc(&rtp, 'g')]
+ let dict = s:glbpath(rtp, printf("dict/%s/migemo-dict", &enc), 1)
if !len(dict)
- let dict = s:glbpath(&rtp, "dict/migemo-dict", 1)
+ let dict = s:glbpath(rtp, "dict/migemo-dict", 1)
en
if len(dict)
let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s']
@@ -1702,12 +1789,12 @@ fu! s:strwidth(str)
endf
fu! ctrlp#j2l(nr)
- exe a:nr
+ exe 'norm!' a:nr.'G'
sil! norm! zvzz
endf
fu! s:maxf(len)
- retu s:maxfiles && a:len > s:maxfiles ? 1 : 0
+ retu s:maxfiles && a:len > s:maxfiles
endf
fu! s:regexfilter(str)
@@ -1747,8 +1834,6 @@ fu! s:getenv()
let [s:crword, s:crline] = [expand('<cword>', 1), getline('.')]
let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')]
let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]
- let s:wpmode = exists('b:ctrlp_working_path_mode')
- \ ? b:ctrlp_working_path_mode : s:pathmode
let [s:mrbs, s:crgfile] = [ctrlp#mrufiles#bufs(), expand('<cfile>', 1)]
endf
@@ -1782,15 +1867,17 @@ fu! s:buffunc(e)
endf
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 = a:cmd
+ if a:chkmod && cmd =~ '^[eb]$' && ctrlp#modfilecond(!( cmd == 'b' && &aw ))
+ let cmd = cmd == 'b' ? 'sb' : 'sp'
+ en
let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd
let j2l = a:0 && a:1[0] ? a:1[1] : 0
- exe cmd.( a:0 && a:1[0] ? '' : a:tail ) ctrlp#fnesc(a:fid)
+ exe cmd.( a:0 && a:1[0] ? '' : a:tail ) s:fnesc(a:fid, 'f')
if j2l
- exe j2l
+ cal ctrlp#j2l(j2l)
en
- if !empty(a:tail) || j2l
+ if !empty(a:tail)
sil! norm! zvzz
en
if cmd != 'bad'
@@ -1931,6 +2018,10 @@ fu! ctrlp#getcline()
retu !empty(s:lines) ? s:lines[line('.') - 1] : ''
endf
+fu! ctrlp#getmarkedlist()
+ retu exists('s:marked') ? values(s:marked) : []
+endf
+
fu! ctrlp#exit()
cal s:PrtExit()
endf
@@ -1970,8 +2061,9 @@ endf
fu! ctrlp#init(type, ...)
if exists('s:init') || s:iscmdwin() | retu | en
+ let [s:ermsg, v:errmsg] = [v:errmsg, '']
let [s:matches, s:init] = [1, 1]
- cal ctrlp#reset()
+ cal s:Reset(a:0 ? a:1 : {})
noa cal s:Open()
cal s:SetWD(a:0 ? a:1 : {})
cal s:MapNorms()
@@ -1980,6 +2072,7 @@ fu! ctrlp#init(type, ...)
cal ctrlp#setlines(s:settype(a:type))
cal s:SetDefTxt()
cal s:BuildPrompt(1)
+ if s:keyloop | cal s:KeyLoop() | en
endf
" - Autocmds {{{1
if has('autocmd')
View
30 vim/bundle/ctrlp.vim/autoload/ctrlp/buffertag.vim
@@ -149,8 +149,11 @@ fu! s:esctagscmd(bin, args, ...)
if exists('+ssl')
let [ssl, &ssl] = [&ssl, 0]
en
- let fname = a:0 == 1 ? shellescape(a:1) : ''
+ let fname = a:0 ? shellescape(a:1) : ''
let cmd = shellescape(a:bin).' '.a:args.' '.fname
+ if &sh =~ 'cmd\.exe'
+ let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
+ en
if exists('+ssl')
let &ssl = ssl
en
@@ -185,8 +188,8 @@ fu! s:process(fname, ftype)
endf
fu! s:parseline(line)
- let eval = '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)'
- let vals = matchlist(a:line, eval)
+ let vals = matchlist(a:line,
+ \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
if vals == [] | retu '' | en
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
@@ -202,6 +205,19 @@ fu! s:syntax()
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
en
endf
+
+fu! s:chknearby(pat)
+ if match(getline('.'), a:pat) < 0
+ let [int, forw, maxl] = [1, 1, line('$')]
+ wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
+ if !forw
+ if int > maxl | brea | en
+ let int += int
+ en
+ let forw = !forw
+ endw
+ en
+endf
" Public {{{1
fu! ctrlp#buffertag#init(fname)
let bufs = exists('s:btmode') && s:btmode
@@ -218,10 +234,14 @@ fu! ctrlp#buffertag#init(fname)
endf
fu! ctrlp#buffertag#accept(mode, str)
- let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
+ let vals = matchlist(a:str,
+ \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
let bufnr = str2nr(get(vals, 1))
if bufnr
- cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2))
+ cal ctrlp#acceptfile(a:mode, bufname(bufnr))
+ exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
+ cal s:chknearby('\V\C'.get(vals, 3, ''))
+ sil! norm! zvzz
en
endf
View
5 vim/bundle/ctrlp.vim/autoload/ctrlp/dir.vim
@@ -32,12 +32,13 @@ fu! s:globdirs(dirs, depth)
let nr = len(g:ctrlp_alldirs)
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
sil! cal ctrlp#progress(nr)
+ cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
cal s:globdirs(join(dirs, ','), depth)
en
endf
fu! s:max(len, max)
- retu a:max && a:len > a:max ? 1 : 0
+ retu a:max && a:len > a:max
endf
fu! s:nocache()
@@ -53,7 +54,7 @@ fu! ctrlp#dir#init(...)
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
- cal s:globdirs(s:cwd, 0)
+ cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
if len(g:ctrlp_alldirs) <= s:compare_lim
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
View
19 vim/bundle/ctrlp.vim/autoload/ctrlp/quickfix.vim
@@ -40,18 +40,15 @@ fu! ctrlp#quickfix#init()
endf
fu! ctrlp#quickfix#accept(mode, str)
- let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
- if items == [] | retu | en
- let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
- if empty(filpath) | retu | en
- cal ctrlp#exit()
- let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
- \ : ctrlp#normcmd('e')
- let cmd = cmd == 'e' && ctrlp#modfilecond() ? 'new' : cmd
- exe cmd ctrlp#fnesc(filpath)
- cal cursor(items[2], items[3])
+ let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
+ if vals == [] || vals[1] == '' | retu | en
+ cal ctrlp#acceptfile(a:mode, vals[1])
+ let cur_pos = getpos('.')[1:2]
+ if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
+ mark '
+ en
+ cal cursor(vals[2], vals[3])
sil! norm! zvzz
- cal ctrlp#setlcdir()
endf
fu! ctrlp#quickfix#id()
View
17 vim/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim
@@ -24,23 +24,26 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
let s:filecounts = {}
" Utilities {{{1
fu! s:nocache()
- retu !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
+ retu g:ctrlp_newrts ||
+ \ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
endf
" Public {{{1
fu! ctrlp#rtscript#init(caching)
let [s:caching, s:cwd] = [a:caching, getcwd()]
- if g:ctrlp_newrts || s:nocache()
- \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
+ if s:nocache() ||
+ \ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
sil! cal ctrlp#progress('Indexing...')
- let entries = split(globpath(&rtp, '**/*.*'), "\n")
+ let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
cal filter(entries, 'count(entries, v:val) == 1')
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
el
let [entries, results] = g:ctrlp_rtscache[2:3]
en
- if g:ctrlp_newrts || s:nocache()
- \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
- if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
+ if s:nocache() ||
+ \ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
+ if !exists('echoed')
+ sil! cal ctrlp#progress('Processing...')
+ en
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
en
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
View
2  vim/bundle/ctrlp.vim/autoload/ctrlp/tag.vim
@@ -97,7 +97,7 @@ fu! ctrlp#tag#accept(mode, str)
\ 'e': ['', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
- let cmd = a:mode == 'e' && ctrlp#modfilecond() && !&aw
+ 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
View
62 vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim
@@ -8,25 +8,28 @@
fu! ctrlp#utils#lash()
retu &ssl || !exists('+ssl') ? '/' : '\'
endf
-let s:lash = ctrlp#utils#lash()
fu! s:lash(...)
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
endf
fu! ctrlp#utils#opts()
+ let s:lash = ctrlp#utils#lash()
let usrhome = $HOME.s:lash($HOME)
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
- let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
+ let cadir = isdirectory(usrhome.'.ctrlp_cache')
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
if exists('g:ctrlp_cache_dir')
- let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
- if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
- let s:cache_dir = s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache'
+ let cadir = expand(g:ctrlp_cache_dir, 1)
+ if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
+ let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
en
en
+ let s:cache_dir = cadir
endf
cal ctrlp#utils#opts()
+
+let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
" Files and Directories {{{1
fu! ctrlp#utils#cachedir()
retu s:cache_dir
@@ -64,8 +67,53 @@ fu! ctrlp#utils#writecache(lines, ...)
endf
fu! ctrlp#utils#glob(...)
- let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
- retu call('glob', cond ? a:000 : [a:1])
+ let path = ctrlp#utils#fnesc(a:1, 'g')
+ retu s:wig_cond ? glob(path, a:2) : glob(path)
+endf
+
+fu! ctrlp#utils#globpath(...)
+ retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
+endf
+
+fu! ctrlp#utils#fnesc(path, type, ...)
+ if exists('*fnameescape')
+ if exists('+ssl')
+ if a:type == 'c'
+ let path = escape(a:path, '%#')
+ elsei a:type == 'f'
+ let path = fnameescape(a:path)
+ elsei a:type == 'g'
+ let path = escape(a:path, '?*')
+ en
+ let path = substitute(path, '[', '[[]', 'g')
+ el
+ let path = fnameescape(a:path)
+ en
+ el
+ if exists('+ssl')
+ if a:type == 'c'
+ let path = escape(a:path, '%#')
+ elsei a:type == 'f'
+ let path = escape(a:path, " \t\n%#*?|<\"")
+ elsei a:type == 'g'
+ let path = escape(a:path, '?*')
+ en
+ let path = substitute(path, '[', '[[]', 'g')
+ el
+ let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
+ en
+ en
+ retu a:0 ? escape(path, a:1) : path
+endf
+
+fu! ctrlp#utils#dircompl(...)
+ let [hsl, str] = [match(a:1, '[\/]'), '']
+ let par = substitute(a:1, '[^\/]*$', '', '')
+ let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
+ for dir in split(globpath(ctrlp#utils#fnesc(path, 'g', ','), '*/'), '\n')
+ let str .= par.split(dir, '[\/]')[-1]."\n"
+ endfo
+ retu str
endf
"}}}
View
259 vim/bundle/ctrlp.vim/doc/ctrlp.txt
@@ -35,50 +35,52 @@ OPTIONS *ctrlp-options*
Overview:~
- |loaded_ctrlp| Disable the plugin.
- |ctrlp_map| Default mapping.
- |ctrlp_cmd| Default command used for the default mapping.
- |ctrlp_by_filename| Default to filename mode or not.
- |ctrlp_regexp| Default to regexp mode or not.
- |ctrlp_match_window_bottom| Where to show the match window.
- |ctrlp_match_window_reversed| Sort order in the match window.
- |ctrlp_max_height| Max height of the match window.
- |ctrlp_switch_buffer| Jump to an open buffer if already opened.
- |ctrlp_reuse_window| Reuse special windows (help, quickfix, etc).
- |ctrlp_tabpage_position| Where to put the new tab page.
- |ctrlp_working_path_mode| How to set CtrlP's local working directory.
- |ctrlp_root_markers| Additional, high priority root markers.
- |ctrlp_use_caching| Use per-session caching or not.
- |ctrlp_clear_cache_on_exit| Keep cache after exiting Vim or not.
- |ctrlp_cache_dir| Location of the cache directory.
- |ctrlp_dotfiles| Ignore dotfiles and dotdirs or not.
- |ctrlp_custom_ignore| Hide stuff when using |globpath()|.
- |ctrlp_max_files| Number of files to scan initially.
- |ctrlp_max_depth| Directory depth to recurse into when scanning.
- |ctrlp_user_command| Use an external scanner.
- |ctrlp_max_history| Number of entries saved in the prompt history.
- |ctrlp_open_new_file| How to open a file created by <c-y>.
- |ctrlp_open_multiple_files| How to open files selected by <c-z>.
- |ctrlp_arg_map| Intercept <c-y> and <c-o> or not.
- |ctrlp_follow_symlinks| Follow symbolic links or not.
- |ctrlp_lazy_update| Only update when typing has stopped.
- |ctrlp_default_input| Seed the prompt with an initial string.
- |ctrlp_use_migemo| Use Migemo patterns for Japanese filenames.
- |ctrlp_prompt_mappings| Change the mappings in the prompt.
+ |loaded_ctrlp|................Disable the plugin.
+ |ctrlp_map|...................Default mapping.
+ |ctrlp_cmd|...................Default command used for the default mapping.
+ |ctrlp_by_filename|...........Default to filename mode or not.
+ |ctrlp_regexp|................Default to regexp mode or not.
+ |ctrlp_match_window_bottom|...Where to show the match window.
+ |ctrlp_match_window_reversed|.Sort order in the match window.
+ |ctrlp_max_height|............Max height of the match window.
+ |ctrlp_switch_buffer|.........Jump to an open buffer if already opened.
+ |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).
+ |ctrlp_tabpage_position|......Where to put the new tab page.
+ |ctrlp_working_path_mode|.....How to set CtrlP's local working directory.
+ |ctrlp_root_markers|..........Additional, high priority root markers.
+ |ctrlp_use_caching|...........Use per-session caching or not.
+ |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.
+ |ctrlp_cache_dir|.............Location of the cache directory.
+ |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.
+ |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.
+ |ctrlp_max_files|.............Number of files to scan initially.
+ |ctrlp_max_depth|.............Directory depth to recurse into when scanning.
+ |ctrlp_user_command|..........Use an external scanner.
+ |ctrlp_max_history|...........Number of entries saved in the prompt history.
+ |ctrlp_open_new_file|.........How to open a file created by <c-y>.
+ |ctrlp_open_multiple_files|...How to open files selected by <c-z>.
+ |ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.
+ |ctrlp_follow_symlinks|.......Follow symbolic links or not.
+ |ctrlp_lazy_update|...........Only update when typing has stopped.
+ |ctrlp_default_input|.........Seed the prompt with an initial string.
+ |ctrlp_abbrev|................Input abbreviations.
+ |ctrlp_key_loop|..............Use input looping for multi-byte input.
+ |ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.
+ |ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
MRU mode:
- |ctrlp_mruf_max| Max MRU entries to remember.
- |ctrlp_mruf_exclude| Files that shouldn't be remembered.
- |ctrlp_mruf_include| Files to be remembered.
- |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_max|..............Max MRU entries to remember.
+ |ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
+ |ctrlp_mruf_include|..........Files to be remembered.
+ |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.
Advanced options:
- |ctrlp_open_func| Use custom file opening functions.
- |ctrlp_status_func| Change CtrlP's two statuslines.
- |ctrlp_buffer_func| Call custom functions in the CtrlP buffer.
- |ctrlp_match_func| Replace the built-in matching algorithm.
+ |ctrlp_open_func|.............Use custom file opening functions.
+ |ctrlp_status_func|...........Change CtrlP's two statuslines.
+ |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.
+ |ctrlp_match_func|............Replace the built-in matching algorithm.
-------------------------------------------------------------------------------
Detailed descriptions and default values:~
@@ -128,16 +130,16 @@ Set the maximum height of the match window: >
<
*'g:ctrlp_switch_buffer'*
-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: >
+When opening a file, if it's already open in a window somewhere, CtrlP will try
+to jump to it instead of opening a new instance: >
let g:ctrlp_switch_buffer = 'Et'
<
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.
+ 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", but jump to windows anywhere.
+ 0 or <empty> - disable this feature.
*'g:ctrlp_reuse_window'*
When opening a file with <cr>, CtrlP avoids opening it in windows created by
@@ -163,24 +165,29 @@ Where to put the new tab page when opening one: >
*'g:ctrlp_working_path_mode'*
When starting up, CtrlP sets its local working directory according to this
variable: >
- let g:ctrlp_working_path_mode = 'rc'
+ let g:ctrlp_working_path_mode = 'ra'
<
c - the directory of the current file.
+ a - like "c", but only applies when the current working directory outside of
+ CtrlP isn't a direct ancestor of 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.
+ w - begin finding a root from the current working directory outside of CtrlP
+ instead of from the directory of the current file (default). Only applies
+ when "r" is also present.
+ 0 or <empty> - disable this feature.
-Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option
-on a per buffer basis.
+Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
+a fallback) when a root can't be found.
-Note #2: with both 'r' and 'c' in the option, when a root isn't found, use the
-directory of the current file.
+Note #2: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones (.git,
.hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
let g:ctrlp_root_markers = ['']
<
+Note: you can use a |b:var| to set this option on a per buffer basis.
*'g:ctrlp_use_caching'*
Enable/Disable per-session caching: >
@@ -190,6 +197,7 @@ Enable/Disable per-session caching: >
1 - Enable caching.
n - When bigger than 1, disable caching and use the number as the limit to
enable caching again.
+
Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
*'g:ctrlp_clear_cache_on_exit'*
@@ -203,10 +211,12 @@ Set the directory to store the cache files: >
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
<
- *'g:ctrlp_dotfiles'*
-Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
- let g:ctrlp_dotfiles = 1
+ *'g:ctrlp_show_hidden'*
+Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
+ let g:ctrlp_show_hidden = 0
<
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
*'ctrlp-wildignore'*
You can use Vim's |'wildignore'| to exclude files and directories from the
@@ -229,10 +239,10 @@ CtrlP to not show. Use regexp to specify the patterns: >
let g:ctrlp_custom_ignore = ''
<
Examples: >
- let g:ctrlp_custom_ignore = '\v[\/](\.git|\.hg|\.svn)$'
+ let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
- \ 'dir': '\v[\/](\.git|\.hg|\.svn)$',
- \ 'file': '\.exe$\|\.so$\|\.dll$',
+ \ 'dir': '\v[\/]\.(git|hg|svn)$',
+ \ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
\ }
let g:ctrlp_custom_ignore = {
@@ -250,12 +260,15 @@ first or restart Vim to avoid the "E706: Variable type mismatch" error.
The maximum number of files to scan, set to 0 for no limit: >
let g:ctrlp_max_files = 10000
<
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
*'g:ctrlp_max_depth'*
The maximum depth of a directory tree to recurse into: >
let g:ctrlp_max_depth = 40
<
-Note: the larger these values, the more memory Vim uses.
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
*'g:ctrlp_user_command'*
Specify an external tool to use for listing files instead of using Vim's
@@ -309,17 +322,19 @@ Some examples: >
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.
+Note #1: if the fallback_command is empty or the 'fallback' key is not defined,
+|globpath()| will then be used when scanning outside of a repository.
Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set
to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when
-these custom commands are being used. When not defined, 'ignore' is set to 0 by
+these custom commands are being used. When not present, 'ignore' is set to 0 by
default to retain the performance advantage of using external commands.
Note #3: when changing the option's variable type, remember to |:unlet| it
first or restart Vim to avoid the "E706: Variable type mismatch" error.
+Note #4: you can use a |b:var| to set this option on a per buffer basis.
+
*'g:ctrlp_max_history'*
The maximum number of input strings you want CtrlP to remember. The default
value mirrors Vim's global |'history'| option: >
@@ -329,14 +344,13 @@ Set to 0 to disable prompt's history. Browse the history with <c-n> and <c-p>.
*'g:ctrlp_open_new_file'*
Use this option to specify how the newly created file is to be opened when
-pressing <c-y>:
- t - in a new tab
- h - in a new horizontal split
- v - in a new vertical split
- r - in the current window
->
+pressing <c-y>: >
let g:ctrlp_open_new_file = 'v'
<
+ t - in a new tab.
+ h - in a new horizontal split.
+ v - in a new vertical split.
+ r - in the current window.
*'g:ctrlp_open_multiple_files'*
If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
@@ -357,7 +371,8 @@ For the letters:
i - all files as hidden buffers.
j - after opening, jump to the first opened tab or window.
r - open the first file in the current window, then the remaining files in
- new splits or new tabs depending on which of h, v and t is also present.
+ new splits or new tabs depending on which of "h", "v" and "t" is also
+ present.
*'g:ctrlp_arg_map'*
When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
@@ -383,6 +398,9 @@ If non-zero, CtrlP will follow symbolic links when listing files: >
1 - follow but ignore looped internal symlinks to avoid duplicates.
2 - follow all symlinks indiscriminately.
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
+
*'g:ctrlp_lazy_update'*
Set this to 1 to enable the lazy-update feature: only update the match window
after typing's been stopped for a certain amount of time: >
@@ -401,6 +419,68 @@ as the default input: >
let g:ctrlp_default_input = 'anystring'
<
+ *'g:ctrlp_abbrev'*
+Define input abbreviations that can be expanded (either internally or visibly)
+in the prompt: >
+ let g:ctrlp_abbrev = {}
+<
+Examples: >
+ let g:ctrlp_abbrev = {
+ \ 'gmode': 'i',
+ \ 'abbrevs': [
+ \ {
+ \ 'pattern': '^cd b',
+ \ 'expanded': '@cd ~/.vim/bundle',
+ \ 'mode': 'pfrz',
+ \ },
+ \ {
+ \ 'pattern': '\(^@.\+\|\\\@<!:.\+\)\@<! ',
+ \ 'expanded': '.\{-}',
+ \ 'mode': 'pfr',
+ \ },
+ \ {
+ \ 'pattern': '\\\@<!:.\+\zs\\\@<! ',
+ \ 'expanded': '\ ',
+ \ 'mode': 'pfz',
+ \ },
+ \ ]
+ \ }
+<
+The 'pattern' string is regexp matched against the entered input. The expansion
+is as if the 'expanded' string was typed into the prompt.
+
+For 'gmode' (optional):
+ i - expand internally (default).
+ t - insert the expanded results into the prompt as you type.
+ k - insert the expanded results when a non-keyword character is typed. Only
+ applies when "t" is also present.
+
+For 'mode' (of each entry; optional):
+ f - only in filename mode.
+ p - only in full path mode.
+ r - only in regexp mode.
+ z - only in fuzzy mode.
+ n - only when creating a new file with <c-y> (use the expanded string in the
+ new filename).
+ c - only when auto-completing directory names with <tab> (expand the pattern
+ immediately before doing the auto-completion).
+ <empty> or not defined - always enable.
+
+Note: the abbrev entries are evaluated in sequence, so a later entry can be
+evaluated against the expanded result of a previous entry; this includes itself
+when 'gmode' is "t".
+
+ *'g:ctrlp_key_loop'*
+An experimental feature. Set this to 1 to enable input looping for the typing
+of multi-byte characters: >
+ let g:ctrlp_key_loop = 0
+<
+Note #1: when set, this option resets the |g:ctrlp_lazy_update| option.
+
+Note #2: you can toggle this feature inside the prompt with a custom mapping: >
+ let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
+<
+
*'g:ctrlp_use_migemo'*
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
works in regexp mode. To split the pattern, separate words with space: >
@@ -668,12 +748,13 @@ COMMANDS *ctrlp-commands*
Open CtrlP in find Most-Recently-Used file mode.
*:CtrlPLastMode*
-:CtrlPLastMode
- Open CtrlP in the last mode used.
+:CtrlPLastMode [--dir]
+ Open CtrlP in the last mode used. When having the "--dir" argument, also
+ reuse the last working directory.
*:CtrlPRoot*
:CtrlPRoot
- This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'rc' and ignores
+ This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
the variable's current value.
*:CtrlPClearCache*
@@ -940,7 +1021,7 @@ Available extensions:~
*:CtrlPTag*
* Tag mode:~
- Name: 'tag'
- - Command: ':CtrlPTag'
+ - Command: ":CtrlPTag"
- Search for a tag within a generated central tags file, and jump to the
definition. Use the Vim's option |'tags'| to specify the names and the
locations of the tags file(s).
@@ -950,21 +1031,21 @@ Available extensions:~
*:CtrlPBufTagAll*
* Buffer Tag mode:~
- Name: 'buffertag'
- - Commands: ':CtrlPBufTag [buffer]',
- ':CtrlPBufTagAll'.
+ - Commands: ":CtrlPBufTag [buffer]",
+ ":CtrlPBufTagAll".
- Search for a tag within the current buffer or all listed buffers and jump
to the definition. Requires |exuberant_ctags| or compatible programs.
*:CtrlPQuickfix*
* Quickfix mode:~
- Name: 'quickfix'
- - Command: ':CtrlPQuickfix'
+ - Command: ":CtrlPQuickfix"
- Search for an entry in the current quickfix errors and jump to it.
*:CtrlPDir*
* Directory mode:~
- Name: 'dir'
- - Command: ':CtrlPDir [starting-directory]'
+ - Command: ":CtrlPDir [starting-directory]"
- Search for a directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for CtrlP and keep it open.
@@ -976,42 +1057,42 @@ Available extensions:~
*:CtrlPRTS*
* Runtime script mode:~
- Name: 'rtscript'
- - Command: ':CtrlPRTS'
+ - Command: ":CtrlPRTS"
- Search for files (vimscripts, docs, snippets...) in runtimepath.
*:CtrlPUndo*
* Undo mode:~
- Name: 'undo'
- - Command: ':CtrlPUndo'
+ - Command: ":CtrlPUndo"
- Browse undo history.
*:CtrlPLine*
* Line mode:~
- Name: 'line'
- - Command: ':CtrlPLine'
+ - Command: ":CtrlPLine"
- Search for a line in all listed buffers.
*:CtrlPChange*
*:CtrlPChangeAll*
* Change list mode:~
- Name: 'changes'
- - Commands: ':CtrlPChange [buffer]',
- ':CtrlPChangeAll'.
+ - Commands: ":CtrlPChange [buffer]",
+ ":CtrlPChangeAll".
- Search for and jump to a recent change in the current buffer or in all
listed buffers.
*:CtrlPMixed*
* Mixed mode:~
- Name: 'mixed'
- - Command: ':CtrlPMixed'
+ - Command: ":CtrlPMixed"
- Search in files, buffers and MRU files at the same time.
*:CtrlPBookmarkDir*
*:CtrlPBookmarkDirAdd*
* BookmarkDir mode:~
- Name: 'bookmarkdir'
- - Commands: ':CtrlPBookmarkDir',
- ':CtrlPBookmarkDirAdd [directory]'.
+ - Commands: ":CtrlPBookmarkDir",
+ ":CtrlPBookmarkDirAdd [directory]".
- Search for a bookmarked directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for CtrlP, keep it open and
@@ -1163,11 +1244,15 @@ Special thanks:~
===============================================================================
CHANGELOG *ctrlp-changelog*
+ + New options: |g:ctrlp_abbrev|,
+ |g:ctrlp_key_loop|,
+ |g:ctrlp_open_func|,
+ |g:ctrlp_tabpage_position|
+ + Rename:
+ *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
+ 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|.
Before 2012/06/15~
View
19 vim/bundle/ctrlp.vim/plugin/ctrlp.vim
@@ -17,23 +17,24 @@ let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
-com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
-com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlP
+ \ cal ctrlp#init(0, { 'dir': <q-args> })
+
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPMRUFiles
+ \ cal ctrlp#init(2, { 'dir': <q-args> })
com! -bar CtrlPBuffer cal ctrlp#init(1)
-com! -bar CtrlPLastMode cal ctrlp#init(-1)
+com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
com! -bar CtrlPClearCache cal ctrlp#clr()
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
-com! -bar CtrlPReload cal ctrlp#reset()
com! -bar ClearCtrlPCache cal ctrlp#clr()
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
-com! -bar ResetCtrlP cal ctrlp#reset()
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
-com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'rc' })
+com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
@@ -44,7 +45,7 @@ cal ctrlp#mrufiles#init()
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
-com! -n=? -com=dir CtrlPDir
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPDir
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
com! -n=? -com=buffer CtrlPBufTag
@@ -62,5 +63,7 @@ com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
-com! -n=? -com=dir CtrlPBookmarkDirAdd
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPBookmarkDirAdd
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
+
+" vim:ts=2:sw=2:sts=2
View
16 vim/bundle/ctrlp.vim/readme.md
@@ -32,8 +32,6 @@ Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
Use `:25` to jump to line 25.
-Use `:/any\:\ string` to jump to the first instance of `any: string`.
-Use `:+setfiletype\ myfiletype|25` to set the filetype to myfiletype, then jump to line 25.
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
## Basic Options
@@ -47,13 +45,13 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
```vim
- let g:ctrlp_working_path_mode = 'rc'
+ let g:ctrlp_working_path_mode = 'ra'
```
`'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.
+ `'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
+ `'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
+ `0` or `''` (empty string) - disable this feature.
Define additional root markers with the `g:ctrlp_root_markers` option.
@@ -63,10 +61,10 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
- let g:ctrlp_custom_ignore = '\v[\/](\.git|\.hg|\.svn)$'
+ let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
- \ 'dir': '\v[\/](\.git|\.hg|\.svn)$',
- \ 'file': '\.exe$\|\.so$\|\.dll$',
+ \ 'dir': '\v[\/]\.(git|hg|svn)$',
+ \ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
```
View
479 vim/bundle/neocomplcache/autoload/neocomplcache.vim
@@ -1,7 +1,7 @@
"=============================================================================
" FILE: neocomplcache.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
-" Last Modified: 08 Sep 2012.
+" Last Modified: 25 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
@@ -92,30 +92,6 @@ function! neocomplcache#enable() "{{{
call s:initialize_variables()
- " Initialize sources table."{{{
- " Search autoload.
- for file in split(globpath(&runtimepath, 'autoload/neocomplcache/sources/*.vim'), '\n')
- let source_name = fnamemodify(file, ':t:r')
- if !has_key(s:plugin_sources, source_name)
- \ && neocomplcache#is_source_enabled(source_name)
- let source = call('neocomplcache#sources#' . source_name . '#define', [])
- if empty(source)
- " Ignore.
- elseif source.kind ==# 'complfunc'
- let s:complfunc_sources[source_name] = source
- elseif source.kind ==# 'ftplugin'
- let s:ftplugin_sources[source_name] = source
-
- " Clear loaded flag.
- let s:ftplugin_sources[source_name].loaded = 0
- elseif source.kind ==# 'plugin'
- \ && neocomplcache#is_source_enabled('keyword_complete')
- let s:plugin_sources[source_name] = source
- endif
- endif
- endfor
- "}}}
-
" Initialize keyword patterns."{{{
if !exists('g:neocomplcache_keyword_patterns')
let g:neocomplcache_keyword_patterns = {}
@@ -131,13 +107,15 @@ function! neocomplcache#enable() "{{{
\'^=\%(b\%[egin]\|e\%[nd]\)\|\%(@@\|[:$@]\)\h\w*\|\h\w*\%(::\w*\)*[!?]\?')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'php,int-php',
- \'</\?\%(\h[[:alnum:]_-]*\s*\)\?\%(/\?>\)\?\|\$\h\w*\|\h\w*\%(\%(\\\|::\)\w*\)*')
+ \'</\?\%(\h[[:alnum:]_-]*\s*\)\?\%(/\?>\)\?'.
+ \'\|\$\h\w*\|\h\w*\%(\%(\\\|::\)\w*\)*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'perl,int-perlsh',
\'<\h\w*>\?\|[$@%&*]\h\w*\|\h\w*\%(::\w*\)*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'perl6,int-perl6',
- \'<\h\w*>\?\|[$@%&][!.*?]\?\h[[:alnum:]_-]*\|\h[[:alnum:]_-]*\%(::[[:alnum:]_-]*\)*')
+ \'<\h\w*>\?\|[$@%&][!.*?]\?\h[[:alnum:]_-]*'.
+ \'\|\h[[:alnum:]_-]*\%(::[[:alnum:]_-]*\)*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'pir',
\'[$@%.=]\?\h\w*')
@@ -146,11 +124,13 @@ function! neocomplcache#enable() "{{{
\'[=]\?\h\w*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'vim,help',
- \'-\h[[:alnum:]-]*=\?\|\c\[:\%(\h\w*:\]\)\?\|&\h[[:alnum:]_:]*\|'
- \'<SID>\%(\h\w*\)\?\|<Plug>([^)]*)\?\|<\h[[:alnum:]_-]*>\?\|\h[[:alnum:]_:#]*!\?\|$\h\w*')
+ \'-\h[[:alnum:]-]*=\?\|\c\[:\%(\h\w*:\]\)\?\|&\h[[:alnum:]_:]*\|'.
+ \'<SID>\%(\h\w*\)\?\|<Plug>([^)]*)\?'.
+ \'\|<\h[[:alnum:]_-]*>\?\|\h[[:alnum:]_:#]*!\?\|$\h\w*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'tex',
- \'\\\a{\a\{1,2}}\|\\[[:alpha:]@][[:alnum:]@]*\%({\%([[:alnum:]:_]\+\*\?}\?\)\?\)\?\|\a[[:alnum:]:_]*\*\?')
+ \'\\\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',
\'[[:alpha:]_.-][[:alnum:]_.-]*')
@@ -207,7 +187,8 @@ function! neocomplcache#enable() "{{{
\'^\s*-\h\w*\|\%(\h\w*:\)*\h\w\|\h[[:alnum:]_@]*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'html,xhtml,xml,markdown,eruby',
- \'</\?\%([[:alnum:]_:-]\+\s*\)\?\%(/\?>\)\?\|&\h\%(\w*;\)\?\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*')
+ \'</\?\%([[:alnum:]_:-]\+\s*\)\?\%(/\?>\)\?\|&\h\%(\w*;\)\?'.
+ \'\|\h[[:alnum:]_-]*="\%([^"]*"\?\)\?\|\h[[:alnum:]_:-]*')
call neocomplcache#set_dictionary_helper(g:neocomplcache_keyword_patterns,
\'css,stylus,scss',
\'[@#.]\?[[:alpha:]_:-][[:alnum:]_:-]*')
@@ -563,10 +544,6 @@ function! neocomplcache#enable() "{{{
let &completefunc = 'neocomplcache#manual_complete'
let &l:completefunc = 'neocomplcache#manual_complete'
- " Set options.
- set completeopt-=menu
- set completeopt+=menuone
-
" For auto complete keymappings.
inoremap <expr><silent> <Plug>(neocomplcache_start_unite_complete)
\ unite#sources#neocomplcache#start_complete()
@@ -577,14 +554,8 @@ function! neocomplcache#enable() "{{{
inoremap <silent> <Plug>(neocomplcache_start_auto_complete)
\ <C-x><C-u><C-r>=neocomplcache#popup_post()<CR>
inoremap <silent> <Plug>(neocomplcache_start_omni_complete)
- \ <C-x><C-o><C-r>=neocomplcache#popup_post()<CR>
-
- " Initialize.
- for source in values(neocomplcache#available_complfuncs())
- if has_key(source, 'initialize')
- call source.initialize()
- endif
- endfor
+ \ <C-x><C-o><C-p>
+ " \ <C-x><C-o><C-r>=neocomplcache#popup_post()<CR>
endfunction"}}}
function! neocomplcache#disable()"{{{
@@ -612,6 +583,9 @@ function! neocomplcache#disable()"{{{
call source.finalize()
endif
endfor
+ for source in values(neocomplcache#available_plugins())
+ call source.finalize()
+ endfor
for source in values(neocomplcache#available_ftplugins())
if source.loaded
if has_key(source, 'finalize')
@@ -781,11 +755,7 @@ function! s:do_auto_complete(event)"{{{
" Prevent infinity loop.
if cur_text == ''
\ || cur_text == s:old_cur_text
- \ || (neocomplcache#is_eskk_enabled() &&
- \ !neocomplcache#is_eskk_convertion(cur_text))
- \ || (!neocomplcache#is_eskk_enabled() &&
- \ neocomplcache#is_multibyte_input(cur_text))
- \ || g:neocomplcache_lock_iminsert && &l:iminsert
+ \ || (g:neocomplcache_lock_iminsert && &l:iminsert)
let s:cur_keyword_str = ''
let s:complete_words = []
return
@@ -794,7 +764,22 @@ function! s:do_auto_complete(event)"{{{
let s:old_cur_text = cur_text
if s:skip_next_complete
let s:skip_next_complete = 0
- return
+
+ " Check delimiter pattern.
+ let is_delimiter = 0
+ let filetype = neocomplcache#get_context_filetype()
+
+ for delimiter in get(g:neocomplcache_delimiter_patterns,
+ \ filetype, [])
+ if cur_text =~ delimiter . '$'
+ let is_delimiter = 1
+ break
+ endif
+ endfor
+
+ if !is_delimiter
+ return
+ endif
endif
if neocomplcache#is_omni_complete(cur_text)
@@ -802,6 +787,12 @@ function! s:do_auto_complete(event)"{{{
return
endif
+ " Check multibyte input or eskk.
+ if neocomplcache#is_eskk_enabled()
+ \ || neocomplcache#is_multibyte_input(cur_text)
+ return
+ endif
+
" Check complete position.
let complete_results = s:set_complete_results_pos(cur_text)
if empty(complete_results)
@@ -813,7 +804,7 @@ function! s:do_auto_complete(event)"{{{
if neocomplcache#is_prefetch()
" Do prefetch.
let s:complete_results =
- \ neocomplcache#get_complete_results(s:get_cur_text())
+ \ neocomplcache#get_complete_results(cur_text)
if empty(s:complete_results)
" Skip completion.
@@ -833,13 +824,7 @@ function! s:do_auto_complete(event)"{{{
set completeopt+=menuone
" Start auto complete.
- if neocomplcache#is_prefetch()
- call feedkeys((g:neocomplcache_enable_auto_select ?
- \ "\<C-x>\<C-u>\<C-p>\<Down>" :
- \ "\<C-x>\<C-u>\<C-p>"), 'n')
- else
- call feedkeys("\<Plug>(neocomplcache_start_auto_complete)")
- endif
+ call feedkeys("\<Plug>(neocomplcache_start_auto_complete)")
let s:changedtick = b:changedtick
endfunction"}}}
@@ -866,10 +851,9 @@ function! neocomplcache#keyword_escape(cur_keyword_str)"{{{
" Escape."{{{
let keyword_escape = escape(a:cur_keyword_str, '~" \.^$[]')
if g:neocomplcache_enable_wildcard
- let keyword_escape = substitute(substitute(keyword_escape, '.\zs\*', '.*', 'g'), '\%(^\|\*\)\zs\*', '\\*', 'g')
- if '-' !~ '\k'
- let keyword_escape = substitute(keyword_escape, '.\zs-', '.\\+', 'g')
- endif
+ let keyword_escape = substitute(
+ \ substitute(keyword_escape, '.\zs\*', '.*', 'g'),
+ \ '\%(^\|\*\)\zs\*', '\\*', 'g')
else
let keyword_escape = escape(keyword_escape, '*')
endif"}}}
@@ -928,12 +912,10 @@ function! neocomplcache#keyword_filter(list, cur_keyword_str)"{{{
" Delimiter check.
let filetype = neocomplcache#get_context_filetype()
- if has_key(g:neocomplcache_delimiter_patterns, filetype)"{{{
- for delimiter in g:neocomplcache_delimiter_patterns[filetype]
- let cur_keyword_str = substitute(cur_keyword_str,
- \ delimiter, '*' . delimiter, 'g')
- endfor
- endif"}}}
+ for delimiter in get(g:neocomplcache_delimiter_patterns, filetype, [])
+ let cur_keyword_str = substitute(cur_keyword_str,
+ \ delimiter, '*' . delimiter, 'g')
+ endfor
if cur_keyword_str == ''
return a:list
@@ -1030,19 +1012,20 @@ function! neocomplcache#fuzzy_filter(list, cur_keyword_str)"{{{
return ret
endfunction"}}}
-function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str, completion_length)"{{{
+function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str)"{{{
if empty(a:dictionary)
return []
endif
- if len(a:cur_keyword_str) < a:completion_length ||
+ let completion_length = 2
+ if len(a:cur_keyword_str) < completion_length ||
\ neocomplcache#check_completion_length_match(
- \ a:cur_keyword_str, a:completion_length)
+ \ a:cur_keyword_str, completion_length)
return neocomplcache#keyword_filter(
\ neocomplcache#unpack_dictionary(a:dictionary), a:cur_keyword_str)
endif
- let key = tolower(a:cur_keyword_str[: a:completion_length-1])
+ let key = tolower(a:cur_keyword_str[: completion_length-1])
if !has_key(a:dictionary, key)
return []
@@ -1055,7 +1038,7 @@ function! neocomplcache#dictionary_filter(dictionary, cur_keyword_str, completio
let list = values(a:dictionary[key])
endif
- return (len(a:cur_keyword_str) == a:completion_length && &ignorecase)?
+ return (len(a:cur_keyword_str) == completion_length && &ignorecase)?
\ list : neocomplcache#keyword_filter(copy(list), a:cur_keyword_str)
endfunction"}}}
function! neocomplcache#unpack_dictionary(dict)"{{{
@@ -1227,12 +1210,18 @@ function! neocomplcache#match_word(cur_text, ...)"{{{
let pattern = a:0 >= 1 ? a:1 : neocomplcache#get_keyword_pattern_end()
" Check wildcard.
- let cur_keyword_pos = s:match_wildcard(a:cur_text, pattern, match(a:cur_text, pattern))
+ let cur_keyword_pos = s:match_wildcard(
+ \ a:cur_text, pattern, match(a:cur_text, pattern))
let cur_keyword_str = a:cur_text[cur_keyword_pos :]
return [cur_keyword_pos, cur_keyword_str]
endfunction"}}}
+function! neocomplcache#match_wild_card(cur_keyword_str)"{{{
+ let index = stridx(a:cur_keyword_str, '*')
+ return !g:neocomplcache_enable_wildcard && index > 0 ?
+ \ a:cur_keyword_str : a:cur_keyword_str[: index]
+endfunction"}}}
function! neocomplcache#is_enabled()"{{{
return s:is_enabled
endfunction"}}}
@@ -1294,8 +1283,17 @@ function! neocomplcache#is_prefetch()"{{{
\ || &l:formatoptions =~# 'a'
endfunction"}}}
function! neocomplcache#is_omni_complete(cur_text)"{{{
- if !neocomplcache#is_source_enabled('omni_complete')
- return 0
+ " Check eskk complete length.
+ if neocomplcache#is_eskk_enabled()
+ \ && exists('g:eskk#start_completion_length')
+ if !neocomplcache#is_eskk_convertion(a:cur_text)
+ return 0
+ endif
+
+ let cur_keyword_pos = call(&l:omnifunc, [1, ''])
+ let cur_keyword_str = a:cur_text[cur_keyword_pos :]
+ return neocomplcache#util#mb_strlen(cur_keyword_str) >=
+ \ g:eskk#start_completion_length
endif
let filetype = neocomplcache#get_context_filetype()
@@ -1305,6 +1303,12 @@ function! neocomplcache#is_omni_complete(cur_text)"{{{
return 0
endif
+ let syn_name = neocomplcache#get_syn_name(1)
+ if syn_name ==# 'Comment' || syn_name ==# 'String'
+ " Skip omni_complete in string literal.
+ return 0
+ endif
+
let omnifunc = &l:omnifunc
if has_key(g:neocomplcache_force_omni_patterns, omnifunc)
@@ -1358,7 +1362,7 @@ function! neocomplcache#get_source_filetypes(filetype)"{{{
if has_key(g:neocomplcache_ignore_composite_filetype_lists, filetype)
let filetypes = [g:neocomplcache_ignore_composite_filetype_lists[filetype]]
else
- " Set compound filetype.
+ " Set composite filetype.
let filetypes += split(filetype, '\.')
endif
endif
@@ -1407,7 +1411,7 @@ function! neocomplcache#get_source_rank(plugin_name)"{{{
elseif has_key(s:ftplugin_sources, a:plugin_name)
return 100
elseif has_key(s:plugin_sources, a:plugin_name)
- return neocomplcache#get_source_rank('keyword_complete')
+ return 5
else
" unknown.
return 1
@@ -1537,42 +1541,40 @@ function! neocomplcache#get_complete_words(complete_results, cur_keyword_pos, cu
" Delimiter check.
let filetype = neocomplcache#get_context_filetype()
- if has_key(g:neocomplcache_delimiter_patterns, filetype)"{{{
- for delimiter in g:neocomplcache_delimiter_patterns[filetype]
- " Count match.
- let delim_cnt = 0
- let matchend = matchend(a:cur_keyword_str, delimiter)
- while matchend >= 0
- let matchend = matchend(a:cur_keyword_str, delimiter, matchend)
- let delim_cnt += 1
- endwhile
+ for delimiter in get(g:neocomplcache_delimiter_patterns, filetype, [])"{{{
+ " Count match.
+ let delim_cnt = 0
+ let matchend = matchend(a:cur_keyword_str, delimiter)
+ while matchend >= 0
+ let matchend = matchend(a:cur_keyword_str, delimiter, matchend)
+ let delim_cnt += 1
+ endwhile
- for keyword in complete_words
- let split_list = split(keyword.word, delimiter, 1)
- if len(split_list) > 1
- let delimiter_sub = substitute(delimiter, '\\\([.^$]\)', '\1', 'g')
- let keyword.word = join(split_list[ : delim_cnt], delimiter_sub)
- let keyword.abbr = join(
- \ split(keyword.abbr, delimiter, 1)[ : delim_cnt],
- \ delimiter_sub)
-
- if g:neocomplcache_max_keyword_width >= 0
- \ && len(keyword.abbr) > g:neocomplcache_max_keyword_width
- let keyword.abbr = substitute(keyword.abbr,
- \ '\(\h\)\w*'.delimiter, '\1'.delimiter_sub, 'g')
- endif
- if delim_cnt+1 < len(split_list)
- let keyword.abbr .= delimiter_sub . '~'
- let keyword.dup = 0
+ for keyword in complete_words
+ let split_list = split(keyword.word, delimiter, 1)
+ if len(split_list) > 1
+ let delimiter_sub = substitute(delimiter, '\\\([.^$]\)', '\1', 'g')
+ let keyword.word = join(split_list[ : delim_cnt], delimiter_sub)
+ let keyword.abbr = join(
+ \ split(keyword.abbr, delimiter, 1)[ : delim_cnt],
+ \ delimiter_sub)
+
+ if g:neocomplcache_max_keyword_width >= 0
+ \ && len(keyword.abbr) > g:neocomplcache_max_keyword_width
+ let keyword.abbr = substitute(keyword.abbr,
+ \ '\(\h\)\w*'.delimiter, '\1'.delimiter_sub, 'g')
+ endif
+ if delim_cnt+1 < len(split_list)
+ let keyword.abbr .= delimiter_sub . '~'
+ let keyword.dup = 0
- if g:neocomplcache_enable_auto_delimiter
- let keyword.word .= delimiter_sub
- endif
+ if g:neocomplcache_enable_auto_delimiter
+ let keyword.word .= delimiter_sub
endif
endif
- endfor
+ endif
endfor
- endif"}}}
+ endfor"}}}
if neocomplcache#complete_check()
return []
@@ -1627,6 +1629,65 @@ function! neocomplcache#get_complete_words(complete_results, cur_keyword_pos, cu
return complete_words
endfunction"}}}
+function! s:set_complete_results_pos(cur_text, ...)"{{{
+ " Set context filetype.
+ call s:set_context_filetype()
+
+ let sources = copy(get(a:000, 0, s:get_sources_list()))
+ if a:0 < 1
+ call filter(sources, 'neocomplcache#is_source_enabled(v:key)
+ \ && !neocomplcache#is_plugin_locked(v:key)')
+ endif
+
+ " Try source completion."{{{
+ let complete_results = {}
+ for [source_name, source] in items(sources)
+ if source.kind ==# 'plugin'
+ " Plugin default keyword position.
+ let [cur_keyword_pos, cur_keyword_str] = neocomplcache#match_word(a:cur_text)
+ else
+ let pos = getpos('.')
+
+ try
+ let cur_keyword_pos = source.get_keyword_pos(a:cur_text)
+ catch
+ call neocomplcache#print_error(v:throwpoint)
+ call neocomplcache#print_error(v:exception)
+ call neocomplcache#print_error(
+ \ 'Error occured in complfunc''s get_keyword_pos()!')
+ call neocomplcache#print_error(
+ \ 'Source name is ' . source_name)
+ return complete_results
+ finally
+ if getpos('.') != pos
+ call setpos('.', pos)
+ endif
+ endtry
+ endif
+
+ if cur_keyword_pos < 0
+ continue
+ endif
+
+ let cur_keyword_str = a:cur_text[cur_keyword_pos :]
+ if neocomplcache#is_auto_complete() &&
+ \ neocomplcache#util#mb_strlen(cur_keyword_str)
+ \ < neocomplcache#get_completion_length(source_name)
+ " Skip.
+ continue
+ endif
+
+ let complete_results[source_name] = {
+ \ 'complete_words' : [],
+ \ 'cur_keyword_pos' : cur_keyword_pos,
+ \ 'cur_keyword_str' : cur_keyword_str,
+ \ 'source' : source,
+ \}
+ endfor
+ "}}}
+
+ return complete_results
+endfunction"}}}
function! s:set_complete_results_words(complete_results)"{{{
" Try source completion.
for [source_name, result] in items(a:complete_results)
@@ -1649,15 +1710,22 @@ function! s:set_complete_results_words(complete_results)"{{{
let pos = getpos('.')
try
- let words = result.source.get_complete_words(
- \ result.cur_keyword_pos, result.cur_keyword_str)
+ let words = result.source.kind ==# 'plugin' ?
+ \ result.source.get_keyword_list(result.cur_keyword_str) :
+ \ result.source.get_complete_words(
+ \ result.cur_keyword_pos, result.cur_keyword_str)
catch
call neocomplcache#print_error(v:throwpoint)
call neocomplcache#print_error(v:exception)
call neocomplcache#print_error(
- \ 'Error occured in complfunc''s get_complete_words()!')
- call neocomplcache#print_error(
\ 'Source name is ' . source_name)
+ if result.source.kind ==# 'plugin'
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s get_keyword_list()!')
+ else
+ call neocomplcache#print_error(
+ \ 'Error occured in source''s get_complete_words()!')
+ endif
return
finally
if getpos('.') != pos
@@ -1670,65 +1738,6 @@ function! s:set_complete_results_words(complete_results)"{{{
let result.complete_words = words
endfor
endfunction"}}}
-function! s:set_complete_results_pos(cur_text, ...)"{{{
- " Set context filetype.
- call s:set_context_filetype()
-
- let sources = copy(get(a:000, 0, extend(copy(neocomplcache#available_complfuncs()),