diff --git a/sources_non_forked/ctrlp.vim/.github/FUNDING.yml b/sources_non_forked/ctrlp.vim/.github/FUNDING.yml new file mode 100644 index 00000000..d8c27bb8 --- /dev/null +++ b/sources_non_forked/ctrlp.vim/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: ctrlpvim # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim index 38b6ed8b..d4445c88 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp.vim @@ -95,7 +95,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] = \ 'brief_prompt': ['s:brfprt', 0], \ 'match_current_file': ['s:matchcrfile', 0], \ 'match_natural_name': ['s:matchnatural', 0], - \ 'compare_lim': ['s:compare_lim', 3000], + \ 'compare_lim': ['s:compare_lim', 0], \ 'bufname_mod': ['s:bufname_mod', ':t'], \ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'], \ 'formatline_func': ['s:flfunc', 's:formatline(v:val)'], @@ -330,7 +330,7 @@ fu! s:Open() endf fu! s:Close() - cal s:async_glob_abort() + cal s:async_glob_abort(0) cal s:buffunc(0) if winnr('$') == 1 bw! @@ -396,7 +396,7 @@ fu! ctrlp#files() en " Remove base directory cal ctrlp#rmbasedir(g:ctrlp_allfiles) - if len(g:ctrlp_allfiles) <= s:compare_lim + if !s:compare_lim || len(g:ctrlp_allfiles) <= s:compare_lim cal sort(g:ctrlp_allfiles, 'ctrlp#complen') en cal s:writecache(cafile) @@ -425,13 +425,17 @@ fu! s:CloseCustomFuncs() en endf -if has('patch-8.2-0995') +if has('patch-8.2-0995') && get(g:, 'ctrlp_use_readdir', 1) fu! s:GlobPath(dirs, depth) let entries = [] - for e in split(a:dirs, ',') - sil let files = readdir(e, '1', {'sort': 'none'}) - if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en - let entries += map(files, 'e.s:lash.v:val') + let dirs = substitute(a:dirs, '\\\([%# ]\)', '\1', 'g') + for e in split(dirs, ',') + try + let files = readdir(e, '1', {'sort': 'none'}) + if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en + let entries += map(files, 'e.s:lash.v:val') + cat + endt endfo let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] if &wig != '' | cal filter(dnf[1], 'glob(v:val) != ""') | en @@ -487,10 +491,12 @@ fu! s:async_glob_on_exit(...) en endf -fu! s:async_glob_abort() +fu! s:async_glob_abort(upd) cal s:stop_job_if_exists() cal s:stop_timer_if_exists() - cal s:ForceUpdate() + if a:upd + cal s:ForceUpdate() + en endf fu! s:stop_timer_if_exists() @@ -750,6 +756,9 @@ fu! s:Render(lines, pat) en if s:mw_order == 'btt' | cal reverse(lines) | en let s:lines = copy(lines) + if s:nolim == 0 && len(lines) > height + let lines = lines[:height-1] + en if has('patch-8.1-0') && s:flfunc ==# 's:formatline(v:val)' cal map(lines, function('s:formatline2', [s:curtype()])) el @@ -1094,7 +1103,7 @@ fu! s:MapSpecs() if !( exists('s:smapped') && s:smapped == s:bufnr ) " Correct arrow keys in terminal if ( has('termresponse') && v:termresponse =~ "\" ) - \ || &term =~? '\vxterm|','\B ','\C ','\D '] exe s:lcmap.' ['.each endfo @@ -1151,7 +1160,7 @@ fu! s:ToggleByFname() endf fu! s:ToggleType(dir) - cal s:async_glob_abort() + cal s:async_glob_abort(1) let max = len(g:ctrlp_ext_vars) + len(s:coretypes) - 1 let next = s:walker(max, s:itemtype, a:dir) cal ctrlp#setlines(next) @@ -1761,16 +1770,22 @@ fu! s:formatline2(ct, key, str) let str .= printf(' %s', parts[3]) en en + retu s:lineprefix.str en - let cond = a:ct != 'buf' &&s:ispath && ( s:winw - 4 ) < s:strwidth(str) + let cond = s:ispath && ( s:winw - 4 ) < strchars(str) retu s:lineprefix.( cond ? s:pathshorten(str) : str ) endf - -fu! s:pathshorten(str) - retu matchstr(a:str, '^.\{9}').'...' - \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') -endf +if exists('*strchars') && exists('*strcharpart') + fu! s:pathshorten(str) + retu strcharpart(a:str, 0, 9).'...'.strcharpart(a:str, strchars(a:str) - s:winw + 16) + endf +el + fu! s:pathshorten(str) + retu matchstr(a:str, '^.\{9}').'...' + \ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') + endf +en fu! s:offset(lines, height) let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0 @@ -2713,6 +2728,15 @@ fu! ctrlp#nosy() retu !( has('syntax') && exists('g:syntax_on') ) endf +fu! s:hiupdate() + for [ke, va] in items(s:hlgrps) + let ke = 'CtrlP' . ke + if hlexists(ke) + exe 'hi link' ke va + en + endfo +endf + fu! ctrlp#hicheck(grp, defgrp) if !hlexists(a:grp) exe 'hi link' a:grp a:defgrp @@ -2846,6 +2870,7 @@ if has('autocmd') au BufEnter ControlP cal s:checkbuf() au BufLeave ControlP noa cal s:Close() au VimLeavePre * cal s:leavepre() + au ColorScheme * cal s:hiupdate() aug END en diff --git a/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim b/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim index f36a5cfc..4f75e6d3 100644 --- a/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim +++ b/sources_non_forked/ctrlp.vim/autoload/ctrlp/buffertag.vim @@ -203,10 +203,14 @@ endf fu! s:parseline(line) let vals = matchlist(a:line, - \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)') + \ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)\t?([^\t]*)') 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] + if len(vals) > 7 && vals[7] != '' + retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'|'.vals[7].'| '.vals[3] + else + retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] + en endf fu! s:syntax() @@ -249,7 +253,7 @@ endf fu! ctrlp#buffertag#accept(mode, str) let vals = matchlist(a:str, - \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$') + \ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)%(\|[^\t|]+)?\|\s(.+)$') let bufnr = str2nr(get(vals, 1)) if bufnr cal ctrlp#acceptfile(a:mode, bufnr) diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx b/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx index 3cd91399..74379d48 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.cnx @@ -241,22 +241,8 @@ OPTIONS *ctrlp-options* < 注意: 当命令使用 |g:ctrlp_user_command| 定义时该选项无效。 - *'ctrlp-wildignore'* -你可以使用Vim的 |'wildignore'| 来从结果集中排序文件或目录。 -例子: > - " 排除版本控制文件 - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX - set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash') -< -注意 #1: 每个目录设置前的字符 `*/` 是必须的。 - -注意 #2: |wildignore| 影响 |expand()| , |globpath()| 和 |glob()| 的结果,这些函数被很 -多插件用来在系统中执行查找。(例如和版本控制系统有关的插件在查找.git/、.hg/等, -一些其他插件用来在Windows上查找外部的*.exe工具),所以要修改 |wildignore| 时请先 -考虑清楚。 - *'g:ctrlp_custom_ignore'* -作为对 |'wildignore'| 和 |g:ctrlp_show_hidden| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正 +除了 |g:ctrlp_show_hidden|,你可以用这个选项设置你想在CtrlP中隐藏的文件和目录。使用正 则表达式来指定匹配模式: > let g:ctrlp_custom_ignore = '' < @@ -274,9 +260,7 @@ OPTIONS *ctrlp-options* \ 'func': 'some#custom#match_function' \ } < -注意 #1: 默认情况下, |wildignore| 和 |g:ctrlp_custom_ignore| 只在 |globpath()| 被用 -来扫描文件的情况下使用,这样这些选项在那些使用 |g:ctrlp_user_command| 定义的命 -令中不会生效。 +注意 #1: |g:ctrlp_custom_ignore| 在已经使用 |g:ctrlp_user_command| 的时候不会生效。 注意 #2: 当改变选项的变量类型时,记得先 |:unlet| ,或者重启Vim来避免这个错误: "E706: Variable type mismatch" 。 @@ -285,6 +269,9 @@ OPTIONS *ctrlp-options* 自动加载的函数。函数必须接受两个参数,要匹配的条目和接受的类型,类型可以是目 录、文件和链接。如果条目被忽略,函数需要返回1,反之,返回0。 +注意 #4: 如果设置 |g:ctrlp_use_readdir| 为0,你可以使用 Vim 的 |'wildignore'| +来将文件和目录排除出搜索结果。 + *'g:ctrlp_max_files'* 扫描文件的最大数量,设置为0时不进行限制: > let g:ctrlp_max_files = 10000 diff --git a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt index 82eecfcb..da1d5153 100644 --- a/sources_non_forked/ctrlp.vim/doc/ctrlp.txt +++ b/sources_non_forked/ctrlp.vim/doc/ctrlp.txt @@ -240,23 +240,8 @@ Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: > 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 -results. -Examples: > - " Excluding version control directories - set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX - set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash') -< -Note #1: the `*/` in front of each directory glob is required. - -Note #2: |wildignore| influences the result of |expand()|, |globpath()| and -|glob()| which many plugins use to find stuff on the system (e.g. VCS related -plugins look for .git/, .hg/,... some other plugins look for external *.exe -tools on Windows). So be a little mindful of what you put in your |wildignore|. - *'g:ctrlp_custom_ignore'* -In addition to |'wildignore'| and |g:ctrlp_show_hidden|, use this for files +In addition to |g:ctrlp_show_hidden|, use this for files and directories you want only CtrlP to not show. Use regexp to specify the patterns: > let g:ctrlp_custom_ignore = '' @@ -275,8 +260,7 @@ Examples: > \ 'func': 'some#custom#match_function' \ } < -Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when -|globpath()| is used to scan for files, thus these options do not apply when a +Note #1: |g:ctrlp_custom_ignore| does not apply when a command defined with |g:ctrlp_user_command| is being used. Note #2: when changing the option's variable type, remember to |:unlet| it @@ -288,6 +272,9 @@ recommended here. The function must take 2 parameters, the item to match and its type. The type will be "dir", "file", or "link". The function must return 1 if the item should be ignored, 0 otherwise. +Note #4: when |g:ctrlp_use_readdir| is set to 0, you can also use Vim's |'wildignore'| +to exclude files and directories. + *'g:ctrlp_max_files'* The maximum number of files to scan, set to 0 for no limit: > let g:ctrlp_max_files = 10000 @@ -846,6 +833,13 @@ Example: > *'g:ctrlp_brief_prompt'* When this is set to 1, the on empty prompt exit CtrlP. + *'g:ctrlp_use_readdir'* +Unlike kien/ctrlp.vim, ctrlpvim/ctrlp.vim uses readdir() instead of globpath() +for speed. Set this option to 0 if you want to revert to the original +behavior. +Example: > + let g:ctrlp_use_readdir = 0 +< *ctrlp-default-value* Otherwise, you can use below to change default value. Example: > @@ -853,6 +847,17 @@ Example: > This is possible to change no-limit mode for match type "path". + *ctrlp_compare_lim* +If your search directory has more number of files than this limit, no sorting +will be performed for the first readout. You can improve CtrlP performance by +setting this to a proper value, but no sorting on the first readout can reduce +the quality of fuzzy finding results. +Example: + let g:ctrlp_compare_lim = 100 + +Set the value to 0 for unlimited sorting. Default is 0. + + =============================================================================== COMMANDS *ctrlp-commands*