Created
March 2, 2014 17:19
-
-
Save bling/9309964 to your computer and use it in GitHub Desktop.
vim-airline 421
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT /Users/aaronjensen/.vim/bundle/ctrlp.vim/autoload/ctrlp.vim | |
Sourced 1 time | |
Total time: 0.002952 | |
Self time: 0.002915 | |
count total (s) self (s) | |
" ============================================================================= | |
" File: autoload/ctrlp.vim | |
" Description: Fuzzy file, buffer, mru, tag, etc finder. | |
" Author: Kien Nguyen <github.com/kien> | |
" Version: 1.79 | |
" ============================================================================= | |
" ** Static variables {{{1 | |
" s:ignore() {{{2 | |
1 0.000005 fu! s:ignore() | |
let igdirs = [ | |
\ '\.git', | |
\ '\.hg', | |
\ '\.svn', | |
\ '_darcs', | |
\ '\.bzr', | |
\ '\.cdv', | |
\ '\~\.dep', | |
\ '\~\.dot', | |
\ '\~\.nib', | |
\ '\~\.plst', | |
\ '\.pc', | |
\ '_MTN', | |
\ 'blib', | |
\ 'CVS', | |
\ 'RCS', | |
\ 'SCCS', | |
\ '_sgbak', | |
\ 'autom4te\.cache', | |
\ 'cover_db', | |
\ '_build', | |
\ ] | |
let igfiles = [ | |
\ '\~$', | |
\ '#.+#$', | |
\ '[._].*\.swp$', | |
\ 'core\.\d+$', | |
\ '\.exe$', | |
\ '\.so$', | |
\ '\.bak$', | |
\ '\.png$', | |
\ '\.jpg$', | |
\ '\.gif$', | |
\ '\.zip$', | |
\ '\.rar$', | |
\ '\.tar\.gz$', | |
\ ] | |
retu { | |
\ 'dir': '\v[\/]('.join(igdirs, '|').')$', | |
\ 'file': '\v'.join(igfiles, '|'), | |
\ } | |
endf | |
" Script local vars {{{2 | |
1 0.000161 0.000124 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: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': ['s:mw', ''], | |
\ 'match_window_bottom': ['s:mwbottom', 1], | |
\ 'match_window_reversed': ['s:mwreverse', 1], | |
\ 'max_depth': ['s:maxdepth', 40], | |
\ 'max_files': ['s:maxfiles', 10000], | |
\ 'max_height': ['s:mxheight', 10], | |
\ 'max_history': ['s:maxhst', exists('+hi') ? &hi : 20], | |
\ 'mruf_default_order': ['s:mrudef', 0], | |
\ 'open_func': ['s:openfunc', {}], | |
\ 'open_multi': ['s:opmul', '1v'], | |
\ 'open_new_file': ['s:newfop', 'v'], | |
\ 'prompt_mappings': ['s:urprtmaps', 0], | |
\ 'regexp_search': ['s:regexp', 0], | |
\ 'root_markers': ['s:rmarkers', []], | |
\ 'split_window': ['s:splitwin', 0], | |
\ 'status_func': ['s:status', {}], | |
\ 'tabpage_position': ['s:tabpage', 'ac'], | |
\ 'use_caching': ['s:caching', 1], | |
\ 'use_migemo': ['s:migemo', 0], | |
\ 'user_command': ['s:usrcmd', ''], | |
\ '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 | |
1 0.000015 let s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0, | |
\ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'ttimeout': 0, | |
\ 'gcr': 'a:blinkon0', 'ic': 1, 'lmap': '', 'mousef': 0, 'imd': 1 } | |
" Keymaps | |
1 0.000080 let [s:lcmap, s:prtmaps] = ['nn <buffer> <silent>', { | |
\ 'PrtBS()': ['<bs>', '<c-]>'], | |
\ 'PrtDelete()': ['<del>'], | |
\ 'PrtDeleteWord()': ['<c-w>'], | |
\ 'PrtClear()': ['<c-u>'], | |
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'], | |
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'], | |
\ 'PrtSelectMove("t")': ['<Home>', '<kHome>'], | |
\ 'PrtSelectMove("b")': ['<End>', '<kEnd>'], | |
\ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'], | |
\ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'], | |
\ 'PrtHistory(-1)': ['<c-n>'], | |
\ 'PrtHistory(1)': ['<c-p>'], | |
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'], | |
\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'], | |
\ 'AcceptSelection("t")': ['<c-t>'], | |
\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'], | |
\ 'ToggleFocus()': ['<s-tab>'], | |
\ 'ToggleRegex()': ['<c-r>'], | |
\ 'ToggleByFname()': ['<c-d>'], | |
\ 'ToggleType(1)': ['<c-f>', '<c-up>'], | |
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'], | |
\ 'PrtExpandDir()': ['<tab>'], | |
\ 'PrtInsert("c")': ['<MiddleMouse>', '<insert>'], | |
\ 'PrtInsert()': ['<c-\>'], | |
\ 'PrtCurStart()': ['<c-a>'], | |
\ 'PrtCurEnd()': ['<c-e>'], | |
\ 'PrtCurLeft()': ['<c-h>', '<left>', '<c-^>'], | |
\ 'PrtCurRight()': ['<c-l>', '<right>'], | |
\ 'PrtClearCache()': ['<F5>'], | |
\ 'PrtDeleteEnt()': ['<F7>'], | |
\ 'CreateNewFile()': ['<c-y>'], | |
\ 'MarkToOpen()': ['<c-z>'], | |
\ 'OpenMulti()': ['<c-o>'], | |
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'], | |
\ }] | |
1 0.000007 if !has('gui_running') | |
1 0.000008 cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0)) | |
1 0.000001 en | |
1 0.000002 let s:compare_lim = 3000 | |
1 0.000002 let s:ficounts = {} | |
1 0.000006 let s:ccex = s:pref.'clear_cache_on_exit' | |
" Regexp | |
1 0.000009 let s:fpats = { | |
\ '^\(\\|\)\|\(\\|\)$': '\\|', | |
\ '^\\\(zs\|ze\|<\|>\)': '^\\\(zs\|ze\|<\|>\)', | |
\ '^\S\*$': '\*', | |
\ '^\S\\?$': '\\?', | |
\ } | |
" Keypad | |
1 0.000009 let s:kprange = { | |
\ 'Plus': '+', | |
\ 'Minus': '-', | |
\ 'Divide': '/', | |
\ 'Multiply': '*', | |
\ 'Point': '.', | |
\ } | |
" Highlight groups | |
1 0.000013 let s:hlgrps = { | |
\ 'NoEntries': 'Error', | |
\ 'Mode1': 'Character', | |
\ 'Mode2': 'LineNr', | |
\ 'Stats': 'Function', | |
\ 'Match': 'Identifier', | |
\ 'PrtBase': 'Comment', | |
\ 'PrtText': 'Normal', | |
\ 'PrtCursor': 'Constant', | |
\ } | |
" Get the options {{{2 | |
1 0.000002 fu! s:opts(...) | |
unl! s:usrign s:usrcmd s:urprtmaps | |
for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each) | |
let {each} = s:{each} | |
en | endfo | |
for [ke, va] in items(s:opts) | |
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1] | |
endfo | |
unl va | |
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 | |
" Match window options | |
cal s:match_window_opts() | |
" One-time values | |
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: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 | |
" Extensions | |
if !( exists('extensions') && extensions == s:extensions ) | |
for each in s:extensions | |
exe 'ru autoload/ctrlp/'.each.'.vim' | |
endfo | |
en | |
" Keymaps | |
if type(s:urprtmaps) == 4 | |
cal extend(s:prtmaps, s:urprtmaps) | |
en | |
endf | |
1 0.000002 fu! s:match_window_opts() | |
let s:mw_pos = | |
\ s:mw =~ 'top\|bottom' ? matchstr(s:mw, 'top\|bottom') : | |
\ exists('g:ctrlp_match_window_bottom') ? ( s:mwbottom ? 'bottom' : 'top' ) | |
\ : 'bottom' | |
let s:mw_order = | |
\ s:mw =~ 'order:[^,]\+' ? matchstr(s:mw, 'order:\zs[^,]\+') : | |
\ exists('g:ctrlp_match_window_reversed') ? ( s:mwreverse ? 'btt' : 'ttb' ) | |
\ : 'btt' | |
let s:mw_max = | |
\ s:mw =~ 'max:[^,]\+' ? str2nr(matchstr(s:mw, 'max:\zs\d\+')) : | |
\ exists('g:ctrlp_max_height') ? s:mxheight | |
\ : 10 | |
let s:mw_min = | |
\ s:mw =~ 'min:[^,]\+' ? str2nr(matchstr(s:mw, 'min:\zs\d\+')) : 1 | |
let [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])] | |
let s:mw_min = min([s:mw_min, s:mw_max]) | |
let s:mw_res = | |
\ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+')) | |
\ : min([s:mw_max, &lines]) | |
let s:mw_res = max([s:mw_res, 1]) | |
endf | |
"}}}1 | |
" * Open & Close {{{1 | |
1 0.000002 fu! s:Open() | |
cal s:log(1) | |
cal s:getenv() | |
cal s:execextvar('enter') | |
sil! exe 'keepa' ( s:mw_pos == 'top' ? 'to' : 'bo' ) '1new ControlP' | |
cal s:buffunc(1) | |
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() : [''] | |
let s:hstry = empty(hst) || !s:maxhst ? [''] : hst | |
en | |
for [ke, va] in items(s:glbs) | if exists('+'.ke) | |
sil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va) | |
en | endfo | |
if s:opmul != '0' && has('signs') | |
sign define ctrlpmark text=+> texthl=Search | |
en | |
cal s:setupblank() | |
endf | |
1 0.000002 fu! s:Close() | |
cal s:buffunc(0) | |
if winnr('$') == 1 | |
bw! | |
el | |
try | bun! | |
cat | clo! | endt | |
cal s:unmarksigns() | |
en | |
for key in keys(s:glbs) | if exists('+'.key) | |
sil! exe 'let &'.key.' = s:glb_'.key | |
en | endfo | |
if exists('s:glb_acd') | let &acd = s:glb_acd | en | |
let g:ctrlp_lines = [] | |
if s:winres[1] >= &lines && s:winres[2] == winnr('$') | |
exe s:winres[0].s:winres[0] | |
en | |
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr | |
\ s:mrbs s:did_exp | |
cal ctrlp#recordhist() | |
cal s:execextvar('exit') | |
cal s:log(0) | |
let v:errmsg = s:ermsg | |
ec | |
endf | |
" * Clear caches {{{1 | |
1 0.000003 fu! ctrlp#clr(...) | |
let [s:matches, g:ctrlp_new{ a:0 ? a:1 : 'cache' }] = [1, 1] | |
endf | |
1 0.000002 fu! ctrlp#clra() | |
let cadir = ctrlp#utils#cachedir() | |
if isdirectory(cadir) | |
let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n") | |
let eval = '!isdirectory(v:val) && v:val !~ ''\v[\/]cache[.a-z]+$|\.log$''' | |
sil! cal map(s:ifilter(cafiles, eval), 'delete(v:val)') | |
en | |
cal ctrlp#clr() | |
endf | |
1 0.000002 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') | |
endf | |
" * Files {{{1 | |
1 0.000002 fu! ctrlp#files() | |
let cafile = ctrlp#utils#cachefile() | |
if g:ctrlp_newcache || !filereadable(cafile) || s:nocache(cafile) | |
let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []] | |
" Get the list of files | |
if empty(lscmd) | |
if !ctrlp#igncwd(s:dyncwd) | |
cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0) | |
en | |
el | |
sil! cal ctrlp#progress('Indexing...') | |
try | cal s:UserCmd(lscmd) | |
cat | retu [] | endt | |
en | |
" Remove base directory | |
cal ctrlp#rmbasedir(g:ctrlp_allfiles) | |
if len(g:ctrlp_allfiles) <= s:compare_lim | |
cal sort(g:ctrlp_allfiles, 'ctrlp#complen') | |
en | |
cal s:writecache(cafile) | |
let catime = getftime(cafile) | |
el | |
let catime = getftime(cafile) | |
if !( exists('s:initcwd') && s:initcwd == s:dyncwd ) | |
\ || get(s:ficounts, s:dyncwd, [0, catime])[1] != catime | |
let s:initcwd = s:dyncwd | |
let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) | |
en | |
en | |
cal extend(s:ficounts, { s:dyncwd : [len(g:ctrlp_allfiles), catime] }) | |
retu g:ctrlp_allfiles | |
endf | |
1 0.000003 fu! s:GlobPath(dirs, depth) | |
let entries = split(globpath(a:dirs, s:glob), "\n") | |
let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] | |
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(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth) | |
en | |
endf | |
1 0.000002 fu! s:UserCmd(lscmd) | |
let [path, lscmd] = [s:dyncwd, a:lscmd] | |
let do_ign = | |
\ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore'] | |
if do_ign && ctrlp#igncwd(s:cwd) | retu | en | |
if exists('+ssl') && &ssl | |
let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')] | |
en | |
if has('win32') || has('win64') | |
let lscmd = substitute(lscmd, '\v(^|\&\&\s*)\zscd (/d)@!', 'cd /d ', '') | |
en | |
let path = exists('*shellescape') ? shellescape(path) : path | |
let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n") | |
if exists('+ssl') && exists('ssl') | |
let &ssl = ssl | |
cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")') | |
en | |
if exists('s:vcscmd') && s:vcscmd | |
cal map(g:ctrlp_allfiles, 'tr(v:val, "/", "\\")') | |
en | |
if do_ign | |
if !empty(s:usrign) | |
let g:ctrlp_allfiles = ctrlp#dirnfile(g:ctrlp_allfiles)[1] | |
en | |
if &wig != '' | |
cal filter(g:ctrlp_allfiles, 'glob(v:val) != ""') | |
en | |
en | |
endf | |
1 0.000002 fu! s:lsCmd() | |
let cmd = s:usrcmd | |
if type(cmd) == 1 | |
retu cmd | |
elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', ''] | |
if s:findroot(s:dyncwd, cmd[0], 0, 1) == [] | |
retu len(cmd) == 3 ? cmd[2] : '' | |
en | |
let s:vcscmd = s:lash == '\' | |
retu cmd[1] | |
elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') ) | |
let fndroot = [] | |
if has_key(cmd, 'types') && cmd['types'] != {} | |
let [markrs, cmdtypes] = [[], values(cmd['types'])] | |
for pair in cmdtypes | |
cal add(markrs, pair[0]) | |
endfo | |
let fndroot = s:findroot(s:dyncwd, markrs, 0, 1) | |
en | |
if fndroot == [] | |
retu has_key(cmd, 'fallback') ? cmd['fallback'] : '' | |
en | |
for pair in cmdtypes | |
if pair[0] == fndroot[0] | brea | en | |
endfo | |
let s:vcscmd = s:lash == '\' | |
retu pair[1] | |
en | |
endf | |
" - Buffers {{{1 | |
1 0.000003 fu! ctrlp#buffers(...) | |
let ids = sort(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))' | |
\ .' && getbufvar(v:val, "&bl")'), 's:compmreb') | |
if a:0 && a:1 == 'id' | |
retu ids | |
el | |
let bufs = [[], []] | |
for id in ids | |
let bname = bufname(id) | |
let ebname = bname == '' | |
let fname = fnamemodify(ebname ? '['.id.'*No Name]' : bname, ':.') | |
cal add(bufs[ebname], fname) | |
endfo | |
retu bufs[0] + bufs[1] | |
en | |
endf | |
" * MatchedItems() {{{1 | |
1 0.000003 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 | |
for item in a:items | |
let id += 1 | |
try | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0 | |
cal add(lines, item) | |
en | cat | brea | endt | |
if a:limit > 0 && len(lines) >= a:limit | brea | en | |
endfo | |
let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)] | |
retu lines | |
endf | |
1 0.000005 fu! s:MatchedItems(items, pat, limit) | |
let exc = exists('s:crfilerel') ? s:crfilerel : '' | |
let items = s:narrowable() ? s:matched + s:mdata[3] : a:items | |
if s:matcher != {} | |
let argms = | |
\ has_key(s:matcher, 'arg_type') && s:matcher['arg_type'] == 'dict' ? [{ | |
\ 'items': items, | |
\ 'str': a:pat, | |
\ 'limit': a:limit, | |
\ 'mmode': s:mmode(), | |
\ 'ispath': s:ispath, | |
\ 'crfile': exc, | |
\ 'regex': s:regexp, | |
\ }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] | |
let lines = call(s:matcher['match'], argms, s:matcher) | |
el | |
let lines = s:MatchIt(items, a:pat, a:limit, exc) | |
en | |
let s:matches = len(lines) | |
unl! s:did_exp | |
retu lines | |
endf | |
1 0.000002 fu! s:SplitPattern(str) | |
let str = a:str | |
if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo') | |
let str = s:migemo(str) | |
en | |
let s:savestr = str | |
if s:regexp | |
let pat = s:regexfilter(str) | |
el | |
let lst = split(str, '\zs') | |
if exists('+ssl') && !&ssl | |
cal map(lst, 'escape(v:val, ''\'')') | |
en | |
for each in ['^', '$', '.'] | |
cal map(lst, 'escape(v:val, each)') | |
endfo | |
en | |
if exists('lst') | |
let pat = '' | |
if !empty(lst) | |
if s:byfname() && index(lst, ';') > 0 | |
let fbar = index(lst, ';') | |
let lst_1 = s:sublist(lst, 0, fbar - 1) | |
let lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : [''] | |
let pat = s:buildpat(lst_1).';'.s:buildpat(lst_2) | |
el | |
let pat = s:buildpat(lst) | |
en | |
en | |
en | |
retu escape(pat, '~') | |
endf | |
" * BuildPrompt() {{{1 | |
1 0.000002 fu! s:Render(lines, pat) | |
let [&ma, lines, s:res_count] = [1, a:lines, len(a:lines)] | |
let height = min([max([s:mw_min, s:res_count]), s:winmaxh]) | |
let pat = s:byfname() ? split(a:pat, '^[^;]\+\\\@<!\zs;', 1)[0] : a:pat | |
let cur_cmd = 'keepj norm! '.( s:mw_order == 'btt' ? 'G' : 'gg' ).'1|' | |
" Setup the match window | |
sil! exe '%d _ | res' height | |
" Print the new items | |
if empty(lines) | |
let [s:matched, s:lines] = [[], []] | |
let lines = [' == NO ENTRIES =='] | |
cal setline(1, s:offset(lines, height - 1)) | |
setl noma nocul | |
exe cur_cmd | |
cal s:unmarksigns() | |
if s:dohighlight() | cal clearmatches() | en | |
retu | |
en | |
let s:matched = copy(lines) | |
" Sorting | |
if !s:nosort() | |
let s:compat = s:martcs.pat | |
cal sort(lines, 's:mixedsort') | |
unl s:compat | |
en | |
if s:mw_order == 'btt' | cal reverse(lines) | en | |
let s:lines = copy(lines) | |
cal map(lines, 's:formatline(v:val)') | |
cal setline(1, s:offset(lines, height)) | |
setl noma cul | |
exe cur_cmd | |
cal s:unmarksigns() | |
cal s:remarksigns() | |
if exists('s:cline') && s:nolim != 1 | |
cal cursor(s:cline, 1) | |
en | |
" Highlighting | |
if s:dohighlight() | |
cal s:highlight(pat, s:mathi[1]) | |
en | |
endf | |
1 0.000002 fu! s:Update(str) | |
" Get the previous string if existed | |
let oldstr = exists('s:savestr') ? s:savestr : '' | |
" Get the new string sans tail | |
let str = s:sanstail(a:str) | |
" Stop if the string's unchanged | |
if str == oldstr && !empty(str) && !exists('s:force') | retu | en | |
let s:martcs = &scs && str =~ '\u' ? '\C' : '' | |
let pat = s:matcher == {} ? s:SplitPattern(str) : str | |
let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines) | |
\ : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res) | |
cal s:Render(lines, pat) | |
endf | |
1 0.000002 fu! s:ForceUpdate() | |
sil! cal s:Update(escape(s:getinput(), '\')) | |
endf | |
1 0.000002 fu! s:BuildPrompt(upd) | |
let base = ( s:regexp ? 'r' : '>' ).( s:byfname() ? 'd' : '>' ).'> ' | |
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 | |
sil! cal ctrlp#statusline() | |
" Toggling | |
let [hiactive, hicursor, base] = s:focus | |
\ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base] | |
\ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')] | |
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].'" | |
\ | echoh' hiactive '| echon "'.prt[2].'" | echoh None' | |
" Append the cursor at the end | |
if empty(prt[1]) && s:focus | |
exe 'echoh' hibase '| echon "_" | echoh None' | |
en | |
endf | |
" - SetDefTxt() {{{1 | |
1 0.000002 fu! s:SetDefTxt() | |
if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en | |
let txt = s:deftxt | |
if !type(txt) | |
let path = s:crfpath.s:lash(s:crfpath) | |
let txt = txt && !stridx(path, s:dyncwd) ? ctrlp#rmbasedir([path])[0] : '' | |
en | |
let s:prompt[0] = txt | |
endf | |
" ** Prt Actions {{{1 | |
" Editing {{{2 | |
1 0.000001 fu! s:PrtClear() | |
if !s:focus | retu | en | |
unl! s:hstgot | |
let [s:prompt, s:matches] = [['', '', ''], 1] | |
cal s:BuildPrompt(1) | |
endf | |
1 0.000002 fu! s:PrtAdd(char) | |
unl! s:hstgot | |
let s:act_add = 1 | |
let s:prompt[0] .= a:char | |
cal s:BuildPrompt(1) | |
unl s:act_add | |
endf | |
1 0.000001 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 | |
1 0.000002 fu! s:PrtDelete() | |
if !s:focus | retu | en | |
unl! s:hstgot | |
let [prt, s:matches] = [s:prompt, 1] | |
let prt[1] = matchstr(prt[2], '^.') | |
let prt[2] = substitute(prt[2], '^.', '', '') | |
cal s:BuildPrompt(1) | |
endf | |
1 0.000002 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\+$') | |
\ : str =~ '\w\W\+$' ? matchstr(str, '^.\+\w\ze\W\+$') | |
\ : str =~ '\s\+$' ? matchstr(str, '^.*\S\ze\s\+$') | |
\ : str =~ '\v^(\S+|\s+)$' ? '' : str | |
let s:prompt[0] = str | |
cal s:BuildPrompt(1) | |
endf | |
1 0.000001 fu! s:PrtInsert(...) | |
if !s:focus | retu | en | |
let type = !a:0 ? '' : a:1 | |
if !a:0 | |
let type = s:insertstr() | |
if type == 'cancel' | retu | en | |
en | |
if type ==# 'r' | |
let regcont = s:getregs() | |
if regcont < 0 | retu | en | |
en | |
unl! s:hstgot | |
let s:act_add = 1 | |
let s:prompt[0] .= type ==# 'w' ? s:crword | |
\ : type ==# 'f' ? s:crgfile | |
\ : type ==# 's' ? s:regisfilter('/') | |
\ : type ==# 'v' ? s:crvisual | |
\ : type ==# 'c' ? s:regisfilter('+') | |
\ : type ==# 'r' ? regcont : '' | |
cal s:BuildPrompt(1) | |
unl s:act_add | |
endf | |
1 0.000002 fu! s:PrtExpandDir() | |
if !s:focus | retu | en | |
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, '') | |
if str =~# '\v^[~$]\i{-}[\/]?|^#(\<?\d+)?:(p|h|8|\~|\.|g?s+)' | |
let str = expand(s:fnesc(str, 'g')) | |
elsei str =~# '\v^(\%|\<c\h{4}\>):(p|h|8|\~|\.|g?s+)' | |
let spc = str =~# '^%' ? s:crfile | |
\ : str =~# '^<cfile>' ? s:crgfile | |
\ : str =~# '^<cword>' ? s:crword | |
\ : str =~# '^<cWORD>' ? s:crnbword : '' | |
let pat = '(:(p|h|8|\~|\.|g?s(.)[^\3]*\3[^\3]*\3))+' | |
let mdr = matchstr(str, '\v^[^:]+\zs'.pat) | |
let nmd = matchstr(str, '\v^[^:]+'.pat.'\zs.{-}$') | |
let str = fnamemodify(s:fnesc(spc, 'g'), mdr).nmd | |
en | |
en | |
if str == '' | retu | en | |
unl! s:hstgot | |
let s:act_add = 1 | |
let [base, seed] = s:headntail(str) | |
if str =~# '^[\/]' | |
let base = expand('/').base | |
en | |
let dirs = s:dircompl(base, seed) | |
if len(dirs) == 1 | |
let str = dirs[0] | |
elsei len(dirs) > 1 | |
let str .= s:findcommon(dirs, str) | |
en | |
let s:prompt[0] = exists('hasat') ? hasat[0].str : str | |
cal s:BuildPrompt(1) | |
unl s:act_add | |
endf | |
" Movement {{{2 | |
1 0.000001 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], '.$'), | |
\ prt[1] . prt[2]] | |
en | |
cal s:BuildPrompt(0) | |
endf | |
1 0.000002 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 | |
1 0.000002 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 | |
1 0.000001 fu! s:PrtCurEnd() | |
if !s:focus | retu | en | |
let s:prompt = [join(s:prompt, ''), '', ''] | |
cal s:BuildPrompt(0) | |
endf | |
1 0.000002 fu! s:PrtSelectMove(dir) | |
let wht = winheight(0) | |
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) | en | |
endf | |
1 0.000002 fu! s:PrtSelectJump(char) | |
let lines = copy(s:lines) | |
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(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, 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, smartcs.'^'.chr, s:jmpchr[1] + 1) | |
let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] | |
en | |
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 | |
endf | |
" Misc {{{2 | |
1 0.000002 fu! s:PrtFocusMap(char) | |
cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char]) | |
endf | |
1 0.000001 fu! s:PrtClearCache() | |
if s:itemtype == 0 | |
cal ctrlp#clr() | |
elsei s:itemtype > 2 | |
cal ctrlp#clr(s:statypes[s:itemtype][1]) | |
en | |
if s:itemtype == 2 | |
let g:ctrlp_lines = ctrlp#mrufiles#refresh() | |
el | |
cal ctrlp#setlines() | |
en | |
let s:force = 1 | |
cal s:BuildPrompt(1) | |
unl s:force | |
endf | |
1 0.000002 fu! s:PrtDeleteEnt() | |
if s:itemtype == 2 | |
cal s:PrtDeleteMRU() | |
elsei type(s:getextvar('wipe')) == 1 | |
cal s:delent(s:getextvar('wipe')) | |
en | |
endf | |
1 0.000002 fu! s:PrtDeleteMRU() | |
if s:itemtype == 2 | |
cal s:delent('ctrlp#mrufiles#remove') | |
en | |
endf | |
1 0.000002 fu! s:PrtExit() | |
if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' | |
noa cal s:Close() | |
noa winc p | |
en | |
endf | |
1 0.000002 fu! s:PrtHistory(...) | |
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)] | |
let idx = exists('s:hisidx') ? s:hisidx + a:1 : a:1 | |
" Limit idx within 0 and hslen | |
let idx = idx < 0 ? 0 : idx >= hslen ? hslen > 1 ? hslen - 1 : 0 : idx | |
let s:prompt = [hst[idx], '', ''] | |
let [s:hisidx, s:hstgot, s:force] = [idx, 1, 1] | |
cal s:BuildPrompt(1) | |
unl s:force | |
endf | |
"}}}1 | |
" * Mappings {{{1 | |
1 0.000002 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', '') | |
let pfunc = 'PrtFocusMap' | |
let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123) | |
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) | |
endfo | |
for [ke, va] in items(s:kprange) | |
exe printf(pcmd, ke, pfunc, va) | |
endfo | |
let s:nmapped = s:bufnr | |
endf | |
1 0.000002 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 | |
1 0.000001 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 | |
1 0.000002 fu! s:ToggleFocus() | |
let s:focus = !s:focus | |
cal s:BuildPrompt(0) | |
endf | |
1 0.000002 fu! s:ToggleRegex() | |
let s:regexp = !s:regexp | |
cal s:PrtSwitcher() | |
endf | |
1 0.000001 fu! s:ToggleByFname() | |
if s:ispath | |
let s:byfname = !s:byfname | |
let s:mfunc = s:mfunc() | |
cal s:PrtSwitcher() | |
en | |
endf | |
1 0.000002 fu! s:ToggleType(dir) | |
let max = len(g:ctrlp_ext_vars) + 2 | |
let next = s:walker(max, s:itemtype, a:dir) | |
cal ctrlp#syntax() | |
cal ctrlp#setlines(next) | |
cal s:PrtSwitcher() | |
endf | |
1 0.000002 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 | |
1 0.000001 fu! s:ToggleMRURelative() | |
cal ctrlp#mrufiles#tgrel() | |
cal s:PrtClearCache() | |
endf | |
1 0.000001 fu! s:PrtSwitcher() | |
let [s:force, s:matches] = [1, 1] | |
cal s:BuildPrompt(1) | |
unl s:force | |
endf | |
" - SetWD() {{{1 | |
1 0.000002 fu! s:SetWD(args) | |
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' || ( 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 | |
if pmode =~ 'r' || pmode == 2 | |
let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs'] | |
let spath = pmode =~ 'd' ? s:dyncwd : pmode =~ 'w' ? s:cwd : s:crfpath | |
if type(s:rmarkers) == 3 && !empty(s:rmarkers) | |
if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu | en | |
cal filter(markers, 'index(s:rmarkers, v:val) < 0') | |
en | |
cal s:findroot(spath, markers, 0, 0) | |
en | |
endf | |
" * AcceptSelection() {{{1 | |
1 0.000003 fu! ctrlp#acceptfile(...) | |
let useb = 0 | |
if a:0 == 1 && type(a:1) == 4 | |
let [md, line] = [a:1['action'], a:1['line']] | |
let atl = has_key(a:1, 'tail') ? a:1['tail'] : '' | |
el | |
let [md, line] = [a:1, a:2] | |
let atl = a:0 > 2 ? a:3 : '' | |
en | |
if !type(line) | |
let [filpath, bufnr, useb] = [line, line, 1] | |
el | |
let filpath = fnamemodify(line, ':p') | |
if s:nonamecond(line, filpath) | |
let bufnr = str2nr(matchstr(line, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) | |
let [filpath, useb] = [bufnr, 1] | |
el | |
let bufnr = bufnr('^'.filpath.'$') | |
en | |
en | |
cal s:PrtExit() | |
let tail = s:tail() | |
let j2l = atl != '' ? atl : matchstr(tail, '^ +\zs\d\+$') | |
if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0 | |
\ && !( md == 'e' && bufnr == bufnr('%') ) | |
let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)] | |
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' && ( 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 | |
el | |
" Determine the command to use | |
let useb = bufnr > 0 && buflisted(bufnr) && ( empty(tail) || useb ) | |
let cmd = | |
\ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) : | |
\ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) : | |
\ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) : | |
\ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) | |
" Reset &switchbuf option | |
let [swb, &swb] = [&swb, ''] | |
" Open new window/buffer | |
let [fid, tail] = [( useb ? bufnr : filpath ), ( atl != '' ? ' +'.atl : tail )] | |
let args = [cmd, fid, tail, 1, [useb, j2l]] | |
cal call('s:openfile', args) | |
let &swb = swb | |
en | |
endf | |
1 0.000002 fu! s:SpecInputs(str) | |
if a:str =~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*)$' && s:spi | |
let cwd = s:dyncwd | |
cal ctrlp#setdir(a:str =~ '^\.\.\.*$' ? | |
\ '../'.repeat('../', strlen(a:str) - 2) : a:str) | |
if cwd != s:dyncwd | cal ctrlp#setlines() | en | |
cal s:PrtClear() | |
retu 1 | |
elsei a:str == s:lash && s:spi | |
cal s:SetWD({ 'mode': 'rd' }) | |
cal ctrlp#setlines() | |
cal s:PrtClear() | |
retu 1 | |
elsei a:str =~ '^@.\+' && s:spi | |
retu s:at(a:str) | |
elsei a:str == '?' | |
cal s:PrtExit() | |
let hlpwin = &columns > 159 ? '| vert res 80' : '' | |
sil! exe 'bo vert h ctrlp-mappings' hlpwin '| norm! 0' | |
retu 1 | |
en | |
retu 0 | |
endf | |
1 0.000002 fu! s:AcceptSelection(action) | |
let [md, icr] = [a:action[0], match(a:action, 'r') >= 0] | |
let subm = icr || ( !icr && md == 'e' ) | |
if !subm && s:OpenMulti(md) != -1 | retu | en | |
let str = s:getinput() | |
if subm | if s:SpecInputs(str) | retu | en | en | |
" Get the selected line | |
let line = ctrlp#getcline() | |
if !subm && !s:itemtype && line == '' && line('.') > s:offset | |
\ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$' | |
cal s:CreateNewFile(md) | retu | |
en | |
if empty(line) | retu | en | |
" Do something with it | |
if s:openfunc != {} && has_key(s:openfunc, s:ctype) | |
let actfunc = s:openfunc[s:ctype] | |
let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list' | |
el | |
if s:itemtype < 3 | |
let [actfunc, type] = ['ctrlp#acceptfile', 'dict'] | |
el | |
let [actfunc, exttype] = [s:getextvar('accept'), s:getextvar('act_farg')] | |
let type = exttype == 'dict' ? exttype : 'list' | |
en | |
en | |
let actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr }] | |
\ : [md, line] | |
cal call(actfunc, actargs) | |
endf | |
" - CreateNewFile() {{{1 | |
1 0.000002 fu! s:CreateNewFile(...) | |
let [md, str] = ['', s:getinput('n')] | |
if empty(str) | retu | en | |
if s:argmap && !a:0 | |
" Get the extra argument | |
let md = s:argmaps(md, 1) | |
if md == 'cancel' | retu | en | |
en | |
let str = s:sanstail(str) | |
let [base, fname] = s:headntail(str) | |
if fname =~ '^[\/]$' | retu | en | |
if exists('s:marked') && len(s:marked) | |
" Use the first marked file's path | |
let path = fnamemodify(values(s:marked)[0], ':p:h') | |
let base = path.s:lash(path).base | |
let str = fnamemodify(base.s:lash.fname, ':.') | |
en | |
if base != '' | if isdirectory(ctrlp#utils#mkdir(base)) | |
let optyp = str | en | el | let optyp = fname | |
en | |
if !exists('optyp') | retu | en | |
let [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()] | |
if !stridx(filpath, s:dyncwd) | cal s:insertcache(str) | en | |
cal s:PrtExit() | |
let cmd = md == 'r' ? ctrlp#normcmd('e') : | |
\ s:newfop =~ '1\|t' || ( a:0 && a:1 == 't' ) || md == 't' ? 'tabe' : | |
\ 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, 1) | |
endf | |
" * OpenMulti() {{{1 | |
1 0.000002 fu! s:MarkToOpen() | |
if s:bufnr <= 0 || s:opmul == '0' | |
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 ) | |
retu | |
en | |
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 | |
" Unmark and remove the file from s:marked | |
let key = s:dictindex(s:marked, filpath) | |
cal remove(s:marked, key) | |
if empty(s:marked) | unl s:marked | en | |
if has('signs') | |
exe 'sign unplace' key 'buffer='.s:bufnr | |
en | |
el | |
" Add to s:marked and place a new sign | |
if exists('s:marked') | |
let vac = s:vacantdict(s:marked) | |
let key = empty(vac) ? len(s:marked) + 1 : vac[0] | |
let s:marked = extend(s:marked, { key : filpath }) | |
el | |
let [key, s:marked] = [1, { 1 : filpath }] | |
en | |
if has('signs') | |
exe 'sign place' key 'line='.line('.').' name=ctrlpmark buffer='.s:bufnr | |
en | |
en | |
sil! cal ctrlp#statusline() | |
endf | |
1 0.000002 fu! s:OpenMulti(...) | |
let has_marked = exists('s:marked') | |
if ( !has_marked && a:0 ) || s:opmul == '0' || !s:ispath | |
\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 ) | |
retu -1 | |
en | |
" Get the options | |
let [nr, md] = [matchstr(s:opmul, '\d\+'), matchstr(s:opmul, '[thvi]')] | |
let [ur, jf] = [s:opmul =~ 'r', s:opmul =~ 'j'] | |
let md = a:0 ? a:1 : ( md == '' ? 'v' : md ) | |
let nopt = exists('g:ctrlp_open_multiple_files') | |
if !has_marked | |
let line = ctrlp#getcline() | |
if line == '' | retu | en | |
let marked = { 1 : fnamemodify(line, ':p') } | |
let [nr, ur, jf, nopt] = ['1', 0, 0, 1] | |
en | |
if ( s:argmap || !has_marked ) && !a:0 | |
let md = s:argmaps(md, !has_marked ? 2 : 0) | |
if md == 'c' | |
cal s:unmarksigns() | |
unl! s:marked | |
cal s:BuildPrompt(0) | |
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 | |
let ur = !has_marked && md == 'r' ? 1 : ur | |
en | |
let mkd = values(has_marked ? s:marked : marked) | |
cal s:sanstail(join(s:prompt, '')) | |
cal s:PrtExit() | |
if nr == '0' || md == 'i' | |
retu map(mkd, "s:openfile('bad', v:val, '', 0)") | |
en | |
let tail = s:tail() | |
let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')] | |
let useb = bufnr > 0 && buflisted(bufnr) && emptytail | |
" Move to a replaceable window | |
let ncmd = ( useb ? ['b', 'bo vert sb'] : ['e', 'bo vne'] ) | |
\ + ( ur ? [] : ['ignruw'] ) | |
let fst = call('ctrlp#normcmd', ncmd) | |
" Check if the current window has a replaceable buffer | |
let repabl = !( md == 't' && !ur ) && empty(bufname('%')) && empty(&l:ft) | |
" Commands for the rest of the files | |
let [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'], | |
\ 't': ['tab sb', 'tabe'] }] | |
let [swb, &swb] = [&swb, ''] | |
if md == 't' && ctrlp#tabcount() < tabpagenr() | |
let s:tabct = ctrlp#tabcount() | |
en | |
" Open the files | |
for va in mkd | |
let bufnr = bufnr('^'.va.'$') | |
if bufnr < 0 && getftype(va) == '' | con | en | |
let useb = bufnr > 0 && buflisted(bufnr) && emptytail | |
let snd = md != '' && has_key(cmds, md) ? | |
\ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' ) | |
let cmd = ic == 1 && ( !( !ur && fst =~ '^[eb]$' ) || repabl ) ? fst : snd | |
let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ), | |
\ nr != '' && nr < ic] | |
if conds[nopt] | |
if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en | |
el | |
cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1) | |
if jf | if ic == 1 | |
let crpos = [tabpagenr(), winnr()] | |
el | |
let crpos[0] += tabpagenr() <= crpos[0] | |
let crpos[1] += winnr() <= crpos[1] | |
en | en | |
let ic += 1 | |
en | |
endfo | |
if jf && exists('crpos') && ic > 2 | |
exe ( md == 't' ? 'tabn '.crpos[0] : crpos[1].'winc w' ) | |
en | |
let &swb = swb | |
unl! s:tabct | |
endf | |
1 0.000003 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' | |
let type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'dict' | |
let argms = type == 'dict' ? [{ 'action': a:md, 'line': a:line }] | |
\ : [a:md, a:line] | |
cal call(s:openfunc[s:ctype], argms, s:openfunc) | |
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 | |
1 0.000003 fu! ctrlp#complen(...) | |
" By length | |
let [len1, len2] = [strlen(a:1), strlen(a:2)] | |
retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 | |
endf | |
1 0.000003 fu! s:compmatlen(...) | |
" By match length | |
let mln1 = s:shortest(s:matchlens(a:1, s:compat)) | |
let mln2 = s:shortest(s:matchlens(a:2, s:compat)) | |
retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1 | |
endf | |
1 0.000002 fu! s:comptime(...) | |
" By last modified time | |
let [time1, time2] = [getftime(a:1), getftime(a:2)] | |
retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1 | |
endf | |
1 0.000002 fu! s:compmreb(...) | |
" By last entered time (bufnr) | |
let [id1, id2] = [index(s:mrbs, a:1), index(s:mrbs, a:2)] | |
retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1 | |
endf | |
1 0.000002 fu! s:compmref(...) | |
" By last entered time (MRU) | |
let [id1, id2] = [index(g:ctrlp_lines, a:1), index(g:ctrlp_lines, a:2)] | |
retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1 | |
endf | |
1 0.000002 fu! s:comparent(...) | |
" By same parent dir | |
if !stridx(s:crfpath, s:dyncwd) | |
let [as1, as2] = [s:dyncwd.s:lash().a:1, s:dyncwd.s:lash().a:2] | |
let [loc1, loc2] = [s:getparent(as1), s:getparent(as2)] | |
if loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en | |
if loc2 == s:crfpath && loc1 != s:crfpath | retu 1 | en | |
retu 0 | |
en | |
retu 0 | |
endf | |
1 0.000004 fu! s:compfnlen(...) | |
" By filename length | |
let len1 = strlen(split(a:1, s:lash)[-1]) | |
let len2 = strlen(split(a:2, s:lash)[-1]) | |
retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 | |
endf | |
1 0.000003 fu! s:matchlens(str, pat, ...) | |
if empty(a:pat) || index(['^', '$'], a:pat) >= 0 | retu {} | en | |
let st = a:0 ? a:1 : 0 | |
let lens = a:0 >= 2 ? a:2 : {} | |
let nr = a:0 >= 3 ? a:3 : 0 | |
if nr > 20 | retu {} | en | |
if match(a:str, a:pat, st) >= 0 | |
let [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)] | |
let lens = extend(lens, { nr : [strlen(mst), mst] }) | |
let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1) | |
en | |
retu lens | |
endf | |
1 0.000003 fu! s:shortest(lens) | |
retu min(map(values(a:lens), 'v:val[0]')) | |
endf | |
1 0.000002 fu! s:mixedsort(...) | |
if s:itemtype == 1 | |
let pat = '[\/]\?\[\d\+\*No Name\]$' | |
if a:1 =~# pat && a:2 =~# pat | retu 0 | |
elsei a:1 =~# pat | retu 1 | |
elsei a:2 =~# pat | retu -1 | en | |
en | |
let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] | |
if s:ispath | |
let ms = [] | |
if s:res_count < 21 | |
let ms += [s:compfnlen(a:1, a:2)] | |
if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en | |
if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en | |
en | |
if s:itemtype =~ '^[12]$' | |
let ms += [s:compmref(a:1, a:2)] | |
let cln = cml ? cln : 0 | |
en | |
let ms += [cml, 0, 0, 0] | |
let mp = call('s:multipliers', ms[:3]) | |
retu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3] | |
en | |
retu cln + cml * 2 | |
endf | |
1 0.000003 fu! s:multipliers(...) | |
let mp0 = !a:1 ? 0 : 2 | |
let mp1 = !a:2 ? 0 : 1 + ( !mp0 ? 1 : mp0 ) | |
let mp2 = !a:3 ? 0 : 1 + ( !( mp0 + mp1 ) ? 1 : ( mp0 + mp1 ) ) | |
let mp3 = !a:4 ? 0 : 1 + ( !( mp0 + mp1 + mp2 ) ? 1 : ( mp0 + mp1 + mp2 ) ) | |
retu [mp0, mp1, mp2, mp3] | |
endf | |
1 0.000002 fu! s:compval(...) | |
retu a:1 - a:2 | |
endf | |
" Statusline {{{2 | |
1 0.000003 fu! ctrlp#statusline() | |
if !exists('s:statypes') | |
let s:statypes = [ | |
\ ['files', 'fil'], | |
\ ['buffers', 'buf'], | |
\ ['mru files', 'mru'], | |
\ ] | |
if !empty(g:ctrlp_ext_vars) | |
cal map(copy(g:ctrlp_ext_vars), | |
\ 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])') | |
en | |
en | |
let tps = s:statypes | |
let max = len(tps) - 1 | |
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 byfname = s:ispath ? s:byfname ? 'file' : 'path' : 'line' | |
let marked = s:opmul != '0' ? | |
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' | |
if s:status != {} | |
let argms = | |
\ has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{ | |
\ 'focus': focus, | |
\ 'byfname': byfname, | |
\ 'regex': s:regexp, | |
\ 'prev': prv, | |
\ 'item': s:ctype, | |
\ 'next': nxt, | |
\ 'marked': marked, | |
\ }] : [focus, byfname, s:regexp, prv, s:ctype, nxt, marked] | |
let &l:stl = call(s:status['main'], argms, s:status) | |
el | |
let item = '%#CtrlPMode1# '.s:ctype.' %*' | |
let focus = '%#CtrlPMode2# '.focus.' %*' | |
let byfname = '%#CtrlPMode1# '.byfname.' %*' | |
let regex = s:regexp ? '%#CtrlPMode2# regex %*' : '' | |
let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' | |
let dir = ' %=%<%#CtrlPMode2# %{getcwd()} %*' | |
let &l:stl = focus.byfname.regex.slider.marked.dir | |
en | |
endf | |
1 0.000002 fu! s:dismrk() | |
retu has('signs') ? len(s:marked) : | |
\ '%<'.join(values(map(copy(s:marked), 'split(v:val, "[\\/]")[-1]')), ', ') | |
endf | |
1 0.000003 fu! ctrlp#progress(enum, ...) | |
if has('macunix') || has('mac') | sl 1m | en | |
let txt = a:0 ? '(press ctrl-c to abort)' : '' | |
if s:status != {} | |
let argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' | |
\ ? [{ 'str': a:enum }] : [a:enum] | |
let &l:stl = call(s:status['prog'], argms, s:status) | |
el | |
let &l:stl = '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*' | |
en | |
redraws | |
endf | |
" *** Paths {{{2 | |
" Line formatting {{{3 | |
1 0.000003 fu! s:formatline(str) | |
let str = a:str | |
if s:itemtype == 1 | |
let filpath = fnamemodify(str, ':p') | |
let bufnr = s:nonamecond(str, filpath) | |
\ ? str2nr(matchstr(str, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) | |
\ : bufnr('^'.filpath.'$') | |
let idc = ( bufnr == bufnr('#') ? '#' : '' ) | |
\ . ( getbufvar(bufnr, '&ma') ? '' : '-' ) | |
\ . ( getbufvar(bufnr, '&ro') ? '=' : '' ) | |
\ . ( getbufvar(bufnr, '&mod') ? '+' : '' ) | |
let str .= idc != '' ? ' '.idc : '' | |
en | |
let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str) | |
retu '> '.( cond ? s:pathshorten(str) : str ) | |
endf | |
1 0.000002 fu! s:pathshorten(str) | |
retu matchstr(a:str, '^.\{9}').'...' | |
\ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$') | |
endf | |
1 0.000002 fu! s:offset(lines, height) | |
let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0 | |
retu s:offset > 0 ? ( repeat([''], s:offset) + a:lines ) : a:lines | |
endf | |
" Directory completion {{{3 | |
1 0.000003 fu! s:dircompl(be, sd) | |
if a:sd == '' | retu [] | en | |
if a:be == '' | |
let [be, sd] = [s:dyncwd, a:sd] | |
el | |
let be = a:be.s:lash(a:be) | |
let sd = be.a:sd | |
en | |
let dirs = split(globpath(s:fnesc(be, 'g', ','), a:sd.'*/'), "\n") | |
if a:be == '' | |
let dirs = ctrlp#rmbasedir(dirs) | |
en | |
cal filter(dirs, '!match(v:val, escape(sd, ''~$.\''))' | |
\ . ' && v:val !~ ''\v(^|[\/])\.{1,2}[\/]$''') | |
retu dirs | |
endf | |
1 0.000003 fu! s:findcommon(items, seed) | |
let [items, id, cmn, ic] = [copy(a:items), strlen(a:seed), '', 0] | |
cal map(items, 'strpart(v:val, id)') | |
for char in split(items[0], '\zs') | |
for item in items[1:] | |
if item[ic] != char | let brk = 1 | brea | en | |
endfo | |
if exists('brk') | brea | en | |
let cmn .= char | |
let ic += 1 | |
endfo | |
retu cmn | |
endf | |
" Misc {{{3 | |
1 0.000002 fu! s:headntail(str) | |
let parts = split(a:str, '[\/]\ze[^\/]\+[\/:]\?$') | |
retu len(parts) == 1 ? ['', parts[0]] : len(parts) == 2 ? parts : [] | |
endf | |
1 0.000002 fu! s:lash(...) | |
retu ( a:0 ? a:1 : s:dyncwd ) !~ '[\/]$' ? s:lash : '' | |
endf | |
1 0.000002 fu! s:ispathitem() | |
retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' ) | |
endf | |
1 0.000003 fu! ctrlp#igncwd(cwd) | |
retu ctrlp#utils#glob(a:cwd, 0) == '' || | |
\ ( s:igntype >= 0 && s:usrign(a:cwd, getftype(a:cwd)) ) | |
endf | |
1 0.000004 fu! ctrlp#dirnfile(entries) | |
let [items, cwd] = [[[], []], s:dyncwd.s:lash()] | |
for each in a:entries | |
let etype = getftype(each) | |
if s:igntype >= 0 && s:usrign(each, etype) | con | en | |
if etype == 'dir' | |
if s:showhidden | if each !~ '[\/]\.\{1,2}$' | |
cal add(items[0], each) | |
en | el | |
cal add(items[0], each) | |
en | |
elsei etype == 'link' | |
if s:folsym | |
let isfile = !isdirectory(each) | |
if s:folsym == 2 || !s:samerootsyml(each, isfile, cwd) | |
cal add(items[isfile], each) | |
en | |
en | |
elsei etype == 'file' | |
cal add(items[1], each) | |
en | |
endfo | |
retu items | |
endf | |
1 0.000003 fu! s:usrign(item, type) | |
retu s:igntype == 1 ? a:item =~ s:usrign | |
\ : s:igntype == 4 && has_key(s:usrign, a:type) && s:usrign[a:type] != '' | |
\ ? a:item =~ s:usrign[a:type] : 0 | |
endf | |
1 0.000003 fu! s:samerootsyml(each, isfile, cwd) | |
let resolve = fnamemodify(resolve(a:each), ':p:h') | |
let resolve .= s:lash(resolve) | |
retu !( stridx(resolve, a:cwd) && ( stridx(a:cwd, resolve) || a:isfile ) ) | |
endf | |
1 0.000003 fu! ctrlp#rmbasedir(items) | |
let cwd = s:dyncwd.s:lash() | |
if a:items != [] && !stridx(a:items[0], cwd) | |
let idx = strlen(cwd) | |
retu map(a:items, 'strpart(v:val, idx)') | |
en | |
retu a:items | |
endf | |
" Working directory {{{3 | |
1 0.000006 fu! s:getparent(item) | |
let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '') | |
if parent == '' || parent !~ '[\/]' | |
let parent .= s:lash | |
en | |
retu parent | |
endf | |
1 0.000007 fu! s:findroot(curr, mark, depth, type) | |
let [depth, fnd] = [a:depth + 1, 0] | |
if type(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(s:fnesc(a:curr, 'g', ','), markr, 1) != '' | |
let fnd = 1 | |
brea | |
en | |
endfo | |
en | |
if fnd | |
if !a:type | cal ctrlp#setdir(a:curr) | en | |
retu [exists('markr') ? markr : a:mark, a:curr] | |
elsei depth > s:maxdepth | |
cal ctrlp#setdir(s:cwd) | |
el | |
let parent = s:getparent(a:curr) | |
if parent != a:curr | |
retu s:findroot(parent, a:mark, depth, a:type) | |
en | |
en | |
retu [] | |
endf | |
1 0.000003 fu! ctrlp#setdir(path, ...) | |
let cmd = a:0 ? a:1 : 'lc!' | |
sil! exe cmd s:fnesc(a:path, 'c') | |
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] | |
endf | |
" Fallbacks {{{3 | |
1 0.000004 fu! s:glbpath(...) | |
retu call('ctrlp#utils#globpath', a:000) | |
endf | |
1 0.000002 fu! s:fnesc(...) | |
retu call('ctrlp#utils#fnesc', a:000) | |
endf | |
1 0.000003 fu! ctrlp#setlcdir() | |
if exists('*haslocaldir') | |
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!') | |
en | |
endf | |
" Highlighting {{{2 | |
1 0.000003 fu! ctrlp#syntax() | |
if ctrlp#nosy() | retu | en | |
for [ke, va] in items(s:hlgrps) | cal ctrlp#hicheck('CtrlP'.ke, va) | endfo | |
if synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' | |
sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' | |
en | |
sy match CtrlPNoEntries '^ == NO ENTRIES ==$' | |
if hlexists('CtrlPLinePre') | |
sy match CtrlPLinePre '^>' | |
en | |
endf | |
1 0.000002 fu! s:highlight(pat, grp) | |
if s:matcher != {} | retu | en | |
cal clearmatches() | |
if !empty(a:pat) && s:ispath | |
let pat = s:regexp ? substitute(a:pat, '\\\@<!\^', '^> \\zs', 'g') : a:pat | |
if s:byfname | |
let pat = substitute(pat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') | |
let pat = substitute(pat, '\$\@<!$', '\\ze[^\\/]*$', 'g') | |
en | |
cal matchadd(a:grp, ( s:martcs == '' ? '\c' : '\C' ).pat) | |
cal matchadd('CtrlPLinePre', '^>') | |
en | |
endf | |
1 0.000002 fu! s:dohighlight() | |
retu s:mathi[0] && exists('*clearmatches') && !ctrlp#nosy() | |
endf | |
" Prompt history {{{2 | |
1 0.000001 fu! s:gethistloc() | |
let utilcadir = ctrlp#utils#cachedir() | |
let cache_dir = utilcadir.s:lash(utilcadir).'hist' | |
retu [cache_dir, cache_dir.s:lash(cache_dir).'cache.txt'] | |
endf | |
1 0.000002 fu! s:gethistdata() | |
retu ctrlp#utils#readfile(s:gethistloc()[1]) | |
endf | |
1 0.000002 fu! ctrlp#recordhist() | |
let str = join(s:prompt, '') | |
if empty(str) || !s:maxhst | retu | en | |
let hst = s:hstry | |
if len(hst) > 1 && hst[1] == str | retu | en | |
cal extend(hst, [str], 1) | |
if len(hst) > s:maxhst | cal remove(hst, s:maxhst, -1) | en | |
cal ctrlp#utils#writecache(hst, s:gethistloc()[0], s:gethistloc()[1]) | |
endf | |
" Signs {{{2 | |
1 0.000004 fu! s:unmarksigns() | |
if !s:dosigns() | retu | en | |
for key in keys(s:marked) | |
exe 'sign unplace' key 'buffer='.s:bufnr | |
endfo | |
endf | |
1 0.000002 fu! s:remarksigns() | |
if !s:dosigns() | retu | en | |
for ic in range(1, len(s:lines)) | |
let line = s:ispath ? fnamemodify(s:lines[ic - 1], ':p') : s:lines[ic - 1] | |
let key = s:dictindex(s:marked, line) | |
if key > 0 | |
exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr | |
en | |
endfo | |
endf | |
1 0.000002 fu! s:dosigns() | |
retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs') | |
endf | |
" Lists & Dictionaries {{{2 | |
1 0.000002 fu! s:ifilter(list, str) | |
let [rlist, estr] = [[], substitute(a:str, 'v:val', 'each', 'g')] | |
for each in a:list | |
try | |
if eval(estr) | |
cal add(rlist, each) | |
en | |
cat | con | endt | |
endfo | |
retu rlist | |
endf | |
1 0.000002 fu! s:dictindex(dict, expr) | |
for key in keys(a:dict) | |
if a:dict[key] == a:expr | retu key | en | |
endfo | |
retu -1 | |
endf | |
1 0.000002 fu! s:vacantdict(dict) | |
retu filter(range(1, max(keys(a:dict))), '!has_key(a:dict, v:val)') | |
endf | |
1 0.000002 fu! s:sublist(l, s, e) | |
retu v:version > 701 ? a:l[(a:s):(a:e)] : s:sublist7071(a:l, a:s, a:e) | |
endf | |
1 0.000002 fu! s:sublist7071(l, s, e) | |
let [newlist, id, ae] = [[], a:s, a:e == -1 ? len(a:l) - 1 : a:e] | |
wh id <= ae | |
cal add(newlist, get(a:l, id)) | |
let id += 1 | |
endw | |
retu newlist | |
endf | |
" Buffers {{{2 | |
1 0.000002 fu! s:buftab(bufnr, md) | |
for tabnr in range(1, tabpagenr('$')) | |
if tabpagenr() == tabnr && a:md == 't' | con | en | |
let buflist = tabpagebuflist(tabnr) | |
if index(buflist, a:bufnr) >= 0 | |
for winnr in range(1, tabpagewinnr(tabnr, '$')) | |
if buflist[winnr - 1] == a:bufnr | retu [tabnr, winnr] | en | |
endfo | |
en | |
endfo | |
retu [0, 0] | |
endf | |
1 0.000002 fu! s:bufwins(bufnr) | |
let winns = 0 | |
for tabnr in range(1, tabpagenr('$')) | |
let winns += count(tabpagebuflist(tabnr), a:bufnr) | |
endfo | |
retu winns | |
endf | |
1 0.000002 fu! s:nonamecond(str, filpath) | |
retu a:str =~ '[\/]\?\[\d\+\*No Name\]$' && !filereadable(a:filpath) | |
\ && bufnr('^'.a:filpath.'$') < 1 | |
endf | |
1 0.000002 fu! ctrlp#normcmd(cmd, ...) | |
if a:0 < 2 && s:nosplit() | retu a:cmd | en | |
let norwins = filter(range(1, winnr('$')), | |
\ 'empty(getbufvar(winbufnr(v:val), "&bt"))') | |
for each in norwins | |
let bufnr = winbufnr(each) | |
if empty(bufname(bufnr)) && empty(getbufvar(bufnr, '&ft')) | |
let fstemp = each | brea | |
en | |
endfo | |
let norwin = empty(norwins) ? 0 : norwins[0] | |
if norwin | |
if index(norwins, winnr()) < 0 | |
exe ( exists('fstemp') ? fstemp : norwin ).'winc w' | |
en | |
retu a:cmd | |
en | |
retu a:0 ? a:1 : 'bo vne' | |
endf | |
1 0.000002 fu! ctrlp#modfilecond(w) | |
retu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf && | |
\ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 ) | |
endf | |
1 0.000002 fu! s:nosplit() | |
retu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0 | |
endf | |
1 0.000001 fu! s:setupblank() | |
setl noswf nonu nobl nowrap nolist nospell nocuc wfh | |
setl fdc=0 fdl=99 tw=0 bt=nofile bh=unload | |
if v:version > 702 | |
setl nornu noudf cc=0 | |
en | |
endf | |
1 0.000001 fu! s:leavepre() | |
if exists('s:bufnr') && s:bufnr == bufnr('%') | bw! | en | |
if !( exists(s:ccex) && !{s:ccex} ) | |
\ && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 ) | |
cal ctrlp#clra() | |
en | |
endf | |
1 0.000002 fu! s:checkbuf() | |
if !exists('s:init') && exists('s:bufnr') && s:bufnr > 0 | |
exe s:bufnr.'bw!' | |
en | |
endf | |
1 0.000001 fu! s:iscmdwin() | |
let ermsg = v:errmsg | |
sil! noa winc p | |
sil! noa winc p | |
let [v:errmsg, ermsg] = [ermsg, v:errmsg] | |
retu ermsg =~ '^E11:' | |
endf | |
" Arguments {{{2 | |
1 0.000002 fu! s:at(str) | |
if a:str =~ '\v^\@(cd|lc[hd]?|chd).*' | |
let str = substitute(a:str, '\v^\@(cd|lc[hd]?|chd)\s*', '', '') | |
if str == '' | retu 1 | en | |
let str = str =~ '^%:.\+' ? fnamemodify(s:crfile, str[1:]) : str | |
let path = fnamemodify(expand(str, 1), ':p') | |
if isdirectory(path) | |
if path != s:dyncwd | |
cal ctrlp#setdir(path) | |
cal ctrlp#setlines() | |
en | |
cal ctrlp#recordhist() | |
cal s:PrtClear() | |
en | |
retu 1 | |
en | |
retu 0 | |
endf | |
1 0.000002 fu! s:tail() | |
if exists('s:optail') && !empty('s:optail') | |
let tailpref = s:optail !~ '^\s*+' ? ' +' : ' ' | |
retu tailpref.s:optail | |
en | |
retu '' | |
endf | |
1 0.000002 fu! s:sanstail(str) | |
let str = s:spi ? | |
\ substitute(a:str, '^\(@.*$\|\\\\\ze@\|\.\.\zs[.\/]\+$\)', '', 'g') : a:str | |
let [str, pat] = [substitute(str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] | |
unl! s:optail | |
if str =~ '\\\@<!:'.pat | |
let s:optail = matchstr(str, '\\\@<!:\zs'.pat) | |
let str = substitute(str, '\\\@<!:'.pat, '', '') | |
en | |
retu substitute(str, '\\\ze:', '', 'g') | |
endf | |
1 0.000002 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', ['r', 'd', '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]) | |
endf | |
1 0.000001 fu! s:insertstr() | |
let str = 'Insert: c[w]ord/c[f]ile/[s]earch/[v]isual/[c]lipboard/[r]egister? ' | |
retu s:choices(str, ['w', 'f', 's', 'v', 'c', 'r'], 's:insertstr', []) | |
endf | |
1 0.000002 fu! s:textdialog(str) | |
redr | echoh MoreMsg | echon a:str | echoh None | |
retu nr2char(getchar()) | |
endf | |
1 0.000003 fu! s:choices(str, choices, func, args) | |
let char = s:textdialog(a:str) | |
if index(a:choices, char) >= 0 | |
retu char | |
elsei char =~# "\\v\<Esc>|\<C-c>|\<C-g>|\<C-u>|\<C-w>|\<C-[>" | |
cal s:BuildPrompt(0) | |
retu 'cancel' | |
elsei char =~# "\<CR>" && a:args != [] | |
retu a:args[0] | |
en | |
retu call(a:func, a:args) | |
endf | |
1 0.000001 fu! s:getregs() | |
let char = s:textdialog('Insert from register: ') | |
if char =~# "\\v\<Esc>|\<C-c>|\<C-g>|\<C-u>|\<C-w>|\<C-[>" | |
cal s:BuildPrompt(0) | |
retu -1 | |
elsei char =~# "\<CR>" | |
retu s:getregs() | |
en | |
retu s:regisfilter(char) | |
endf | |
1 0.000002 fu! s:regisfilter(reg) | |
retu substitute(getreg(a:reg), "[\t\n]", ' ', 'g') | |
endf | |
" Misc {{{2 | |
1 0.000001 fu! s:modevar() | |
let s:matchtype = s:mtype() | |
let s:ispath = s:ispathitem() | |
let s:mfunc = s:mfunc() | |
let s:nolim = s:getextvar('nolim') | |
let s:dosort = s:getextvar('sort') | |
let s:spi = !s:itemtype || s:getextvar('specinput') > 0 | |
endf | |
1 0.000002 fu! s:nosort() | |
retu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef ) | |
\ || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort | |
endf | |
1 0.000002 fu! s:byfname() | |
retu s:ispath && s:byfname | |
endf | |
1 0.000002 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 == {} && !exists('s:did_exp') | |
endf | |
1 0.000001 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 | |
1 0.000001 fu! s:migemo(str) | |
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) | |
en | |
if len(dict) | |
let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s'] | |
for token in tokens | |
let rtn = system(printf(cmd, shellescape(token), shellescape(dict))) | |
let str .= !v:shell_error && strlen(rtn) > 0 ? '.*'.rtn : token | |
endfo | |
en | |
retu str | |
endf | |
1 0.000002 fu! s:strwidth(str) | |
retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str) | |
endf | |
1 0.000002 fu! ctrlp#j2l(nr) | |
exe 'norm!' a:nr.'G' | |
sil! norm! zvzz | |
endf | |
1 0.000001 fu! s:maxf(len) | |
retu s:maxfiles && a:len > s:maxfiles | |
endf | |
1 0.000001 fu! s:regexfilter(str) | |
let str = a:str | |
for key in keys(s:fpats) | if str =~ key | |
let str = substitute(str, s:fpats[key], '', 'g') | |
en | endfo | |
retu str | |
endf | |
1 0.000002 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 | |
endf | |
1 0.000001 fu! s:delent(rfunc) | |
if a:rfunc == '' | retu | en | |
let [s:force, tbrem] = [1, []] | |
if exists('s:marked') | |
let tbrem = values(s:marked) | |
cal s:unmarksigns() | |
unl s:marked | |
en | |
if tbrem == [] && ( has('dialog_gui') || has('dialog_con') ) && | |
\ confirm("Wipe all entries?", "&OK\n&Cancel") != 1 | |
unl s:force | |
cal s:BuildPrompt(0) | |
retu | |
en | |
let g:ctrlp_lines = call(a:rfunc, [tbrem]) | |
cal s:BuildPrompt(1) | |
unl s:force | |
endf | |
" Entering & Exiting {{{2 | |
1 0.000002 fu! s:getenv() | |
let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] | |
let [s:crword, s:crnbword] = [expand('<cword>', 1), expand('<cWORD>', 1)] | |
let [s:crgfile, s:crline] = [expand('<cfile>', 1), getline('.')] | |
let [s:winmaxh, s:crcursor] = [min([s:mw_max, &lines]), getpos('.')] | |
let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] | |
let s:crfile = bufname('%') == '' | |
\ ? '['.s:crbufnr.'*No Name]' : expand('%:p', 1) | |
let s:crfpath = expand('%:p:h', 1) | |
let s:mrbs = ctrlp#mrufiles#bufs() | |
endf | |
1 0.000001 fu! s:lastvisual() | |
let cview = winsaveview() | |
let [ovreg, ovtype] = [getreg('v'), getregtype('v')] | |
let [oureg, outype] = [getreg('"'), getregtype('"')] | |
sil! norm! gv"vy | |
let selected = s:regisfilter('v') | |
cal setreg('v', ovreg, ovtype) | |
cal setreg('"', oureg, outype) | |
cal winrestview(cview) | |
retu selected | |
endf | |
1 0.000002 fu! s:log(m) | |
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m | |
let cadir = ctrlp#utils#cachedir() | |
let apd = g:ctrlp_log > 1 ? '>' : '' | |
sil! exe 'redi! >'.apd cadir.s:lash(cadir).'ctrlp.log' | |
el | |
sil! redi END | |
en | en | |
endf | |
1 0.000003 fu! s:buffunc(e) | |
if a:e && has_key(s:buffunc, 'enter') | |
cal call(s:buffunc['enter'], [], s:buffunc) | |
elsei !a:e && has_key(s:buffunc, 'exit') | |
cal call(s:buffunc['exit'], [], s:buffunc) | |
en | |
endf | |
1 0.000002 fu! s:openfile(cmd, fid, tail, chkmod, ...) | |
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 ) s:fnesc(a:fid, 'f') | |
if j2l | |
cal ctrlp#j2l(j2l) | |
en | |
if !empty(a:tail) | |
sil! norm! zvzz | |
en | |
if cmd != 'bad' | |
cal ctrlp#setlcdir() | |
en | |
endf | |
1 0.000002 fu! ctrlp#tabcount() | |
if exists('s:tabct') | |
let tabct = s:tabct | |
let s:tabct += 1 | |
elsei !type(s:tabpage) | |
let tabct = s:tabpage | |
elsei type(s:tabpage) == 1 | |
let tabpos = | |
\ s:tabpage =~ 'c' ? tabpagenr() : | |
\ s:tabpage =~ 'f' ? 1 : | |
\ s:tabpage =~ 'l' ? tabpagenr('$') : | |
\ tabpagenr() | |
let tabct = | |
\ s:tabpage =~ 'a' ? tabpos : | |
\ s:tabpage =~ 'b' ? tabpos - 1 : | |
\ tabpos | |
en | |
retu tabct < 0 ? 0 : tabct | |
endf | |
1 0.000002 fu! s:settype(type) | |
retu a:type < 0 ? exists('s:itemtype') ? s:itemtype : 0 : a:type | |
endf | |
" Matching {{{2 | |
1 0.000002 fu! s:matchfname(item, pat) | |
let parts = split(a:item, '[\/]\ze[^\/]\+$') | |
let mfn = match(parts[-1], a:pat[0]) | |
retu len(a:pat) == 1 ? mfn : len(a:pat) == 2 ? | |
\ ( mfn >= 0 && ( len(parts) == 2 ? match(parts[0], a:pat[1]) : -1 ) >= 0 | |
\ ? 0 : -1 ) : -1 | |
en | |
endf | |
1 0.000002 fu! s:matchtabs(item, pat) | |
retu match(split(a:item, '\t\+')[0], a:pat) | |
endf | |
1 0.000004 fu! s:matchtabe(item, pat) | |
retu match(split(a:item, '\t\+[^\t]\+$')[0], a:pat) | |
endf | |
1 0.000001 fu! s:buildpat(lst) | |
let pat = a:lst[0] | |
for item in range(1, len(a:lst) - 1) | |
let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] | |
endfo | |
retu pat | |
endf | |
1 0.000001 fu! s:mfunc() | |
let mfunc = 'match' | |
if s:byfname() | |
let mfunc = 's:matchfname' | |
elsei s:itemtype > 2 | |
let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } | |
if has_key(matchtypes, s:matchtype) | |
let mfunc = matchtypes[s:matchtype] | |
en | |
en | |
retu mfunc | |
endf | |
1 0.000002 fu! s:mmode() | |
let matchmodes = { | |
\ 'match': 'full-line', | |
\ 's:matchfname': 'filename-only', | |
\ 's:matchtabs': 'first-non-tab', | |
\ 's:matchtabe': 'until-last-tab', | |
\ } | |
retu matchmodes[s:mfunc] | |
endf | |
" Cache {{{2 | |
1 0.000002 fu! s:writecache(cafile) | |
if ( g:ctrlp_newcache || !filereadable(a:cafile) ) && !s:nocache() | |
cal ctrlp#utils#writecache(g:ctrlp_allfiles) | |
let g:ctrlp_newcache = 0 | |
en | |
endf | |
1 0.000001 fu! s:nocache(...) | |
if !s:caching | |
retu 1 | |
elsei s:caching > 1 | |
if !( exists(s:ccex) && !{s:ccex} ) || has_key(s:ficounts, s:dyncwd) | |
retu get(s:ficounts, s:dyncwd, [0, 0])[0] < s:caching | |
elsei a:0 && filereadable(a:1) | |
retu len(ctrlp#utils#readfile(a:1)) < s:caching | |
en | |
retu 1 | |
en | |
retu 0 | |
endf | |
1 0.000002 fu! s:insertcache(str) | |
let [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str] | |
if data == [] || strlen(str) <= strlen(data[0]) | |
let pos = 0 | |
elsei strlen(str) >= strlen(data[-1]) | |
let pos = len(data) - 1 | |
el | |
let pos = 0 | |
for each in data | |
if strlen(each) > strlen(str) | brea | en | |
let pos += 1 | |
endfo | |
en | |
cal insert(data, str, pos) | |
cal s:writecache(ctrlp#utils#cachefile()) | |
endf | |
" Extensions {{{2 | |
1 0.000001 fu! s:mtype() | |
retu s:itemtype > 2 ? s:getextvar('type') : 'path' | |
endf | |
1 0.000001 fu! s:execextvar(key) | |
if !empty(g:ctrlp_ext_vars) | |
cal map(filter(copy(g:ctrlp_ext_vars), | |
\ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])') | |
en | |
endf | |
1 0.000001 fu! s:getextvar(key) | |
if s:itemtype > 2 | |
let vars = g:ctrlp_ext_vars[s:itemtype - 3] | |
retu has_key(vars, a:key) ? vars[a:key] : -1 | |
en | |
retu -1 | |
endf | |
1 0.000002 fu! ctrlp#getcline() | |
let [linenr, offset] = [line('.'), ( s:offset > 0 ? s:offset : 0 )] | |
retu !empty(s:lines) && !( offset && linenr <= offset ) | |
\ ? s:lines[linenr - 1 - offset] : '' | |
endf | |
1 0.000004 fu! ctrlp#getmarkedlist() | |
retu exists('s:marked') ? values(s:marked) : [] | |
endf | |
1 0.000002 fu! ctrlp#exit() | |
cal s:PrtExit() | |
endf | |
1 0.000002 fu! ctrlp#prtclear() | |
cal s:PrtClear() | |
endf | |
1 0.000002 fu! ctrlp#switchtype(id) | |
cal s:ToggleType(a:id - s:itemtype) | |
endf | |
1 0.000002 fu! ctrlp#nosy() | |
retu !( has('syntax') && exists('g:syntax_on') ) | |
endf | |
1 0.000002 fu! ctrlp#hicheck(grp, defgrp) | |
if !hlexists(a:grp) | |
exe 'hi link' a:grp a:defgrp | |
en | |
endf | |
1 0.000002 fu! ctrlp#call(func, ...) | |
retu call(a:func, a:000) | |
endf | |
1 0.000004 fu! ctrlp#getvar(var) | |
retu {a:var} | |
endf | |
"}}}1 | |
" * Initialization {{{1 | |
1 0.000001 fu! ctrlp#setlines(...) | |
if a:0 | let s:itemtype = a:1 | en | |
cal s:modevar() | |
let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()'] | |
if !empty(g:ctrlp_ext_vars) | |
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])') | |
en | |
let g:ctrlp_lines = eval(types[s:itemtype]) | |
endf | |
1 0.000002 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 s:Reset(a:0 ? a:1 : {}) | |
noa cal s:Open() | |
cal s:SetWD(a:0 ? a:1 : {}) | |
cal s:MapNorms() | |
cal s:MapSpecs() | |
cal ctrlp#syntax() | |
cal ctrlp#setlines(s:settype(a:type)) | |
cal s:SetDefTxt() | |
cal s:BuildPrompt(1) | |
if s:keyloop | cal s:KeyLoop() | en | |
endf | |
" - Autocmds {{{1 | |
1 0.000004 if has('autocmd') | |
1 0.000005 aug CtrlPAug | |
1 0.000184 au! | |
1 0.000009 au BufEnter ControlP cal s:checkbuf() | |
1 0.000005 au BufLeave ControlP noa cal s:Close() | |
1 0.000011 au VimLeavePre * cal s:leavepre() | |
1 0.000002 aug END | |
1 0.000001 en | |
1 0.000003 fu! s:autocmds() | |
if !has('autocmd') | retu | en | |
if exists('#CtrlPLazy') | |
au! CtrlPLazy | |
en | |
if s:lazy | |
aug CtrlPLazy | |
au! | |
au CursorHold ControlP cal s:ForceUpdate() | |
aug END | |
en | |
endf | |
"}}} | |
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2 | |
FUNCTION <SNR>52_compmatlen() | |
Called 807 times | |
Total time: 0.251483 | |
Self time: 0.011451 | |
count total (s) self (s) | |
" By match length | |
807 0.125888 0.005030 let mln1 = s:shortest(s:matchlens(a:1, s:compat)) | |
807 0.123795 0.004621 let mln2 = s:shortest(s:matchlens(a:2, s:compat)) | |
807 0.001138 retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1 | |
FUNCTION <SNR>52_PrtFocusMap() | |
Called 43 times | |
Total time: 27.494456 | |
Self time: 0.000423 | |
count total (s) self (s) | |
43 27.494414 0.000381 cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char]) | |
FUNCTION <SNR>52_nocache() | |
Called 1 time | |
Total time: 0.000013 | |
Self time: 0.000013 | |
count total (s) self (s) | |
1 0.000001 if !s:caching | |
retu 1 | |
elsei s:caching > 1 | |
if !( exists(s:ccex) && !{s:ccex} ) || has_key(s:ficounts, s:dyncwd) | |
retu get(s:ficounts, s:dyncwd, [0, 0])[0] < s:caching | |
elsei a:0 && filereadable(a:1) | |
retu len(ctrlp#utils#readfile(a:1)) < s:caching | |
en | |
retu 1 | |
en | |
1 0.000001 retu 0 | |
FUNCTION <SNR>52_PrtAdd() | |
Called 43 times | |
Total time: 27.494033 | |
Self time: 0.000712 | |
count total (s) self (s) | |
43 0.000067 unl! s:hstgot | |
43 0.000089 let s:act_add = 1 | |
43 0.000130 let s:prompt[0] .= a:char | |
43 27.493609 0.000288 cal s:BuildPrompt(1) | |
43 0.000076 unl s:act_add | |
FUNCTION ctrlp#utils#opts() | |
Called 1 time | |
Total time: 0.000070 | |
Self time: 0.000049 | |
count total (s) self (s) | |
1 0.000009 0.000004 let s:lash = ctrlp#utils#lash() | |
1 0.000018 0.000009 let usrhome = $HOME . s:lash( $HOME ) | |
1 0.000006 let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache' | |
1 0.000021 0.000014 let cadir = isdirectory(usrhome.'.ctrlp_cache') ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp' | |
1 0.000003 if exists('g:ctrlp_cache_dir') | |
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 | |
1 0.000003 let s:cache_dir = cadir | |
FUNCTION ctrlp#hicheck() | |
Called 8 times | |
Total time: 0.000110 | |
Self time: 0.000110 | |
count total (s) self (s) | |
8 0.000036 if !hlexists(a:grp) | |
8 0.000066 exe 'hi link' a:grp a:defgrp | |
8 0.000003 en | |
FUNCTION <SNR>52_gethistloc() | |
Called 4 times | |
Total time: 0.000187 | |
Self time: 0.000088 | |
count total (s) self (s) | |
4 0.000034 0.000023 let utilcadir = ctrlp#utils#cachedir() | |
4 0.000080 0.000034 let cache_dir = utilcadir.s:lash(utilcadir).'hist' | |
4 0.000070 0.000028 retu [cache_dir, cache_dir.s:lash(cache_dir).'cache.txt'] | |
FUNCTION 7() | |
Called 264 times | |
Total time: 0.052702 | |
Self time: 0.001658 | |
count total (s) self (s) | |
264 0.052604 0.001560 call self.add_section(a:group, (g:airline_symbols.space).a:contents.(g:airline_symbols.space)) | |
FUNCTION 8() | |
Called 423 times | |
Total time: 0.093495 | |
Self time: 0.023792 | |
count total (s) self (s) | |
423 0.000558 if self._curgroup != '' | |
343 0.000496 if self._curgroup == a:group | |
44 0.000098 let self._line .= self._side ? self._context.left_alt_sep : self._context.right_alt_sep | |
44 0.000020 else | |
299 0.070961 0.001258 call airline#highlighter#add_separator(self._curgroup, a:group, self._side) | |
299 0.001187 let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#' | |
299 0.000849 let self._line .= self._side ? self._context.left_sep : self._context.right_sep | |
299 0.000155 endif | |
343 0.000143 endif | |
423 0.000606 if self._curgroup != a:group | |
379 0.000849 let self._line .= '%#'.a:group.'#' | |
379 0.000170 endif | |
423 0.000328 if self._context.active | |
299 0.000327 let contents = [] | |
299 0.001391 let content_parts = split(a:contents, '__accent') | |
603 0.000657 for cpart in content_parts | |
304 0.001278 let accent = matchstr(cpart, '_\zs[^#]*\ze') | |
304 0.000616 call add(contents, cpart) | |
304 0.000221 endfor | |
299 0.000800 let line = join(contents, a:group) | |
299 0.001333 let line = substitute(line, '__restore__', a:group, 'g') | |
299 0.000128 else | |
124 0.001103 let line = substitute(a:contents, '%#__accent[^#]*#', '', 'g') | |
124 0.000717 let line = substitute(line, '%#__restore__#', '', 'g') | |
124 0.000081 endif | |
423 0.000639 let self._line .= line | |
423 0.000533 let self._curgroup = a:group | |
FUNCTION 9() | |
Called 54 times | |
Total time: 0.000086 | |
Self time: 0.000086 | |
count total (s) self (s) | |
54 0.000080 let self._line .= a:text | |
FUNCTION <SNR>45_PrevNonBlankNonString() | |
Called 8 times | |
Total time: 0.017092 | |
Self time: 0.000429 | |
count total (s) self (s) | |
8 0.000015 let in_block = 0 | |
8 0.000024 let lnum = prevnonblank(a:lnum) | |
8 0.000016 while lnum > 0 | |
" Go in and out of blocks comments as necessary. | |
" If the line isn't empty (with opt. comment) or in a string, end search. | |
8 0.000022 let line = getline(lnum) | |
8 0.000032 if line =~ '^=begin' | |
if in_block | |
let in_block = 0 | |
else | |
break | |
endif | |
elseif !in_block && line =~ '^=end' | |
let in_block = 1 | |
elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line))) | |
8 0.000012 break | |
endif | |
let lnum = prevnonblank(lnum - 1) | |
endwhile | |
8 0.000011 return lnum | |
FUNCTION <SNR>41_build_sections() | |
Called 41 times | |
Total time: 0.047699 | |
Self time: 0.001845 | |
count total (s) self (s) | |
200 0.000221 for key in a:keys | |
159 0.000311 if key == 'warning' && !a:context.active | |
31 0.000030 continue | |
endif | |
128 0.046486 0.000632 call s:add_section(a:builder, a:context, key) | |
128 0.000133 endfor | |
FUNCTION <SNR>52_regisfilter() | |
Called 1 time | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
1 0.000011 retu substitute(getreg(a:reg), "[\t\n]", ' ', 'g') | |
FUNCTION ctrlp#utils#lash() | |
Called 2 times | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
2 0.000011 retu &ssl || !exists('+ssl') ? '/' : '\' | |
FUNCTION airline#util#exec_funcrefs() | |
Called 37 times | |
Total time: 0.056675 | |
Self time: 0.000990 | |
count total (s) self (s) | |
90 0.000151 for Fn in a:list | |
90 0.056207 0.000522 let code = call(Fn, a:000) | |
90 0.000100 if code != 0 | |
37 0.000027 return code | |
endif | |
53 0.000025 endfor | |
return 0 | |
FUNCTION airline#highlighter#highlight() | |
Called 27 times | |
Total time: 0.235429 | |
Self time: 0.065649 | |
count total (s) self (s) | |
27 0.000091 let p = g:airline#themes#{g:airline_theme}#palette | |
" draw the base mode, followed by any overrides | |
27 0.000277 let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val') | |
27 0.000065 let suffix = a:modes[0] == 'inactive' ? '_inactive' : '' | |
81 0.000096 for mode in mapped | |
54 0.000246 if exists('g:airline#themes#{g:airline_theme}#palette[mode]') | |
54 0.000162 let dict = g:airline#themes#{g:airline_theme}#palette[mode] | |
789 0.001250 for kvp in items(dict) | |
735 0.001226 let mode_colors = kvp[1] | |
735 0.023675 0.002810 call airline#highlighter#exec(kvp[0].suffix, mode_colors) | |
2205 0.003086 for accent in keys(s:accents) | |
1470 0.002410 if !has_key(p.accents, accent) | |
continue | |
endif | |
1470 0.004133 let colors = copy(mode_colors) | |
1470 0.002522 if p.accents[accent][0] != '' | |
735 0.001533 let colors[0] = p.accents[accent][0] | |
735 0.000340 endif | |
1470 0.002227 if p.accents[accent][2] != '' | |
735 0.001390 let colors[2] = p.accents[accent][2] | |
735 0.000330 endif | |
1470 0.001707 if len(colors) >= 5 | |
378 0.000981 let colors[4] = get(p.accents[accent], 4, '') | |
378 0.000176 else | |
1092 0.003014 call add(colors, get(p.accents[accent], 4, '')) | |
1092 0.000471 endif | |
1470 0.051811 0.006558 call airline#highlighter#exec(kvp[0].suffix.'_'.accent, colors) | |
1470 0.000989 endfor | |
735 0.000357 endfor | |
" TODO: optimize this | |
592 0.000872 for sep in items(s:separators) | |
538 0.107691 0.004029 call <sid>exec_separator(dict, sep[1][0], sep[1][1], sep[1][2], suffix) | |
538 0.000378 endfor | |
54 0.000026 endif | |
54 0.000023 endfor | |
FUNCTION airline#parts#mode() | |
Called 93 times | |
Total time: 0.000291 | |
Self time: 0.000291 | |
count total (s) self (s) | |
93 0.000240 return get(w:, 'airline_current_mode', '') | |
FUNCTION <SNR>52_ispathitem() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
1 0.000003 retu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' ) | |
FUNCTION <SNR>36_get_array() | |
Called 1674 times | |
Total time: 0.013556 | |
Self time: 0.013556 | |
count total (s) self (s) | |
1674 0.001724 let fg = a:fg | |
1674 0.001552 let bg = a:bg | |
1674 0.009393 return has('gui_running') ? [ fg, bg, '', '', join(a:opts, ',') ] : [ '', '', fg, bg, join(a:opts, ',') ] | |
FUNCTION <SNR>36_exec_separator() | |
Called 837 times | |
Total time: 0.169407 | |
Self time: 0.020418 | |
count total (s) self (s) | |
837 0.069150 0.003384 let l:from = airline#themes#get_highlight(a:from.a:suffix) | |
837 0.063638 0.003130 let l:to = airline#themes#get_highlight(a:to.a:suffix) | |
837 0.002191 let group = a:from.'_to_'.a:to.a:suffix | |
837 0.000650 if a:inverse | |
370 0.001251 let colors = [ l:from[1], l:to[1], l:from[3], l:to[3] ] | |
370 0.000168 else | |
467 0.001691 let colors = [ l:to[1], l:from[1], l:to[3], l:from[3] ] | |
467 0.000210 endif | |
837 0.001988 let a:dict[group] = colors | |
837 0.025638 0.002923 call airline#highlighter#exec(group, colors) | |
FUNCTION <SNR>52_comparent() | |
Called 807 times | |
Total time: 0.080011 | |
Self time: 0.018494 | |
count total (s) self (s) | |
" By same parent dir | |
807 0.001793 if !stridx(s:crfpath, s:dyncwd) | |
807 0.015740 0.006039 let [as1, as2] = [s:dyncwd.s:lash().a:1, s:dyncwd.s:lash().a:2] | |
807 0.056903 0.005087 let [loc1, loc2] = [s:getparent(as1), s:getparent(as2)] | |
807 0.002282 if loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en | |
807 0.001766 if loc2 == s:crfpath && loc1 != s:crfpath | retu 1 | en | |
807 0.000461 retu 0 | |
en | |
retu 0 | |
FUNCTION airline#extensions#quickfix#apply() | |
Called 6 times | |
Total time: 0.000051 | |
Self time: 0.000051 | |
count total (s) self (s) | |
6 0.000012 if &buftype == 'quickfix' | |
let w:airline_section_a = s:get_text() | |
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' | |
let w:airline_section_c = '' | |
let w:airline_section_x = '' | |
endif | |
FUNCTION <SNR>52_mtype() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
1 0.000003 retu s:itemtype > 2 ? s:getextvar('type') : 'path' | |
FUNCTION <SNR>45_IsInString() | |
Called 3 times | |
Total time: 0.000446 | |
Self time: 0.000446 | |
count total (s) self (s) | |
3 0.000444 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string | |
FUNCTION <SNR>52_MapNorms() | |
Called 1 time | |
Total time: 0.001414 | |
Self time: 0.001414 | |
count total (s) self (s) | |
1 0.000004 if exists('s:nmapped') && s:nmapped == s:bufnr | retu | en | |
1 0.000009 let pcmd = "nn \<buffer> \<silent> \<k%s> :\<c-u>cal \<SID>%s(\"%s\")\<cr>" | |
1 0.000008 let cmd = substitute(pcmd, 'k%s', 'char-%d', '') | |
1 0.000001 let pfunc = 'PrtFocusMap' | |
1 0.000040 let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123) | |
4 0.000006 for each in [34, 92, 124] | |
3 0.000048 exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\')) | |
3 0.000001 endfo | |
93 0.000061 for each in ranges | |
92 0.000939 exe printf(cmd, each, pfunc, nr2char(each)) | |
92 0.000050 endfo | |
11 0.000012 for each in range(0, 9) | |
10 0.000114 exe printf(pcmd, each, pfunc, each) | |
10 0.000006 endfo | |
6 0.000013 for [ke, va] in items(s:kprange) | |
5 0.000056 exe printf(pcmd, ke, pfunc, va) | |
5 0.000003 endfo | |
1 0.000002 let s:nmapped = s:bufnr | |
FUNCTION <SNR>30_is_excluded_window() | |
Called 36 times | |
Total time: 0.001536 | |
Self time: 0.001536 | |
count total (s) self (s) | |
36 0.000067 for matchft in g:airline_exclude_filetypes | |
if matchft ==# &ft | |
return 1 | |
endif | |
endfor | |
144 0.000153 for matchw in g:airline_exclude_filenames | |
108 0.000621 if matchstr(expand('%'), matchw) ==# matchw | |
return 1 | |
endif | |
108 0.000063 endfor | |
36 0.000044 if g:airline_exclude_preview && &previewwindow | |
return 1 | |
endif | |
36 0.000019 return 0 | |
FUNCTION <SNR>52_iscmdwin() | |
Called 1 time | |
Total time: 0.000030 | |
Self time: 0.000030 | |
count total (s) self (s) | |
1 0.000003 let ermsg = v:errmsg | |
1 0.000010 sil! noa winc p | |
1 0.000006 sil! noa winc p | |
1 0.000004 let [v:errmsg, ermsg] = [ermsg, v:errmsg] | |
1 0.000005 retu ermsg =~ '^E11:' | |
FUNCTION <SNR>52_unmarksigns() | |
Called 45 times | |
Total time: 0.000316 | |
Self time: 0.000156 | |
count total (s) self (s) | |
45 0.000292 0.000132 if !s:dosigns() | retu | en | |
for key in keys(s:marked) | |
exe 'sign unplace' key 'buffer='.s:bufnr | |
endfo | |
FUNCTION <SNR>52_walker() | |
Called 88 times | |
Total time: 0.000228 | |
Self time: 0.000228 | |
count total (s) self (s) | |
88 0.000209 retu a:d >= 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m | |
FUNCTION <SNR>52_PrtExit() | |
Called 1 time | |
Total time: 0.003916 | |
Self time: 0.000058 | |
count total (s) self (s) | |
1 0.000015 if bufnr('%') == s:bufnr && bufname('%') == 'ControlP' | |
1 0.003886 0.000028 noa cal s:Close() | |
1 0.000012 noa winc p | |
1 0.000001 en | |
FUNCTION ctrlp#utils#readfile() | |
Called 1 time | |
Total time: 0.000050 | |
Self time: 0.000050 | |
count total (s) self (s) | |
1 0.000012 if filereadable(a:file) | |
1 0.000028 let data = readfile(a:file) | |
1 0.000005 if empty(data) || type(data) != 3 | |
unl data | |
let data = [] | |
en | |
1 0.000001 retu data | |
en | |
retu [] | |
FUNCTION <SNR>52_Close() | |
Called 1 time | |
Total time: 0.003858 | |
Self time: 0.000923 | |
count total (s) self (s) | |
1 0.000027 0.000007 cal s:buffunc(0) | |
1 0.000005 if winnr('$') == 1 | |
bw! | |
el | |
1 0.000294 try | bun! | |
1 0.000006 cat | clo! | endt | |
1 0.000027 0.000009 cal s:unmarksigns() | |
1 0.000001 en | |
34 0.000124 for key in keys(s:glbs) | if exists('+'.key) | |
17 0.000293 sil! exe 'let &'.key.' = s:glb_'.key | |
33 0.000037 en | endfo | |
1 0.000005 if exists('s:glb_acd') | let &acd = s:glb_acd | en | |
1 0.000003 let g:ctrlp_lines = [] | |
1 0.000007 if s:winres[1] >= &lines && s:winres[2] == winnr('$') | |
1 0.000036 exe s:winres[0].s:winres[0] | |
1 0.000001 en | |
1 0.000015 unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr s:mrbs s:did_exp | |
1 0.002871 0.000014 cal ctrlp#recordhist() | |
1 0.000028 0.000014 cal s:execextvar('exit') | |
1 0.000033 0.000007 cal s:log(0) | |
1 0.000004 let v:errmsg = s:ermsg | |
1 0.000018 ec | |
FUNCTION <SNR>52_writecache() | |
Called 1 time | |
Total time: 0.015257 | |
Self time: 0.000029 | |
count total (s) self (s) | |
1 0.000031 0.000018 if ( g:ctrlp_newcache || !filereadable(a:cafile) ) && !s:nocache() | |
1 0.015222 0.000007 cal ctrlp#utils#writecache(g:ctrlp_allfiles) | |
1 0.000004 let g:ctrlp_newcache = 0 | |
1 0.000000 en | |
FUNCTION <SNR>52_SplitPattern() | |
Called 44 times | |
Total time: 0.011695 | |
Self time: 0.007213 | |
count total (s) self (s) | |
44 0.000060 let str = a:str | |
44 0.000120 if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo') | |
let str = s:migemo(str) | |
en | |
44 0.000094 let s:savestr = str | |
44 0.000026 if s:regexp | |
let pat = s:regexfilter(str) | |
el | |
44 0.001043 let lst = split(str, '\zs') | |
44 0.000124 if exists('+ssl') && !&ssl | |
cal map(lst, 'escape(v:val, ''\'')') | |
en | |
176 0.000230 for each in ['^', '$', '.'] | |
132 0.003633 cal map(lst, 'escape(v:val, each)') | |
132 0.000188 endfo | |
44 0.000020 en | |
44 0.000063 if exists('lst') | |
44 0.000042 let pat = '' | |
44 0.000054 if !empty(lst) | |
43 0.000221 0.000157 if s:byfname() && index(lst, ';') > 0 | |
let fbar = index(lst, ';') | |
let lst_1 = s:sublist(lst, 0, fbar - 1) | |
let lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : [''] | |
let pat = s:buildpat(lst_1).';'.s:buildpat(lst_2) | |
el | |
43 0.004561 0.000143 let pat = s:buildpat(lst) | |
43 0.000019 en | |
43 0.000018 en | |
44 0.000017 en | |
44 0.000230 retu escape(pat, '~') | |
FUNCTION <SNR>52_autocmds() | |
Called 1 time | |
Total time: 0.000015 | |
Self time: 0.000015 | |
count total (s) self (s) | |
1 0.000004 if !has('autocmd') | retu | en | |
1 0.000004 if exists('#CtrlPLazy') | |
au! CtrlPLazy | |
en | |
1 0.000000 if s:lazy | |
aug CtrlPLazy | |
au! | |
au CursorHold ControlP cal s:ForceUpdate() | |
aug END | |
en | |
FUNCTION <SNR>52_GlobPath() | |
Called 17 times | |
Total time: 3.953698 | |
Self time: 0.030597 | |
count total (s) self (s) | |
17 0.127910 let entries = split(globpath(a:dirs, s:glob), "\n") | |
17 0.482099 0.000234 let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1] | |
17 0.001128 cal extend(g:ctrlp_allfiles, dnf[1]) | |
17 0.000172 0.000129 if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth | |
16 0.714269 0.000131 sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1) | |
16 0.037901 0.002836 cal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, "g", ",")'), ','), depth) | |
16 0.000010 en | |
FUNCTION <SNR>52_MatchIt() | |
Called 44 times | |
Total time: 0.172274 | |
Self time: 0.150770 | |
count total (s) self (s) | |
44 0.000104 let [lines, id] = [[], 0] | |
44 0.000286 0.000223 let pat = s:byfname() ? map(split(a:pat, '^[^;]\+\\\@<!\zs;', 1), 's:martcs.v:val') : s:martcs.a:pat | |
6256 0.003763 for item in a:items | |
6240 0.004060 let id += 1 | |
12436 0.086567 try | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0 | |
408 0.000722 cal add(lines, item) | |
6608 0.002271 en | cat | brea | endt | |
6268 0.008351 if a:limit > 0 && len(lines) >= a:limit | brea | en | |
6212 0.002491 endfo | |
44 0.043585 0.022144 let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)] | |
44 0.000048 retu lines | |
FUNCTION <SNR>52_setupblank() | |
Called 1 time | |
Total time: 0.000050 | |
Self time: 0.000050 | |
count total (s) self (s) | |
1 0.000018 setl noswf nonu nobl nowrap nolist nospell nocuc wfh | |
1 0.000021 setl fdc=0 fdl=99 tw=0 bt=nofile bh=unload | |
1 0.000002 if v:version > 702 | |
1 0.000007 setl nornu noudf cc=0 | |
1 0.000000 en | |
FUNCTION airline#parts#paste() | |
Called 93 times | |
Total time: 0.000262 | |
Self time: 0.000262 | |
count total (s) self (s) | |
93 0.000228 return g:airline_detect_paste && &paste ? g:airline_symbols.paste : '' | |
FUNCTION ctrlp#utils#cachedir() | |
Called 4 times | |
Total time: 0.000011 | |
Self time: 0.000011 | |
count total (s) self (s) | |
4 0.000008 retu s:cache_dir | |
FUNCTION <SNR>52_settype() | |
Called 1 time | |
Total time: 0.000003 | |
Self time: 0.000003 | |
count total (s) self (s) | |
1 0.000003 retu a:type < 0 ? exists('s:itemtype') ? s:itemtype : 0 : a:type | |
FUNCTION airline#update_statusline() | |
Called 6 times | |
Total time: 0.060914 | |
Self time: 0.001087 | |
count total (s) self (s) | |
37 0.000143 for nr in filter(range(1, winnr('$')), 'v:val != winnr()') | |
31 0.000121 call setwinvar(nr, 'airline_active', 0) | |
31 0.000163 let context = { 'winnr': nr, 'active': 0, 'bufnr': winbufnr(nr) } | |
31 0.046375 0.000231 call s:invoke_funcrefs(context, s:inactive_funcrefs) | |
31 0.000067 endfor | |
6 0.000008 unlet! w:airline_render_left | |
6 0.000005 unlet! w:airline_render_right | |
54 0.000049 for section in s:sections | |
48 0.000100 unlet! w:airline_section_{section} | |
48 0.000020 endfor | |
6 0.000011 let w:airline_active = 1 | |
6 0.000032 let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) } | |
6 0.013724 0.000041 call s:invoke_funcrefs(context, g:airline_statusline_funcrefs) | |
FUNCTION <SNR>13_on_window_changed() | |
Called 4 times | |
Total time: 0.040899 | |
Self time: 0.000099 | |
count total (s) self (s) | |
4 0.000026 if pumvisible() | |
return | |
endif | |
4 0.000128 0.000027 call <sid>init() | |
4 0.040718 0.000019 call airline#update_statusline() | |
FUNCTION <SNR>52_comptime() | |
Called 807 times | |
Total time: 0.008872 | |
Self time: 0.008872 | |
count total (s) self (s) | |
" By last modified time | |
807 0.006922 let [time1, time2] = [getftime(a:1), getftime(a:2)] | |
807 0.001371 retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1 | |
FUNCTION airline#util#append() | |
Called 186 times | |
Total time: 0.001682 | |
Self time: 0.001682 | |
count total (s) self (s) | |
186 0.000292 if a:minwidth > 0 && winwidth(0) < a:minwidth | |
return '' | |
endif | |
186 0.000585 let prefix = s:spc == "\ua0" ? s:spc : s:spc.s:spc | |
186 0.000486 return empty(a:text) ? '' : prefix.g:airline_left_alt_sep.s:spc.a:text | |
FUNCTION 6() | |
Called 80 times | |
Total time: 0.000405 | |
Self time: 0.000405 | |
count total (s) self (s) | |
80 0.000089 let self._side = 0 | |
80 0.000277 let self._line .= '%#'.self._curgroup.'#'.(a:0 ? a:1 : '%=') | |
FUNCTION <SNR>52_Reset() | |
Called 1 time | |
Total time: 0.000761 | |
Self time: 0.000038 | |
count total (s) self (s) | |
1 0.000005 let opts = has_key(a:args, 'opts') ? [a:args['opts']] : [] | |
1 0.000643 0.000012 cal call('s:opts', opts) | |
1 0.000022 0.000007 cal s:autocmds() | |
1 0.000077 0.000007 cal ctrlp#utils#opts() | |
1 0.000014 0.000007 cal s:execextvar('opts') | |
FUNCTION ctrlp#setdir() | |
Called 1 time | |
Total time: 0.000106 | |
Self time: 0.000061 | |
count total (s) self (s) | |
1 0.000002 let cmd = a:0 ? a:1 : 'lc!' | |
1 0.000083 0.000038 sil! exe cmd s:fnesc(a:path, 'c') | |
1 0.000021 let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] | |
FUNCTION <SNR>52_multipliers() | |
Called 807 times | |
Total time: 0.007458 | |
Self time: 0.007458 | |
count total (s) self (s) | |
807 0.001087 let mp0 = !a:1 ? 0 : 2 | |
807 0.001413 let mp1 = !a:2 ? 0 : 1 + ( !mp0 ? 1 : mp0 ) | |
807 0.001513 let mp2 = !a:3 ? 0 : 1 + ( !( mp0 + mp1 ) ? 1 : ( mp0 + mp1 ) ) | |
807 0.001531 let mp3 = !a:4 ? 0 : 1 + ( !( mp0 + mp1 + mp2 ) ? 1 : ( mp0 + mp1 + mp2 ) ) | |
807 0.001235 retu [mp0, mp1, mp2, mp3] | |
FUNCTION <SNR>52_Update() | |
Called 44 times | |
Total time: 0.660695 | |
Self time: 0.026522 | |
count total (s) self (s) | |
" Get the previous string if existed | |
44 0.000172 let oldstr = exists('s:savestr') ? s:savestr : '' | |
" Get the new string sans tail | |
44 0.002333 0.000253 let str = s:sanstail(a:str) | |
" Stop if the string's unchanged | |
44 0.000172 if str == oldstr && !empty(str) && !exists('s:force') | retu | en | |
44 0.000234 let s:martcs = &scs && str =~ '\u' ? '\C' : '' | |
44 0.012137 0.000442 let pat = s:matcher == {} ? s:SplitPattern(str) : str | |
44 0.218709 0.024845 let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines) : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res) | |
44 0.426751 0.000217 cal s:Render(lines, pat) | |
FUNCTION <SNR>52_findroot() | |
Called 3 times | |
Total time: 0.002023 | |
Self time: 0.000413 | |
count total (s) self (s) | |
3 0.000011 let [depth, fnd] = [a:depth + 1, 0] | |
3 0.000006 if type(a:mark) == 1 | |
let fnd = s:glbpath(s:fnesc(a:curr, 'g', ','), a:mark, 1) != '' | |
elsei type(a:mark) == 3 | |
13 0.000019 for markr in a:mark | |
11 0.000821 0.000101 if s:glbpath(s:fnesc(a:curr, 'g', ','), markr, 1) != '' | |
1 0.000002 let fnd = 1 | |
1 0.000001 brea | |
en | |
10 0.000005 endfo | |
3 0.000003 en | |
3 0.000003 if fnd | |
1 0.000115 0.000009 if !a:type | cal ctrlp#setdir(a:curr) | en | |
1 0.000004 retu [exists('markr') ? markr : a:mark, a:curr] | |
elsei depth > s:maxdepth | |
cal ctrlp#setdir(s:cwd) | |
el | |
2 0.000073 0.000011 let parent = s:getparent(a:curr) | |
2 0.000005 if parent != a:curr | |
2 0.000010 retu s:findroot(parent, a:mark, depth, a:type) | |
en | |
en | |
retu [] | |
FUNCTION ctrlp#progress() | |
Called 16 times | |
Total time: 0.714138 | |
Self time: 0.713401 | |
count total (s) self (s) | |
16 0.020341 if has('macunix') || has('mac') | sl 1m | en | |
16 0.000145 let txt = a:0 ? '(press ctrl-c to abort)' : '' | |
16 0.000065 if s:status != {} | |
16 0.000126 let argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{ 'str': a:enum }] : [a:enum] | |
16 0.001140 0.000403 let &l:stl = call(s:status['prog'], argms, s:status) | |
16 0.000013 el | |
let &l:stl = '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*' | |
en | |
16 0.692203 redraws | |
FUNCTION airline#parts#readonly() | |
Called 93 times | |
Total time: 0.000238 | |
Self time: 0.000238 | |
count total (s) self (s) | |
93 0.000178 return &readonly ? g:airline_symbols.readonly : '' | |
FUNCTION airline#statusline() | |
Called 521 times | |
Total time: 0.008037 | |
Self time: 0.008037 | |
count total (s) self (s) | |
521 0.003721 if has_key(s:contexts, a:winnr) | |
521 0.003169 return '%{airline#check_mode('.a:winnr.')}'.s:contexts[a:winnr].line | |
endif | |
" in rare circumstances this happens...see #276 | |
return '' | |
FUNCTION <SNR>52_buildpat() | |
Called 43 times | |
Total time: 0.004418 | |
Self time: 0.004418 | |
count total (s) self (s) | |
43 0.000080 let pat = a:lst[0] | |
946 0.000722 for item in range(1, len(a:lst) - 1) | |
903 0.002884 let pat .= '[^'.a:lst[item - 1].']\{-}'.a:lst[item] | |
903 0.000382 endfo | |
43 0.000039 retu pat | |
FUNCTION <SNR>52_byfname() | |
Called 176 times | |
Total time: 0.000281 | |
Self time: 0.000281 | |
count total (s) self (s) | |
176 0.000222 retu s:ispath && s:byfname | |
FUNCTION ctrlp#utils#cachefile() | |
Called 2 times | |
Total time: 0.000100 | |
Self time: 0.000085 | |
count total (s) self (s) | |
2 0.000030 let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()] | |
2 0.000035 let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt' | |
2 0.000032 0.000017 retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file | |
FUNCTION ctrlp#utils#writecache() | |
Called 2 times | |
Total time: 0.017907 | |
Self time: 0.017825 | |
count total (s) self (s) | |
2 0.000063 0.000025 if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir)) | |
2 0.017834 0.017790 sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile()) | |
2 0.000007 en | |
FUNCTION airline#themes#get_highlight() | |
Called 1674 times | |
Total time: 0.126274 | |
Self time: 0.009188 | |
count total (s) self (s) | |
1674 0.125811 0.008725 return call('airline#highlighter#get_highlight', [a:group] + a:000) | |
FUNCTION <SNR>52_offset() | |
Called 44 times | |
Total time: 0.000249 | |
Self time: 0.000249 | |
count total (s) self (s) | |
44 0.000133 let s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0 | |
44 0.000098 retu s:offset > 0 ? ( repeat([''], s:offset) + a:lines ) : a:lines | |
FUNCTION <SNR>52_buffunc() | |
Called 2 times | |
Total time: 0.000033 | |
Self time: 0.000033 | |
count total (s) self (s) | |
2 0.000009 if a:e && has_key(s:buffunc, 'enter') | |
cal call(s:buffunc['enter'], [], s:buffunc) | |
elsei !a:e && has_key(s:buffunc, 'exit') | |
cal call(s:buffunc['exit'], [], s:buffunc) | |
en | |
FUNCTION <SNR>52_getenv() | |
Called 1 time | |
Total time: 0.000277 | |
Self time: 0.000132 | |
count total (s) self (s) | |
1 0.000031 let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] | |
1 0.000008 let [s:crword, s:crnbword] = [expand('<cword>', 1), expand('<cWORD>', 1)] | |
1 0.000007 let [s:crgfile, s:crline] = [expand('<cfile>', 1), getline('.')] | |
1 0.000007 let [s:winmaxh, s:crcursor] = [min([s:mw_max, &lines]), getpos('.')] | |
1 0.000156 0.000013 let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()] | |
1 0.000036 let s:crfile = bufname('%') == '' ? '['.s:crbufnr.'*No Name]' : expand('%:p', 1) | |
1 0.000018 let s:crfpath = expand('%:p:h', 1) | |
1 0.000011 0.000009 let s:mrbs = ctrlp#mrufiles#bufs() | |
FUNCTION <SNR>52_sanstail() | |
Called 44 times | |
Total time: 0.002080 | |
Self time: 0.002080 | |
count total (s) self (s) | |
44 0.000740 let str = s:spi ? substitute(a:str, '^\(@.*$\|\\\\\ze@\|\.\.\zs[.\/]\+$\)', '', 'g') : a:str | |
44 0.000380 let [str, pat] = [substitute(str, '\\\\', '\', 'g'), '\([^:]\|\\:\)*$'] | |
44 0.000044 unl! s:optail | |
44 0.000442 if str =~ '\\\@<!:'.pat | |
let s:optail = matchstr(str, '\\\@<!:\zs'.pat) | |
let str = substitute(str, '\\\@<!:'.pat, '', '') | |
en | |
44 0.000188 retu substitute(str, '\\\ze:', '', 'g') | |
FUNCTION airline#extensions#default#apply() | |
Called 36 times | |
Total time: 0.052480 | |
Self time: 0.001502 | |
count total (s) self (s) | |
36 0.000061 let winnr = a:context.winnr | |
36 0.000056 let active = a:context.active | |
36 0.000352 0.000208 if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse)) | |
5 0.004599 0.000027 call <sid>build_sections(a:builder, a:context, s:layout[0]) | |
5 0.000003 else | |
31 0.001849 0.000172 call a:builder.add_section('airline_c'.(a:context.bufnr), ' %f%m ') | |
31 0.000019 endif | |
36 0.001653 0.000297 call a:builder.split(s:get_section(winnr, 'gutter', '', '')) | |
36 0.000262 0.000160 if airline#util#getwinvar(winnr, 'airline_render_right', 1) | |
36 0.043311 0.000184 call <sid>build_sections(a:builder, a:context, s:layout[1]) | |
36 0.000016 endif | |
36 0.000025 return 1 | |
FUNCTION <SNR>52_narrowable() | |
Called 44 times | |
Total time: 0.000491 | |
Self time: 0.000491 | |
count total (s) self (s) | |
44 0.000471 retu exists('s:act_add') && exists('s:matched') && s:matched != [] && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp] && s:matcher == {} && !exists('s:did_exp') | |
FUNCTION <SNR>52_MapSpecs() | |
Called 1 time | |
Total time: 0.000887 | |
Self time: 0.000887 | |
count total (s) self (s) | |
1 0.000004 if !( exists('s:smapped') && s:smapped == s:bufnr ) | |
" Correct arrow keys in terminal | |
1 0.000018 if ( has('termresponse') && v:termresponse =~ "\<ESC>" ) || &term =~? '\vxterm|<k?vt|gnome|screen|linux|ansi' | |
5 0.000007 for each in ['\A <up>','\B <down>','\C <right>','\D <left>'] | |
4 0.000032 exe s:lcmap.' <esc>['.each | |
4 0.000004 endfo | |
1 0.000001 en | |
1 0.000001 en | |
121 0.000130 for [ke, va] in items(s:prtmaps) | for kp in va | |
53 0.000564 exe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>' | |
87 0.000038 endfo | endfo | |
1 0.000002 let s:smapped = s:bufnr | |
FUNCTION <SNR>52_getextvar() | |
Called 2 times | |
Total time: 0.000012 | |
Self time: 0.000012 | |
count total (s) self (s) | |
2 0.000001 if s:itemtype > 2 | |
let vars = g:ctrlp_ext_vars[s:itemtype - 3] | |
retu has_key(vars, a:key) ? vars[a:key] : -1 | |
en | |
2 0.000001 retu -1 | |
FUNCTION GetRubyIndent() | |
Called 5 times | |
Total time: 0.022587 | |
Self time: 0.001732 | |
count total (s) self (s) | |
" 3.1. Setup {{{2 | |
" ---------- | |
" For the current line, use the first argument if given, else v:lnum | |
5 0.000044 let clnum = a:0 ? a:1 : v:lnum | |
" Set up variables for restoring position in file. Could use clnum here. | |
5 0.000027 let vcol = col('.') | |
" 3.2. Work on the current line {{{2 | |
" ----------------------------- | |
" Get the current line. | |
5 0.000017 let line = getline(clnum) | |
5 0.000008 let ind = -1 | |
" If we got a closing bracket on an empty line, find its match and indent | |
" according to it. For parentheses we indent to its column - 1, for the | |
" others we indent to the containing line's MSL's level. Return -1 if fail. | |
5 0.000089 let col = matchend(line, '^\s*[]})]') | |
5 0.000032 if col > 0 && !s:IsInStringOrComment(clnum, col) | |
call cursor(clnum, col) | |
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) | |
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 | |
if line[col-1]==')' && col('.') != col('$') - 1 | |
let ind = virtcol('.') - 1 | |
else | |
let ind = indent(s:GetMSL(line('.'))) | |
endif | |
endif | |
return ind | |
endif | |
" If we have a =begin or =end set indent to first column. | |
5 0.000056 if match(line, '^\s*\%(=begin\|=end\)$') != -1 | |
return 0 | |
endif | |
" If we have a deindenting keyword, find its match and indent to its level. | |
" TODO: this is messy | |
5 0.000167 0.000046 if s:Match(clnum, s:ruby_deindent_keywords) | |
call cursor(clnum, 1) | |
if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', s:end_skip_expr) > 0 | |
let msl = s:GetMSL(line('.')) | |
let line = getline(line('.')) | |
if strpart(line, 0, col('.') - 1) =~ '=\s*$' && strpart(line, col('.') - 1, 2) !~ 'do' | |
let ind = virtcol('.') - 1 | |
elseif getline(msl) =~ '=\s*\(#.*\)\=$' | |
let ind = indent(line('.')) | |
else | |
let ind = indent(msl) | |
endif | |
endif | |
return ind | |
endif | |
" If we are in a multi-line string or line-comment, don't do anything to it. | |
5 0.000152 0.000069 if s:IsInStringOrDocumentation(clnum, matchend(line, '^\s*') + 1) | |
return indent('.') | |
endif | |
" If we are at the closing delimiter of a "<<" heredoc-style string, set the | |
" indent to 0. | |
5 0.000050 if line =~ '^\k\+\s*$' && s:IsInStringDelimiter(clnum, 1) && search('\V<<'.line, 'nbW') > 0 | |
return 0 | |
endif | |
" 3.3. Work on the previous line. {{{2 | |
" ------------------------------- | |
" Find a non-blank, non-multi-line string line above the current line. | |
5 0.012872 0.000041 let lnum = s:PrevNonBlankNonString(clnum - 1) | |
" If the line is empty and inside a string, use the previous line. | |
5 0.000039 if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1) | |
return indent(prevnonblank(clnum)) | |
endif | |
" At the start of the file use zero indent. | |
5 0.000005 if lnum == 0 | |
return 0 | |
endif | |
" Set up variables for the previous line. | |
5 0.000015 let line = getline(lnum) | |
5 0.000010 let ind = indent(lnum) | |
" If the previous line ended with a block opening, add a level of indent. | |
5 0.000197 0.000056 if s:Match(lnum, s:block_regex) | |
return indent(s:GetMSL(lnum)) + &sw | |
endif | |
" If the previous line ended with the "*" of a splat, add a level of indent | |
5 0.000037 if line =~ s:splat_regex | |
return indent(lnum) + &sw | |
endif | |
" If the previous line contained unclosed opening brackets and we are still | |
" in them, find the rightmost one and add indent depending on the bracket | |
" type. | |
" | |
" If it contained hanging closing brackets, find the rightmost one, find its | |
" match and indent according to that. | |
5 0.000030 if line =~ '[[({]' || line =~ '[])}]\s*\%(#.*\)\=$' | |
3 0.001831 0.000029 let [opening, closing] = s:ExtraBrackets(lnum) | |
3 0.000003 if opening.pos != -1 | |
1 0.000004 if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 | |
if col('.') + 1 == col('$') | |
return ind + &sw | |
else | |
return virtcol('.') | |
endif | |
else | |
1 0.000007 let nonspace = matchend(line, '\S', opening.pos + 1) - 1 | |
1 0.000006 return nonspace > 0 ? nonspace : ind + &sw | |
endif | |
elseif closing.pos != -1 | |
call cursor(lnum, closing.pos + 1) | |
normal! % | |
if s:Match(line('.'), s:ruby_indent_keywords) | |
return indent('.') + &sw | |
else | |
return indent('.') | |
endif | |
else | |
2 0.000006 call cursor(clnum, vcol) | |
2 0.000002 end | |
2 0.000002 endif | |
" If the previous line ended with an "end", match that "end"s beginning's | |
" indent. | |
4 0.000101 0.000018 let col = s:Match(lnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$') | |
4 0.000004 if col > 0 | |
call cursor(lnum, col) | |
if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', s:end_skip_expr) > 0 | |
let n = line('.') | |
let ind = indent('.') | |
let msl = s:GetMSL(n) | |
if msl != n | |
let ind = indent(msl) | |
end | |
return ind | |
endif | |
end | |
4 0.000249 0.000022 let col = s:Match(lnum, s:ruby_indent_keywords) | |
4 0.000004 if col > 0 | |
1 0.000004 call cursor(lnum, col) | |
1 0.000008 let ind = virtcol('.') - 1 + &sw | |
" TODO: make this better (we need to count them) (or, if a searchpair | |
" fails, we know that something is lacking an end and thus we indent a | |
" level | |
1 0.000022 0.000005 if s:Match(lnum, s:end_end_regex) | |
let ind = indent('.') | |
endif | |
1 0.000001 return ind | |
endif | |
" 3.4. Work on the MSL line. {{{2 | |
" -------------------------- | |
" Set up variables to use and search for MSL to the previous line. | |
3 0.000005 let p_lnum = lnum | |
3 0.005370 0.000018 let lnum = s:GetMSL(lnum) | |
" If the previous line wasn't a MSL and is continuation return its indent. | |
" TODO: the || s:IsInString() thing worries me a bit. | |
3 0.000004 if p_lnum != lnum | |
if s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) | |
return ind | |
endif | |
endif | |
" Set up more variables, now that we know we wasn't continuation bound. | |
3 0.000008 let line = getline(lnum) | |
3 0.000007 let msl_ind = indent(lnum) | |
" If the MSL line had an indenting keyword in it, add a level of indent. | |
" TODO: this does not take into account contrived things such as | |
" module Foo; class Bar; end | |
3 0.000127 0.000021 if s:Match(lnum, s:ruby_indent_keywords) | |
let ind = msl_ind + &sw | |
if s:Match(lnum, s:end_end_regex) | |
let ind = ind - &sw | |
endif | |
return ind | |
endif | |
" If the previous line ended with [*+/.,-=], but wasn't a block ending or a | |
" closing bracket, indent one extra level. | |
3 0.000110 0.000018 if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') | |
if lnum == p_lnum | |
let ind = msl_ind + &sw | |
else | |
let ind = msl_ind | |
endif | |
return ind | |
endif | |
" }}}2 | |
3 0.000003 return ind | |
FUNCTION airline#extensions#apply() | |
Called 36 times | |
Total time: 0.003007 | |
Self time: 0.001471 | |
count total (s) self (s) | |
36 0.000083 let s:active_winnr = winnr() | |
36 0.001669 0.000133 if s:is_excluded_window() | |
return -1 | |
endif | |
36 0.000064 if &buftype == 'help' | |
call airline#extensions#apply_left_override('Help', '%f') | |
let w:airline_section_x = '' | |
let w:airline_section_y = '' | |
let w:airline_render_right = 1 | |
endif | |
36 0.000033 if &previewwindow | |
let w:airline_section_a = 'Preview' | |
let w:airline_section_b = '' | |
let w:airline_section_c = bufname(winbufnr(winnr())) | |
endif | |
36 0.000167 if has_key(s:filetype_overrides, &ft) | |
let args = s:filetype_overrides[&ft] | |
call airline#extensions#apply_left_override(args[0], args[1]) | |
endif | |
36 0.000104 for item in items(s:filetype_regex_overrides) | |
if match(&ft, item[0]) >= 0 | |
call airline#extensions#apply_left_override(item[1][0], item[1][1]) | |
endif | |
endfor | |
FUNCTION airline#extensions#whitespace#check() | |
Called 93 times | |
Total time: 0.003689 | |
Self time: 0.003689 | |
count total (s) self (s) | |
93 0.000396 if &readonly || !&modifiable || !s:enabled || line('$') > s:max_lines | |
return '' | |
endif | |
93 0.000301 if !exists('b:airline_whitespace_check') | |
let b:airline_whitespace_check = '' | |
let checks = get(g:, 'airline#extensions#whitespace#checks', s:default_checks) | |
let trailing = 0 | |
if index(checks, 'trailing') > -1 | |
let trailing = search(' $', 'nw') | |
endif | |
let mixed = 0 | |
if index(checks, 'indent') > -1 | |
let indents = [search('^ \{2,}', 'nb'), search('^ \{2,}', 'n'), search('^\t', 'nb'), search('^\t', 'n')] | |
let mixed = indents[0] != 0 && indents[1] != 0 && indents[2] != 0 && indents[3] != 0 | |
endif | |
if trailing != 0 || mixed | |
let b:airline_whitespace_check = s:symbol | |
if s:show_message | |
if trailing != 0 | |
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:trailing_format, trailing) | |
endif | |
if mixed | |
let mixnr = indents[0] == indents[1] ? indents[0] : indents[2] | |
let b:airline_whitespace_check .= (g:airline_symbols.space).printf(s:mixed_indent_format, mixnr) | |
endif | |
endif | |
endif | |
endif | |
93 0.000129 return b:airline_whitespace_check | |
FUNCTION <SNR>52_match_window_opts() | |
Called 1 time | |
Total time: 0.000060 | |
Self time: 0.000060 | |
count total (s) self (s) | |
1 0.000012 let s:mw_pos = s:mw =~ 'top\|bottom' ? matchstr(s:mw, 'top\|bottom') : exists('g:ctrlp_match_window_bottom') ? ( s:mwbottom ? 'bottom' : 'top' ) : 'bottom' | |
1 0.000011 let s:mw_order = s:mw =~ 'order:[^,]\+' ? matchstr(s:mw, 'order:\zs[^,]\+') : exists('g:ctrlp_match_window_reversed') ? ( s:mwreverse ? 'btt' : 'ttb' ) : 'btt' | |
1 0.000007 let s:mw_max = s:mw =~ 'max:[^,]\+' ? str2nr(matchstr(s:mw, 'max:\zs\d\+')) : exists('g:ctrlp_max_height') ? s:mxheight : 10 | |
1 0.000005 let s:mw_min = s:mw =~ 'min:[^,]\+' ? str2nr(matchstr(s:mw, 'min:\zs\d\+')) : 1 | |
1 0.000008 let [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])] | |
1 0.000004 let s:mw_min = min([s:mw_min, s:mw_max]) | |
1 0.000009 let s:mw_res = s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+')) : min([s:mw_max, &lines]) | |
1 0.000003 let s:mw_res = max([s:mw_res, 1]) | |
FUNCTION ctrlp#dirnfile() | |
Called 17 times | |
Total time: 0.481865 | |
Self time: 0.171878 | |
count total (s) self (s) | |
17 0.000372 0.000161 let [items, cwd] = [[[], []], s:dyncwd.s:lash()] | |
7792 0.005289 for each in a:entries | |
7775 0.032953 let etype = getftype(each) | |
8779 0.334753 0.024977 if s:igntype >= 0 && s:usrign(each, etype) | con | en | |
6770 0.006671 if etype == 'dir' | |
930 0.000737 if s:showhidden | if each !~ '[\/]\.\{1,2}$' | |
cal add(items[0], each) | |
en | el | |
930 0.001854 cal add(items[0], each) | |
930 0.000387 en | |
930 0.000552 elsei etype == 'link' | |
if s:folsym | |
let isfile = !isdirectory(each) | |
if s:folsym == 2 || !s:samerootsyml(each, isfile, cwd) | |
cal add(items[isfile], each) | |
en | |
en | |
elsei etype == 'file' | |
5840 0.010640 cal add(items[1], each) | |
5840 0.002230 en | |
6770 0.003994 endfo | |
17 0.000016 retu items | |
FUNCTION <SNR>52_dohighlight() | |
Called 44 times | |
Total time: 0.000410 | |
Self time: 0.000221 | |
count total (s) self (s) | |
44 0.000390 0.000201 retu s:mathi[0] && exists('*clearmatches') && !ctrlp#nosy() | |
FUNCTION <SNR>52_getinput() | |
Called 44 times | |
Total time: 0.002077 | |
Self time: 0.002077 | |
count total (s) self (s) | |
44 0.000178 let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )] | |
44 0.000085 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 | |
44 0.000202 retu spi == 'c' ? prt[0] : join(prt, '') | |
FUNCTION <SNR>45_IsInStringOrDocumentation() | |
Called 5 times | |
Total time: 0.000083 | |
Self time: 0.000083 | |
count total (s) self (s) | |
5 0.000077 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc | |
FUNCTION airline#highlighter#get_highlight() | |
Called 1674 times | |
Total time: 0.117086 | |
Self time: 0.032251 | |
count total (s) self (s) | |
1674 0.042961 0.005759 let fg = s:get_syn(a:group, 'fg') | |
1674 0.039547 0.005470 let bg = s:get_syn(a:group, 'bg') | |
1674 0.012225 let reverse = synIDattr(synIDtrans(hlID(a:group)), 'reverse', has('gui_running') ? 'gui' : 'term') | |
1674 0.021210 0.007654 return reverse ? s:get_array(bg, fg, a:000) : s:get_array(fg, bg, a:000) | |
FUNCTION <SNR>45_GetMSL() | |
Called 3 times | |
Total time: 0.005352 | |
Self time: 0.000368 | |
count total (s) self (s) | |
" Start on the line we're at and use its indent. | |
3 0.000004 let msl = a:lnum | |
3 0.000006 let msl_body = getline(msl) | |
3 0.004276 0.000015 let lnum = s:PrevNonBlankNonString(a:lnum - 1) | |
3 0.000004 while lnum > 0 | |
" If we have a continuation line, or we're in a string, use line as MSL. | |
" Otherwise, terminate search as we have found our MSL already. | |
3 0.000008 let line = getline(lnum) | |
3 0.000076 0.000028 if s:Match(lnum, s:splat_regex) | |
" If the above line looks like the "*" of a splat, use the current one's | |
" indentation. | |
" | |
" Example: | |
" Hash[* | |
" method_call do | |
" something | |
" | |
return msl | |
elseif s:Match(line, s:non_bracket_continuation_regex) && s:Match(msl, s:non_bracket_continuation_regex) | |
" If the current line is a non-bracket continuation and so is the | |
" previous one, keep its indent and continue looking for an MSL. | |
" | |
" Example: | |
" method_call one, | |
" two, | |
" three | |
" | |
let msl = lnum | |
elseif s:Match(lnum, s:non_bracket_continuation_regex) && (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex)) | |
" If the current line is a bracket continuation or a block-starter, but | |
" the previous is a non-bracket one, respect the previous' indentation, | |
" and stop here. | |
" | |
" Example: | |
" method_call one, | |
" two { | |
" three | |
" | |
return lnum | |
elseif s:Match(lnum, s:bracket_continuation_regex) && (s:Match(msl, s:bracket_continuation_regex) || s:Match(msl, s:block_continuation_regex)) | |
" If both lines are bracket continuations (the current may also be a | |
" block-starter), use the current one's and stop here | |
" | |
" Example: | |
" method_call( | |
" other_method_call( | |
" foo | |
return msl | |
elseif s:Match(lnum, s:block_regex) && !s:Match(msl, s:continuation_regex) && !s:Match(msl, s:block_continuation_regex) | |
" If the previous line is a block-starter and the current one is | |
" mostly ordinary, use the current one as the MSL. | |
" | |
" Example: | |
" method_call do | |
" something | |
" something_else | |
return msl | |
else | |
3 0.000074 let col = match(line, s:continuation_regex) + 1 | |
3 0.000472 0.000026 if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line)) | |
let msl = lnum | |
else | |
3 0.000003 break | |
endif | |
endif | |
let msl_body = getline(msl) | |
let lnum = s:PrevNonBlankNonString(lnum - 1) | |
endwhile | |
3 0.000003 return msl | |
FUNCTION <SNR>52_strwidth() | |
Called 408 times | |
Total time: 0.001783 | |
Self time: 0.001783 | |
count total (s) self (s) | |
408 0.001663 retu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str) | |
FUNCTION <SNR>52_BuildPrompt() | |
Called 44 times | |
Total time: 28.141206 | |
Self time: 27.419367 | |
count total (s) self (s) | |
44 0.000336 0.000243 let base = ( s:regexp ? 'r' : '>' ).( s:byfname() ? 'd' : '>' ).'> ' | |
44 0.002340 0.000263 let str = escape(s:getinput(), '\') | |
44 0.000359 let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy | |
44 0.000214 if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp') || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' ) | |
44 0.661032 0.000337 sil! cal s:Update(str) | |
44 0.000018 en | |
44 0.059201 0.000227 sil! cal ctrlp#statusline() | |
" Toggling | |
44 0.000235 let [hiactive, hicursor, base] = s:focus ? ['CtrlPPrtText', 'CtrlPPrtCursor', base] : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')] | |
44 0.000047 let hibase = 'CtrlPPrtBase' | |
" Build it | |
44 27.414028 redr | |
44 0.000589 let prt = copy(s:prompt) | |
44 0.000428 cal map(prt, 'escape(v:val, ''"\'')') | |
44 0.001662 exe 'echoh' hibase '| echon "'.base.'" | echoh' hiactive '| echon "'.prt[0].'" | echoh' hicursor '| echon "'.prt[1].'" | echoh' hiactive '| echon "'.prt[2].'" | echoh None' | |
" Append the cursor at the end | |
44 0.000114 if empty(prt[1]) && s:focus | |
44 0.000327 exe 'echoh' hibase '| echon "_" | echoh None' | |
44 0.000021 en | |
FUNCTION <SNR>52_shortest() | |
Called 1614 times | |
Total time: 0.006714 | |
Self time: 0.006714 | |
count total (s) self (s) | |
1614 0.006209 retu min(map(values(a:lens), 'v:val[0]')) | |
FUNCTION <SNR>52_sublist() | |
Called 44 times | |
Total time: 0.021441 | |
Self time: 0.021441 | |
count total (s) self (s) | |
44 0.021408 retu v:version > 701 ? a:l[(a:s):(a:e)] : s:sublist7071(a:l, a:s, a:e) | |
FUNCTION airline#util#wrap() | |
Called 725 times | |
Total time: 0.003201 | |
Self time: 0.003201 | |
count total (s) self (s) | |
725 0.001385 if a:minwidth > 0 && winwidth(0) < a:minwidth | |
return '' | |
endif | |
725 0.000576 return a:text | |
FUNCTION ctrlp#utils#glob() | |
Called 1 time | |
Total time: 0.000056 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000044 0.000004 let path = ctrlp#utils#fnesc(a:1, 'g') | |
1 0.000012 retu s:wig_cond ? glob(path, a:2) : glob(path) | |
FUNCTION ctrlp#setlines() | |
Called 1 time | |
Total time: 1.389865 | |
Self time: 0.000025 | |
count total (s) self (s) | |
1 0.000003 if a:0 | let s:itemtype = a:1 | en | |
1 0.000064 0.000004 cal s:modevar() | |
1 0.000002 let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()'] | |
1 0.000002 if !empty(g:ctrlp_ext_vars) | |
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])') | |
en | |
1 1.389789 0.000009 let g:ctrlp_lines = eval(types[s:itemtype]) | |
FUNCTION <SNR>52_Render() | |
Called 44 times | |
Total time: 0.426534 | |
Self time: 0.009297 | |
count total (s) self (s) | |
44 0.000321 let [&ma, lines, s:res_count] = [1, a:lines, len(a:lines)] | |
44 0.000205 let height = min([max([s:mw_min, s:res_count]), s:winmaxh]) | |
44 0.000237 0.000178 let pat = s:byfname() ? split(a:pat, '^[^;]\+\\\@<!\zs;', 1)[0] : a:pat | |
44 0.000157 let cur_cmd = 'keepj norm! '.( s:mw_order == 'btt' ? 'G' : 'gg' ).'1|' | |
" Setup the match window | |
44 0.000860 sil! exe '%d _ | res' height | |
" Print the new items | |
44 0.000066 if empty(lines) | |
let [s:matched, s:lines] = [[], []] | |
let lines = [' == NO ENTRIES =='] | |
cal setline(1, s:offset(lines, height - 1)) | |
setl noma nocul | |
exe cur_cmd | |
cal s:unmarksigns() | |
if s:dohighlight() | cal clearmatches() | en | |
retu | |
en | |
44 0.000240 let s:matched = copy(lines) | |
" Sorting | |
44 0.000565 0.000160 if !s:nosort() | |
44 0.000101 let s:compat = s:martcs.pat | |
44 0.408583 0.002820 cal sort(lines, 's:mixedsort') | |
44 0.000053 unl s:compat | |
44 0.000017 en | |
44 0.000153 if s:mw_order == 'btt' | cal reverse(lines) | en | |
44 0.000222 let s:lines = copy(lines) | |
44 0.009181 0.001037 cal map(lines, 's:formatline(v:val)') | |
44 0.000692 0.000443 cal setline(1, s:offset(lines, height)) | |
44 0.000319 setl noma cul | |
44 0.000494 exe cur_cmd | |
44 0.000440 0.000142 cal s:unmarksigns() | |
44 0.000300 0.000093 cal s:remarksigns() | |
44 0.000072 if exists('s:cline') && s:nolim != 1 | |
cal cursor(s:cline, 1) | |
en | |
" Highlighting | |
44 0.000503 0.000093 if s:dohighlight() | |
44 0.001905 0.000203 cal s:highlight(pat, s:mathi[1]) | |
44 0.000014 en | |
FUNCTION ctrlp#nosy() | |
Called 45 times | |
Total time: 0.000194 | |
Self time: 0.000194 | |
count total (s) self (s) | |
45 0.000180 retu !( has('syntax') && exists('g:syntax_on') ) | |
FUNCTION <SNR>45_IsInStringOrComment() | |
Called 22 times | |
Total time: 0.017562 | |
Self time: 0.017562 | |
count total (s) self (s) | |
22 0.017545 return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom | |
FUNCTION airline#highlighter#exec() | |
Called 3069 times | |
Total time: 0.090849 | |
Self time: 0.090849 | |
count total (s) self (s) | |
3069 0.003379 let colors = a:colors | |
3069 0.002269 if s:is_win32term | |
let colors[2] = s:gui2cui(get(colors, 0, ''), get(colors, 2, '')) | |
let colors[3] = s:gui2cui(get(colors, 1, ''), get(colors, 3, '')) | |
endif | |
3069 0.068128 exec printf('hi %s %s %s %s %s %s %s %s', a:group, get(colors, 0, '') != '' ? 'guifg='.colors[0] : '', get(colors, 1, '') != '' ? 'guibg='.colors[1] : '', get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '', get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '', get(colors, 4, '') != '' ? 'gui='.colors[4] : '', get(colors, 4, '') != '' ? 'cterm='.colors[4] : '', get(colors, 4, '') != '' ? 'term='.colors[4] : '') | |
FUNCTION <SNR>52_usrign() | |
Called 7776 times | |
Total time: 0.309807 | |
Self time: 0.309807 | |
count total (s) self (s) | |
7776 0.307783 retu s:igntype == 1 ? a:item =~ s:usrign : s:igntype == 4 && has_key(s:usrign, a:type) && s:usrign[a:type] != '' ? a:item =~ s:usrign[a:type] : 0 | |
FUNCTION airline#highlighter#highlight_modified_inactive() | |
Called 27 times | |
Total time: 0.002721 | |
Self time: 0.000705 | |
count total (s) self (s) | |
27 0.000068 if getbufvar(a:bufnr, '&modified') | |
27 0.000236 let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c') ? g:airline#themes#{g:airline_theme}#palette.inactive_modified.airline_c : [] | |
27 0.000013 else | |
let colors = exists('g:airline#themes#{g:airline_theme}#palette.inactive.airline_c') ? g:airline#themes#{g:airline_theme}#palette.inactive.airline_c : [] | |
endif | |
27 0.000042 if !empty(colors) | |
27 0.002183 0.000167 call airline#highlighter#exec('airline_c'.(a:bufnr).'_inactive', colors) | |
27 0.000020 endif | |
FUNCTION <SNR>45_Match() | |
Called 40 times | |
Total time: 0.001064 | |
Self time: 0.001002 | |
count total (s) self (s) | |
40 0.000836 let col = match(getline(a:lnum), '\C'.a:regex) + 1 | |
40 0.000193 0.000131 return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 | |
FUNCTION <SNR>30_sync_active_winnr() | |
Called 80 times | |
Total time: 0.021000 | |
Self time: 0.000785 | |
count total (s) self (s) | |
80 0.000503 if exists('#airline') && winnr() != s:active_winnr | |
2 0.020227 0.000012 call airline#update_statusline() | |
2 0.000001 endif | |
FUNCTION <SNR>52_modevar() | |
Called 1 time | |
Total time: 0.000060 | |
Self time: 0.000026 | |
count total (s) self (s) | |
1 0.000008 0.000005 let s:matchtype = s:mtype() | |
1 0.000008 0.000005 let s:ispath = s:ispathitem() | |
1 0.000021 0.000005 let s:mfunc = s:mfunc() | |
1 0.000012 0.000005 let s:nolim = s:getextvar('nolim') | |
1 0.000008 0.000003 let s:dosort = s:getextvar('sort') | |
1 0.000003 let s:spi = !s:itemtype || s:getextvar('specinput') > 0 | |
FUNCTION <SNR>13_init() | |
Called 4 times | |
Total time: 0.000101 | |
Self time: 0.000101 | |
count total (s) self (s) | |
4 0.000011 if !s:airline_initialized | |
let s:airline_initialized = 1 | |
call airline#init#bootstrap() | |
call airline#extensions#load() | |
call airline#init#sections() | |
let s:airline_theme_defined = exists('g:airline_theme') | |
if s:airline_theme_defined || !airline#switch_matching_theme() | |
let g:airline_theme = get(g:, 'airline_theme', 'dark') | |
call airline#switch_theme(g:airline_theme) | |
endif | |
endif | |
FUNCTION <SNR>52_SetWD() | |
Called 1 time | |
Total time: 0.001277 | |
Self time: 0.000123 | |
count total (s) self (s) | |
1 0.000005 if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0 && exists('s:dyncwd') | |
cal ctrlp#setdir(s:dyncwd) | retu | |
en | |
1 0.000004 if has_key(a:args, 'dir') && a:args['dir'] != '' | |
cal ctrlp#setdir(a:args['dir']) | retu | |
en | |
1 0.000004 let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode | |
1 0.000033 let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()] | |
1 0.000015 if s:crfile =~ '^.\+://' | retu | en | |
1 0.000012 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 | |
1 0.000003 if pmode =~ 'r' || pmode == 2 | |
1 0.000004 let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs'] | |
1 0.000006 let spath = pmode =~ 'd' ? s:dyncwd : pmode =~ 'w' ? s:cwd : s:crfpath | |
1 0.000004 if type(s:rmarkers) == 3 && !empty(s:rmarkers) | |
if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu | en | |
cal filter(markers, 'index(s:rmarkers, v:val) < 0') | |
en | |
1 0.001163 0.000009 cal s:findroot(spath, markers, 0, 0) | |
1 0.000001 en | |
FUNCTION <SNR>52_formatline() | |
Called 408 times | |
Total time: 0.008144 | |
Self time: 0.006361 | |
count total (s) self (s) | |
408 0.000376 let str = a:str | |
408 0.000271 if s:itemtype == 1 | |
let filpath = fnamemodify(str, ':p') | |
let bufnr = s:nonamecond(str, filpath) ? str2nr(matchstr(str, '[\/]\?\[\zs\d\+\ze\*No Name\]$')) : bufnr('^'.filpath.'$') | |
let idc = ( bufnr == bufnr('#') ? '#' : '' ) . ( getbufvar(bufnr, '&ma') ? '' : '-' ) . ( getbufvar(bufnr, '&ro') ? '=' : '' ) . ( getbufvar(bufnr, '&mod') ? '+' : '' ) | |
let str .= idc != '' ? ' '.idc : '' | |
en | |
408 0.003044 0.001261 let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str) | |
408 0.000818 retu '> '.( cond ? s:pathshorten(str) : str ) | |
FUNCTION airline#check_mode() | |
Called 521 times | |
Total time: 0.265150 | |
Self time: 0.027000 | |
count total (s) self (s) | |
521 0.001737 let context = s:contexts[a:winnr] | |
521 0.001359 if get(w:, 'airline_active', 1) | |
93 0.000216 let l:m = mode() | |
93 0.000142 if l:m ==# "i" | |
20 0.000037 let l:mode = ['insert'] | |
20 0.000019 elseif l:m ==# "R" | |
let l:mode = ['replace'] | |
elseif l:m =~# '\v(v|V||s|S|)' | |
21 0.000036 let l:mode = ['visual'] | |
21 0.000016 else | |
52 0.000095 let l:mode = ['normal'] | |
52 0.000032 endif | |
93 0.000393 let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m) | |
93 0.000051 else | |
428 0.000732 let l:mode = ['inactive'] | |
428 0.001594 let w:airline_current_mode = get(g:airline_mode_map, '__') | |
428 0.000231 endif | |
521 0.000589 if g:airline_detect_modified | |
521 0.000886 if &modified | |
519 0.001587 call add(l:mode, 'modified') | |
519 0.000231 endif | |
521 0.000207 endif | |
521 0.000702 if g:airline_detect_paste && &paste | |
call add(l:mode, 'paste') | |
endif | |
521 0.001623 let mode_string = join(l:mode) | |
521 0.001714 if get(w:, 'airline_lastmode', '') != mode_string | |
27 0.002869 0.000148 call airline#highlighter#highlight_modified_inactive(context.bufnr) | |
27 0.235625 0.000196 call airline#highlighter#highlight(l:mode) | |
27 0.000052 let w:airline_lastmode = mode_string | |
27 0.000013 endif | |
521 0.000386 return '' | |
FUNCTION <SNR>52_highlight() | |
Called 44 times | |
Total time: 0.001702 | |
Self time: 0.001702 | |
count total (s) self (s) | |
44 0.000090 if s:matcher != {} | retu | en | |
44 0.000080 cal clearmatches() | |
44 0.000082 if !empty(a:pat) && s:ispath | |
43 0.000118 let pat = s:regexp ? substitute(a:pat, '\\\@<!\^', '^> \\zs', 'g') : a:pat | |
43 0.000028 if s:byfname | |
let pat = substitute(pat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') | |
let pat = substitute(pat, '\$\@<!$', '\\ze[^\\/]*$', 'g') | |
en | |
43 0.000474 cal matchadd(a:grp, ( s:martcs == '' ? '\c' : '\C' ).pat) | |
43 0.000555 cal matchadd('CtrlPLinePre', '^>') | |
43 0.000036 en | |
FUNCTION <SNR>20_Highlight_Matching_Pair() | |
Called 147 times | |
Total time: 0.012518 | |
Self time: 0.012518 | |
count total (s) self (s) | |
" Remove any previous match. | |
147 0.000583 if exists('w:paren_hl_on') && w:paren_hl_on | |
1 0.000003 3match none | |
1 0.000003 let w:paren_hl_on = 0 | |
1 0.000001 endif | |
" Avoid that we remove the popup menu. | |
" Return when there are no colors (looks like the cursor jumps). | |
147 0.000593 if pumvisible() || (&t_Co < 8 && !has("gui_running")) | |
return | |
endif | |
" Get the character under the cursor and check if it's in 'matchpairs'. | |
147 0.000396 let c_lnum = line('.') | |
147 0.000336 let c_col = col('.') | |
147 0.000149 let before = 0 | |
147 0.000559 let c = getline(c_lnum)[c_col - 1] | |
147 0.001897 let plist = split(&matchpairs, '.\zs[:,]') | |
147 0.000428 let i = index(plist, c) | |
147 0.000124 if i < 0 | |
" not found, in Insert mode try character before the cursor | |
146 0.000416 if c_col > 1 && (mode() == 'i' || mode() == 'R') | |
15 0.000020 let before = 1 | |
15 0.000046 let c = getline(c_lnum)[c_col - 2] | |
15 0.000035 let i = index(plist, c) | |
15 0.000007 endif | |
146 0.000114 if i < 0 | |
" not found, nothing to do | |
146 0.000121 return | |
endif | |
endif | |
" Figure out the arguments for searchpairpos(). | |
1 0.000002 if i % 2 == 0 | |
1 0.000002 let s_flags = 'nW' | |
1 0.000004 let c2 = plist[i + 1] | |
1 0.000001 else | |
let s_flags = 'nbW' | |
let c2 = c | |
let c = plist[i - 1] | |
endif | |
1 0.000003 if c == '[' | |
let c = '\[' | |
let c2 = '\]' | |
endif | |
" Find the match. When it was just before the cursor move it there for a | |
" moment. | |
1 0.000002 if before > 0 | |
let save_cursor = winsaveview() | |
call cursor(c_lnum, c_col - before) | |
endif | |
" When not in a string or comment ignore matches inside them. | |
" We match "escape" for special items, such as lispEscapeSpecial. | |
1 0.000006 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . '=~? "string\\|character\\|singlequote\\|escape\\|comment"' | |
1 0.003580 execute 'if' s_skip '| let s_skip = 0 | endif' | |
" Limit the search to lines visible in the window. | |
1 0.000005 let stoplinebottom = line('w$') | |
1 0.000003 let stoplinetop = line('w0') | |
1 0.000002 if i % 2 == 0 | |
1 0.000002 let stopline = stoplinebottom | |
1 0.000000 else | |
let stopline = stoplinetop | |
endif | |
" Limit the search time to 300 msec to avoid a hang on very long lines. | |
" This fails when a timeout is not supported. | |
1 0.000003 if mode() == 'i' || mode() == 'R' | |
let timeout = exists("b:matchparen_insert_timeout") ? b:matchparen_insert_timeout : g:matchparen_insert_timeout | |
else | |
1 0.000006 let timeout = exists("b:matchparen_timeout") ? b:matchparen_timeout : g:matchparen_timeout | |
1 0.000001 endif | |
1 0.000001 try | |
1 0.000256 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, timeout) | |
1 0.000002 catch /E118/ | |
" Can't use the timeout, restrict the stopline a bit more to avoid taking | |
" a long time on closed folds and long lines. | |
" The "viewable" variables give a range in which we can scroll while | |
" keeping the cursor at the same position. | |
" adjustedScrolloff accounts for very large numbers of scrolloff. | |
let adjustedScrolloff = min([&scrolloff, (line('w$') - line('w0')) / 2]) | |
let bottom_viewable = min([line('$'), c_lnum + &lines - adjustedScrolloff - 2]) | |
let top_viewable = max([1, c_lnum-&lines+adjustedScrolloff + 2]) | |
" one of these stoplines will be adjusted below, but the current values are | |
" minimal boundaries within the current window | |
if i % 2 == 0 | |
if has("byte_offset") && has("syntax_items") && &smc > 0 | |
let stopbyte = min([line2byte("$"), line2byte(".") + col(".") + &smc * 2]) | |
let stopline = min([bottom_viewable, byte2line(stopbyte)]) | |
else | |
let stopline = min([bottom_viewable, c_lnum + 100]) | |
endif | |
let stoplinebottom = stopline | |
else | |
if has("byte_offset") && has("syntax_items") && &smc > 0 | |
let stopbyte = max([1, line2byte(".") + col(".") - &smc * 2]) | |
let stopline = max([top_viewable, byte2line(stopbyte)]) | |
else | |
let stopline = max([top_viewable, c_lnum - 100]) | |
endif | |
let stoplinetop = stopline | |
endif | |
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline) | |
endtry | |
1 0.000001 if before > 0 | |
call winrestview(save_cursor) | |
endif | |
" If a match is found setup match highlighting. | |
1 0.000003 if m_lnum > 0 && m_lnum >= stoplinetop && m_lnum <= stoplinebottom | |
1 0.000036 exe '3match MatchParen /\(\%' . c_lnum . 'l\%' . (c_col - before) . 'c\)\|\(\%' . m_lnum . 'l\%' . m_col . 'c\)/' | |
1 0.000003 let w:paren_hl_on = 1 | |
1 0.000001 endif | |
FUNCTION airline#parts#filetype() | |
Called 446 times | |
Total time: 0.000890 | |
Self time: 0.000890 | |
count total (s) self (s) | |
446 0.000668 return &filetype | |
FUNCTION <SNR>52_remarksigns() | |
Called 44 times | |
Total time: 0.000207 | |
Self time: 0.000107 | |
count total (s) self (s) | |
44 0.000183 0.000083 if !s:dosigns() | retu | en | |
for ic in range(1, len(s:lines)) | |
let line = s:ispath ? fnamemodify(s:lines[ic - 1], ':p') : s:lines[ic - 1] | |
let key = s:dictindex(s:marked, line) | |
if key > 0 | |
exe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr | |
en | |
endfo | |
FUNCTION airline#extensions#netrw#apply() | |
Called 6 times | |
Total time: 0.000105 | |
Self time: 0.000105 | |
count total (s) self (s) | |
6 0.000018 if &ft == 'netrw' | |
let spc = g:airline_symbols.space | |
call a:1.add_section('airline_a', spc.'netrw'.spc) | |
if exists('*airline#extensions#branch#get_head') | |
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) | |
endif | |
call a:1.add_section('airline_c', spc.'%f'.spc) | |
call a:1.split() | |
call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) | |
return 1 | |
endif | |
FUNCTION ctrlp#utils#globpath() | |
Called 11 times | |
Total time: 0.000123 | |
Self time: 0.000123 | |
count total (s) self (s) | |
11 0.000120 retu call('globpath', s:wig_cond ? a:000 : a:000[:1]) | |
FUNCTION airline#parts#iminsert() | |
Called 93 times | |
Total time: 0.000469 | |
Self time: 0.000469 | |
count total (s) self (s) | |
93 0.000174 if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') | |
return toupper(b:keymap_name) | |
endif | |
93 0.000046 return '' | |
FUNCTION airline#extensions#ctrlp#apply() | |
Called 6 times | |
Total time: 0.000042 | |
Self time: 0.000042 | |
count total (s) self (s) | |
" disable statusline overwrite if ctrlp already did it | |
6 0.000037 return match(&statusline, 'CtrlPwhite') >= 0 ? -1 : 0 | |
FUNCTION airline#extensions#ctrlp#ctrlp_airline_status() | |
Called 16 times | |
Total time: 0.000737 | |
Self time: 0.000737 | |
count total (s) self (s) | |
16 0.000057 let len = '%#CtrlPdark# '.a:1 | |
16 0.000593 let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*' | |
16 0.000050 return len.dir | |
FUNCTION <SNR>52_lsCmd() | |
Called 1 time | |
Total time: 0.000005 | |
Self time: 0.000005 | |
count total (s) self (s) | |
1 0.000002 let cmd = s:usrcmd | |
1 0.000002 if type(cmd) == 1 | |
1 0.000001 retu cmd | |
elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', ''] | |
if s:findroot(s:dyncwd, cmd[0], 0, 1) == [] | |
retu len(cmd) == 3 ? cmd[2] : '' | |
en | |
let s:vcscmd = s:lash == '\' | |
retu cmd[1] | |
elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') ) | |
let fndroot = [] | |
if has_key(cmd, 'types') && cmd['types'] != {} | |
let [markrs, cmdtypes] = [[], values(cmd['types'])] | |
for pair in cmdtypes | |
cal add(markrs, pair[0]) | |
endfo | |
let fndroot = s:findroot(s:dyncwd, markrs, 0, 1) | |
en | |
if fndroot == [] | |
retu has_key(cmd, 'fallback') ? cmd['fallback'] : '' | |
en | |
for pair in cmdtypes | |
if pair[0] == fndroot[0] | brea | en | |
endfo | |
let s:vcscmd = s:lash == '\' | |
retu pair[1] | |
en | |
FUNCTION <SNR>52_matchlens() | |
Called 3250 times | |
Total time: 0.281106 | |
Self time: 0.232068 | |
count total (s) self (s) | |
3250 0.012320 if empty(a:pat) || index(['^', '$'], a:pat) >= 0 | retu {} | en | |
3214 0.003646 let st = a:0 ? a:1 : 0 | |
3214 0.003797 let lens = a:0 >= 2 ? a:2 : {} | |
3214 0.003153 let nr = a:0 >= 3 ? a:3 : 0 | |
3214 0.003724 if nr > 20 | retu {} | en | |
3214 0.071173 if match(a:str, a:pat, st) >= 0 | |
1636 0.103749 let [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)] | |
1636 0.006727 let lens = extend(lens, { nr : [strlen(mst), mst] }) | |
1636 0.006091 let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1) | |
1636 0.000620 en | |
3214 0.001829 retu lens | |
FUNCTION ctrlp#init() | |
Called 1 time | |
Total time: 2.043998 | |
Self time: 0.000123 | |
count total (s) self (s) | |
1 0.000042 0.000012 if exists('s:init') || s:iscmdwin() | retu | en | |
1 0.000004 let [s:ermsg, v:errmsg] = [v:errmsg, ''] | |
1 0.000003 let [s:matches, s:init] = [1, 1] | |
1 0.000770 0.000009 cal s:Reset(a:0 ? a:1 : {}) | |
1 0.001550 0.000015 noa cal s:Open() | |
1 0.001287 0.000010 cal s:SetWD(a:0 ? a:1 : {}) | |
1 0.001431 0.000017 cal s:MapNorms() | |
1 0.000895 0.000008 cal s:MapSpecs() | |
1 0.000220 0.000006 cal ctrlp#syntax() | |
1 1.389880 0.000012 cal ctrlp#setlines(s:settype(a:type)) | |
1 0.000013 0.000009 cal s:SetDefTxt() | |
1 0.647894 0.000009 cal s:BuildPrompt(1) | |
1 0.000003 if s:keyloop | cal s:KeyLoop() | en | |
FUNCTION <SNR>52_SetDefTxt() | |
Called 1 time | |
Total time: 0.000004 | |
Self time: 0.000004 | |
count total (s) self (s) | |
1 0.000004 if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en | |
let txt = s:deftxt | |
if !type(txt) | |
let path = s:crfpath.s:lash(s:crfpath) | |
let txt = txt && !stridx(path, s:dyncwd) ? ctrlp#rmbasedir([path])[0] : '' | |
en | |
let s:prompt[0] = txt | |
FUNCTION ctrlp#complen() | |
Called 807 times | |
Total time: 0.004591 | |
Self time: 0.004591 | |
count total (s) self (s) | |
" By length | |
807 0.002838 let [len1, len2] = [strlen(a:1), strlen(a:2)] | |
807 0.001170 retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 | |
FUNCTION airline#util#getwinvar() | |
Called 189 times | |
Total time: 0.000641 | |
Self time: 0.000641 | |
count total (s) self (s) | |
189 0.000576 return getwinvar(a:winnr, a:key, a:def) | |
FUNCTION <SNR>52_dosigns() | |
Called 89 times | |
Total time: 0.000260 | |
Self time: 0.000260 | |
count total (s) self (s) | |
89 0.000218 retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs') | |
FUNCTION <SNR>52_Open() | |
Called 1 time | |
Total time: 0.001535 | |
Self time: 0.001024 | |
count total (s) self (s) | |
1 0.000020 0.000006 cal s:log(1) | |
1 0.000283 0.000006 cal s:getenv() | |
1 0.000012 0.000005 cal s:execextvar('enter') | |
1 0.000519 sil! exe 'keepa' ( s:mw_pos == 'top' ? 'to' : 'bo' ) '1new ControlP' | |
1 0.000024 0.000011 cal s:buffunc(1) | |
1 0.000007 let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)] | |
1 0.000005 let [s:focus, s:prompt] = [1, ['', '', '']] | |
1 0.000001 abc <buffer> | |
1 0.000003 if !exists('s:hstry') | |
1 0.000184 0.000034 let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : [''] | |
1 0.000004 let s:hstry = empty(hst) || !s:maxhst ? [''] : hst | |
1 0.000000 en | |
34 0.000103 for [ke, va] in items(s:glbs) | if exists('+'.ke) | |
17 0.000256 sil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va) | |
33 0.000019 en | endfo | |
1 0.000005 if s:opmul != '0' && has('signs') | |
1 0.000012 sign define ctrlpmark text=+> texthl=Search | |
1 0.000001 en | |
1 0.000059 0.000009 cal s:setupblank() | |
FUNCTION airline#extensions#ctrlp#ctrlp_airline() | |
Called 44 times | |
Total time: 0.055963 | |
Self time: 0.001847 | |
count total (s) self (s) | |
44 0.001157 0.000212 let b = airline#builder#new({'active': 1}) | |
44 0.000029 if a:3 | |
call b.add_section_spaced('CtrlPlight', 'regex') | |
endif | |
44 0.000102 if get(g:, 'airline#extensions#ctrlp#show_adjacent_modes', 1) | |
44 0.002834 0.000143 call b.add_section_spaced('CtrlPlight', a:4) | |
44 0.012615 0.000142 call b.add_section_spaced('CtrlPwhite', a:5) | |
44 0.011957 0.000155 call b.add_section_spaced('CtrlPlight', a:6) | |
44 0.000019 else | |
call b.add_section_spaced('CtrlPwhite', a:5) | |
endif | |
44 0.011777 0.000139 call b.add_section_spaced('CtrlPdark', a:7) | |
44 0.000300 0.000105 call b.split() | |
44 0.000237 0.000170 call b.add_raw('%#CtrlPdark#'.a:1.(g:airline_symbols.space)) | |
44 0.002359 0.000105 call b.add_section_spaced('CtrlPdark', a:2) | |
44 0.011955 0.000111 call b.add_section_spaced('CtrlPlight', '%{getcwd()}') | |
44 0.000321 0.000114 return b.build() | |
FUNCTION <SNR>45_ExtraBrackets() | |
Called 3 times | |
Total time: 0.001802 | |
Self time: 0.000965 | |
count total (s) self (s) | |
3 0.000016 let opening = {'parentheses': [], 'braces': [], 'brackets': []} | |
3 0.000011 let closing = {'parentheses': [], 'braces': [], 'brackets': []} | |
3 0.000008 let line = getline(a:lnum) | |
3 0.000019 let pos = match(line, '[][(){}]', 0) | |
" Save any encountered opening brackets, and remove them once a matching | |
" closing one has been found. If a closing bracket shows up that doesn't | |
" close anything, save it for later. | |
16 0.000021 while pos != -1 | |
13 0.000897 0.000060 if !s:IsInStringOrComment(a:lnum, pos + 1) | |
13 0.000037 if line[pos] == '(' | |
2 0.000011 call add(opening.parentheses, {'type': '(', 'pos': pos}) | |
2 0.000003 elseif line[pos] == ')' | |
2 0.000004 if empty(opening.parentheses) | |
call add(closing.parentheses, {'type': ')', 'pos': pos}) | |
else | |
2 0.000008 let opening.parentheses = opening.parentheses[0:-2] | |
2 0.000000 endif | |
2 0.000002 elseif line[pos] == '{' | |
2 0.000009 call add(opening.braces, {'type': '{', 'pos': pos}) | |
2 0.000002 elseif line[pos] == '}' | |
2 0.000003 if empty(opening.braces) | |
call add(closing.braces, {'type': '}', 'pos': pos}) | |
else | |
2 0.000006 let opening.braces = opening.braces[0:-2] | |
2 0.000002 endif | |
2 0.000002 elseif line[pos] == '[' | |
3 0.000016 call add(opening.brackets, {'type': '[', 'pos': pos}) | |
3 0.000005 elseif line[pos] == ']' | |
2 0.000004 if empty(opening.brackets) | |
call add(closing.brackets, {'type': ']', 'pos': pos}) | |
else | |
2 0.000009 let opening.brackets = opening.brackets[0:-2] | |
2 0.000002 endif | |
2 0.000001 endif | |
13 0.000009 endif | |
13 0.000082 let pos = match(line, '[][(){}]', pos + 1) | |
13 0.000025 endwhile | |
" Find the rightmost brackets, since they're the ones that are important in | |
" both opening and closing cases | |
3 0.000010 let rightmost_opening = {'type': '(', 'pos': -1} | |
3 0.000009 let rightmost_closing = {'type': ')', 'pos': -1} | |
4 0.000013 for opening in opening.parentheses + opening.braces + opening.brackets | |
1 0.000002 if opening.pos > rightmost_opening.pos | |
1 0.000003 let rightmost_opening = opening | |
1 0.000000 endif | |
1 0.000000 endfor | |
3 0.000007 for closing in closing.parentheses + closing.braces + closing.brackets | |
if closing.pos > rightmost_closing.pos | |
let rightmost_closing = closing | |
endif | |
endfor | |
3 0.000006 return [rightmost_opening, rightmost_closing] | |
FUNCTION ctrlp#igncwd() | |
Called 1 time | |
Total time: 0.000103 | |
Self time: 0.000016 | |
count total (s) self (s) | |
1 0.000103 0.000016 retu ctrlp#utils#glob(a:cwd, 0) == '' || ( s:igntype >= 0 && s:usrign(a:cwd, getftype(a:cwd)) ) | |
FUNCTION <SNR>52_MatchedItems() | |
Called 44 times | |
Total time: 0.193864 | |
Self time: 0.021099 | |
count total (s) self (s) | |
44 0.000134 let exc = exists('s:crfilerel') ? s:crfilerel : '' | |
44 0.020505 0.020014 let items = s:narrowable() ? s:matched + s:mdata[3] : a:items | |
44 0.000057 if s:matcher != {} | |
let argms = has_key(s:matcher, 'arg_type') && s:matcher['arg_type'] == 'dict' ? [{ 'items': items, 'str': a:pat, 'limit': a:limit, 'mmode': s:mmode(), 'ispath': s:ispath, 'crfile': exc, 'regex': s:regexp, }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] | |
let lines = call(s:matcher['match'], argms, s:matcher) | |
el | |
44 0.172521 0.000247 let lines = s:MatchIt(items, a:pat, a:limit, exc) | |
44 0.000019 en | |
44 0.000093 let s:matches = len(lines) | |
44 0.000033 unl! s:did_exp | |
44 0.000025 retu lines | |
FUNCTION <SNR>52_nosort() | |
Called 44 times | |
Total time: 0.000405 | |
Self time: 0.000405 | |
count total (s) self (s) | |
44 0.000388 retu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef ) || ( s:itemtype =~ '\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort | |
FUNCTION ctrlp#statusline() | |
Called 44 times | |
Total time: 0.058974 | |
Self time: 0.002783 | |
count total (s) self (s) | |
44 0.000084 if !exists('s:statypes') | |
1 0.000005 let s:statypes = [ ['files', 'fil'], ['buffers', 'buf'], ['mru files', 'mru'], ] | |
1 0.000002 if !empty(g:ctrlp_ext_vars) | |
cal map(copy(g:ctrlp_ext_vars), 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])') | |
en | |
1 0.000001 en | |
44 0.000052 let tps = s:statypes | |
44 0.000086 let max = len(tps) - 1 | |
44 0.000342 0.000208 let nxt = tps[s:walker(max, s:itemtype, 1)][1] | |
44 0.000246 0.000152 let prv = tps[s:walker(max, s:itemtype, -1)][1] | |
44 0.000109 let s:ctype = tps[s:itemtype][0] | |
44 0.000067 let focus = s:focus ? 'prt' : 'win' | |
44 0.000079 let byfname = s:ispath ? s:byfname ? 'file' : 'path' : 'line' | |
44 0.000167 let marked = s:opmul != '0' ? exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : '' | |
44 0.000056 if s:status != {} | |
44 0.000336 let argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{ 'focus': focus, 'byfname': byfname, 'regex': s:regexp, 'prev': prv, 'item': s:ctype, 'next': nxt, 'marked': marked, }] : [focus, byfname, s:regexp, prv, s:ctype, nxt, marked] | |
44 0.056623 0.000660 let &l:stl = call(s:status['main'], argms, s:status) | |
44 0.000018 el | |
let item = '%#CtrlPMode1# '.s:ctype.' %*' | |
let focus = '%#CtrlPMode2# '.focus.' %*' | |
let byfname = '%#CtrlPMode1# '.byfname.' %*' | |
let regex = s:regexp ? '%#CtrlPMode2# regex %*' : '' | |
let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' | |
let dir = ' %=%<%#CtrlPMode2# %{getcwd()} %*' | |
let &l:stl = focus.byfname.regex.slider.marked.dir | |
en | |
FUNCTION <SNR>36_get_syn() | |
Called 3348 times | |
Total time: 0.071279 | |
Self time: 0.071279 | |
count total (s) self (s) | |
" need to pass in mode, known to break on 7.3.547 | |
3348 0.010219 let mode = has('gui_running') ? 'gui' : 'cterm' | |
3348 0.020275 let color = synIDattr(synIDtrans(hlID(a:group)), a:what, mode) | |
3348 0.005614 if empty(color) || color == -1 | |
290 0.001669 let color = synIDattr(synIDtrans(hlID('Normal')), a:what, mode) | |
290 0.000139 endif | |
3348 0.005035 if empty(color) || color == -1 | |
290 0.000707 if has('gui_running') | |
let color = a:what ==# 'fg' ? '#000000' : '#FFFFFF' | |
else | |
290 0.000469 let color = a:what ==# 'fg' ? 0 : 1 | |
290 0.000131 endif | |
290 0.000099 endif | |
3348 0.002157 return color | |
FUNCTION <SNR>52_getparent() | |
Called 1616 times | |
Total time: 0.051878 | |
Self time: 0.051878 | |
count total (s) self (s) | |
1616 0.043113 let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '') | |
1616 0.004746 if parent == '' || parent !~ '[\/]' | |
let parent .= s:lash | |
en | |
1616 0.001067 retu parent | |
FUNCTION <SNR>52_opts() | |
Called 1 time | |
Total time: 0.000631 | |
Self time: 0.000564 | |
count total (s) self (s) | |
1 0.000003 unl! s:usrign s:usrcmd s:urprtmaps | |
6 0.000018 for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each) | |
let {each} = s:{each} | |
3 0.000007 en | endfo | |
37 0.000081 for [ke, va] in items(s:opts) | |
36 0.000211 let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1] | |
36 0.000025 endfo | |
1 0.000002 unl va | |
6 0.000016 for [ke, va] in items(s:new_opts) | |
5 0.000038 let {va} = {exists(s:pref.ke) ? s:pref.ke : va} | |
5 0.000001 endfo | |
1 0.000001 unl va | |
4 0.000010 for [ke, va] in items(s:lc_opts) | |
3 0.000010 if exists(s:bpref.ke) | |
unl {va} | |
let {va} = {s:bpref.ke} | |
en | |
3 0.000001 endfo | |
" Match window options | |
1 0.000070 0.000010 cal s:match_window_opts() | |
" One-time values | |
1 0.000002 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 | |
4 0.000010 for each in ['byfname', 'regexp'] | if exists(each) | |
let s:{each} = {each} | |
2 0.000001 en | endfo | |
1 0.000005 if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en | |
1 0.000004 let s:maxdepth = min([s:maxdepth, 100]) | |
1 0.000002 let s:glob = s:showhidden ? '.*\|*' : '*' | |
1 0.000005 let s:igntype = empty(s:usrign) ? -1 : type(s:usrign) | |
1 0.000013 0.000006 let s:lash = ctrlp#utils#lash() | |
1 0.000002 if s:keyloop | |
let [s:lazy, s:glbs['imd']] = [0, 0] | |
en | |
1 0.000001 if s:lazy | |
cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) | |
en | |
" Extensions | |
1 0.000003 if !( exists('extensions') && extensions == s:extensions ) | |
1 0.000002 for each in s:extensions | |
exe 'ru autoload/ctrlp/'.each.'.vim' | |
endfo | |
1 0.000000 en | |
" Keymaps | |
1 0.000002 if type(s:urprtmaps) == 4 | |
cal extend(s:prtmaps, s:urprtmaps) | |
en | |
FUNCTION <SNR>52_execextvar() | |
Called 3 times | |
Total time: 0.000028 | |
Self time: 0.000028 | |
count total (s) self (s) | |
3 0.000010 if !empty(g:ctrlp_ext_vars) | |
cal map(filter(copy(g:ctrlp_ext_vars), 'has_key(v:val, a:key)'), 'eval(v:val[a:key])') | |
en | |
FUNCTION <SNR>52_lash() | |
Called 1640 times | |
Total time: 0.010011 | |
Self time: 0.010011 | |
count total (s) self (s) | |
1640 0.009513 retu ( a:0 ? a:1 : s:dyncwd ) !~ '[\/]$' ? s:lash : '' | |
FUNCTION ctrlp#mrufiles#bufs() | |
Called 1 time | |
Total time: 0.000002 | |
Self time: 0.000002 | |
count total (s) self (s) | |
1 0.000002 retu s:mrbs | |
FUNCTION <SNR>41_add_section() | |
Called 128 times | |
Total time: 0.045854 | |
Self time: 0.002237 | |
count total (s) self (s) | |
" i have no idea why the warning section needs special treatment, but it's | |
" needed to prevent separators from showing up | |
128 0.000174 if a:key == 'warning' | |
5 0.000025 0.000015 call a:builder.add_raw('%(') | |
5 0.000002 endif | |
128 0.044691 0.001093 call a:builder.add_section('airline_'.a:key, s:get_section(a:context.winnr, a:key)) | |
128 0.000203 if a:key == 'warning' | |
5 0.000025 0.000016 call a:builder.add_raw('%)') | |
5 0.000005 endif | |
FUNCTION 10() | |
Called 80 times | |
Total time: 0.001296 | |
Self time: 0.001296 | |
count total (s) self (s) | |
80 0.000084 if !self._context.active | |
31 0.000942 let self._line = substitute(self._line, '%#.\{-}\ze#', '\0_inactive', 'g') | |
31 0.000018 endif | |
80 0.000067 return self._line | |
FUNCTION <SNR>41_get_section() | |
Called 164 times | |
Total time: 0.003970 | |
Self time: 0.003575 | |
count total (s) self (s) | |
164 0.000438 if has_key(s:section_truncate_width, a:key) | |
113 0.000344 if winwidth(a:winnr) < s:section_truncate_width[a:key] | |
47 0.000042 return '' | |
endif | |
66 0.000030 endif | |
117 0.000185 let spc = g:airline_symbols.space | |
117 0.001228 0.000833 let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key}) | |
117 0.000802 let [prefix, suffix] = [get(a:000, 0, '%('.spc), get(a:000, 1, spc.'%)')] | |
117 0.000447 return empty(text) ? '' : prefix.text.suffix | |
FUNCTION <SNR>14_invoke_funcrefs() | |
Called 37 times | |
Total time: 0.059827 | |
Self time: 0.001176 | |
count total (s) self (s) | |
37 0.001043 0.000156 let builder = airline#builder#new(a:context) | |
37 0.056975 0.000300 let err = airline#util#exec_funcrefs(a:funcrefs + s:core_funcrefs, builder, a:context) | |
37 0.000037 if err == 1 | |
36 0.001260 0.000171 let a:context.line = builder.build() | |
36 0.000203 let s:contexts[a:context.winnr] = a:context | |
36 0.000241 call setwinvar(a:context.winnr, '&statusline', '%!airline#statusline('.a:context.winnr.')') | |
36 0.000014 endif | |
FUNCTION ctrlp#files() | |
Called 1 time | |
Total time: 1.389780 | |
Self time: 0.000128 | |
count total (s) self (s) | |
1 0.000062 0.000006 let cafile = ctrlp#utils#cachefile() | |
1 0.000010 if g:ctrlp_newcache || !filereadable(cafile) || s:nocache(cafile) | |
1 0.000015 0.000010 let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []] | |
" Get the list of files | |
1 0.000002 if empty(lscmd) | |
1 0.000108 0.000005 if !ctrlp#igncwd(s:dyncwd) | |
1 1.366932 0.000033 cal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0) | |
1 0.000001 en | |
1 0.000000 el | |
sil! cal ctrlp#progress('Indexing...') | |
try | cal s:UserCmd(lscmd) | |
cat | retu [] | endt | |
en | |
" Remove base directory | |
1 0.007341 0.000009 cal ctrlp#rmbasedir(g:ctrlp_allfiles) | |
1 0.000003 if len(g:ctrlp_allfiles) <= s:compare_lim | |
cal sort(g:ctrlp_allfiles, 'ctrlp#complen') | |
en | |
1 0.015265 0.000008 cal s:writecache(cafile) | |
1 0.000010 let catime = getftime(cafile) | |
1 0.000001 el | |
let catime = getftime(cafile) | |
if !( exists('s:initcwd') && s:initcwd == s:dyncwd ) || get(s:ficounts, s:dyncwd, [0, catime])[1] != catime | |
let s:initcwd = s:dyncwd | |
let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) | |
en | |
en | |
1 0.000007 cal extend(s:ficounts, { s:dyncwd : [len(g:ctrlp_allfiles), catime] }) | |
1 0.000002 retu g:ctrlp_allfiles | |
FUNCTION <SNR>52_mixedsort() | |
Called 807 times | |
Total time: 0.405763 | |
Self time: 0.043465 | |
count total (s) self (s) | |
807 0.000782 if s:itemtype == 1 | |
let pat = '[\/]\?\[\d\+\*No Name\]$' | |
if a:1 =~# pat && a:2 =~# pat | retu 0 | |
elsei a:1 =~# pat | retu 1 | |
elsei a:2 =~# pat | retu -1 | en | |
en | |
807 0.261960 0.005886 let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)] | |
807 0.000592 if s:ispath | |
807 0.000639 let ms = [] | |
807 0.000765 if s:res_count < 21 | |
807 0.013076 0.003193 let ms += [s:compfnlen(a:1, a:2)] | |
807 0.015089 0.006217 if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en | |
807 0.084368 0.004357 if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en | |
807 0.000318 en | |
807 0.002237 if s:itemtype =~ '^[12]$' | |
let ms += [s:compmref(a:1, a:2)] | |
let cln = cml ? cln : 0 | |
en | |
807 0.001727 let ms += [cml, 0, 0, 0] | |
807 0.012511 0.005053 let mp = call('s:multipliers', ms[:3]) | |
807 0.003064 retu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3] | |
en | |
retu cln + cml * 2 | |
FUNCTION <SNR>52_glbpath() | |
Called 11 times | |
Total time: 0.000180 | |
Self time: 0.000057 | |
count total (s) self (s) | |
11 0.000176 0.000053 retu call('ctrlp#utils#globpath', a:000) | |
FUNCTION <SNR>52_ignore() | |
Called 1 time | |
Total time: 0.000037 | |
Self time: 0.000037 | |
count total (s) self (s) | |
1 0.000010 let igdirs = [ '\.git', '\.hg', '\.svn', '_darcs', '\.bzr', '\.cdv', '\~\.dep', '\~\.dot', '\~\.nib', '\~\.plst', '\.pc', '_MTN', 'blib', 'CVS', 'RCS', 'SCCS', '_sgbak', 'autom4te\.cache', 'cover_db', '_build', ] | |
1 0.000007 let igfiles = [ '\~$', '#.+#$', '[._].*\.swp$', 'core\.\d+$', '\.exe$', '\.so$', '\.bak$', '\.png$', '\.jpg$', '\.gif$', '\.zip$', '\.rar$', '\.tar\.gz$', ] | |
1 0.000018 retu { 'dir': '\v[\/]('.join(igdirs, '|').')$', 'file': '\v'.join(igfiles, '|'), } | |
FUNCTION airline#highlighter#add_separator() | |
Called 299 times | |
Total time: 0.069703 | |
Self time: 0.003958 | |
count total (s) self (s) | |
299 0.001452 let s:separators[a:from.a:to] = [a:from, a:to, a:inverse] | |
299 0.068116 0.002371 call <sid>exec_separator({}, a:from, a:to, a:inverse, '') | |
FUNCTION <SNR>52_gethistdata() | |
Called 1 time | |
Total time: 0.000106 | |
Self time: 0.000019 | |
count total (s) self (s) | |
1 0.000106 0.000019 retu ctrlp#utils#readfile(s:gethistloc()[1]) | |
FUNCTION <SNR>43_lash() | |
Called 4 times | |
Total time: 0.000031 | |
Self time: 0.000031 | |
count total (s) self (s) | |
4 0.000030 retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : '' | |
FUNCTION <SNR>52_lastvisual() | |
Called 1 time | |
Total time: 0.000143 | |
Self time: 0.000132 | |
count total (s) self (s) | |
1 0.000004 let cview = winsaveview() | |
1 0.000007 let [ovreg, ovtype] = [getreg('v'), getregtype('v')] | |
1 0.000010 let [oureg, outype] = [getreg('"'), getregtype('"')] | |
1 0.000027 sil! norm! gv"vy | |
1 0.000020 0.000009 let selected = s:regisfilter('v') | |
1 0.000005 cal setreg('v', ovreg, ovtype) | |
1 0.000018 cal setreg('"', oureg, outype) | |
1 0.000049 cal winrestview(cview) | |
1 0.000001 retu selected | |
FUNCTION <SNR>52_fnesc() | |
Called 943 times | |
Total time: 0.035694 | |
Self time: 0.003255 | |
count total (s) self (s) | |
943 0.035484 0.003045 retu call('ctrlp#utils#fnesc', a:000) | |
FUNCTION ctrlp#recordhist() | |
Called 1 time | |
Total time: 0.002857 | |
Self time: 0.000059 | |
count total (s) self (s) | |
1 0.000008 let str = join(s:prompt, '') | |
1 0.000006 if empty(str) || !s:maxhst | retu | en | |
1 0.000003 let hst = s:hstry | |
1 0.000007 if len(hst) > 1 && hst[1] == str | retu | en | |
1 0.000006 cal extend(hst, [str], 1) | |
1 0.000009 if len(hst) > s:maxhst | cal remove(hst, s:maxhst, -1) | en | |
1 0.002818 0.000020 cal ctrlp#utils#writecache(hst, s:gethistloc()[0], s:gethistloc()[1]) | |
FUNCTION ctrlp#rmbasedir() | |
Called 1 time | |
Total time: 0.007332 | |
Self time: 0.007321 | |
count total (s) self (s) | |
1 0.000017 0.000006 let cwd = s:dyncwd.s:lash() | |
1 0.000006 if a:items != [] && !stridx(a:items[0], cwd) | |
1 0.000002 let idx = strlen(cwd) | |
1 0.007306 retu map(a:items, 'strpart(v:val, idx)') | |
en | |
retu a:items | |
FUNCTION ctrlp#utils#fnesc() | |
Called 944 times | |
Total time: 0.032479 | |
Self time: 0.032479 | |
count total (s) self (s) | |
944 0.001545 if exists('*fnameescape') | |
944 0.001726 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 | |
944 0.009428 let path = fnameescape(a:path) | |
944 0.000379 en | |
944 0.000316 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 | |
944 0.003042 retu a:0 ? escape(path, a:1) : path | |
FUNCTION ctrlp#utils#mkdir() | |
Called 2 times | |
Total time: 0.000038 | |
Self time: 0.000038 | |
count total (s) self (s) | |
2 0.000026 if exists('*mkdir') && !isdirectory(a:dir) | |
sil! cal mkdir(a:dir, 'p') | |
en | |
2 0.000003 retu a:dir | |
FUNCTION ctrlp#syntax() | |
Called 1 time | |
Total time: 0.000214 | |
Self time: 0.000099 | |
count total (s) self (s) | |
1 0.000011 0.000006 if ctrlp#nosy() | retu | en | |
23 0.000169 0.000059 for [ke, va] in items(s:hlgrps) | cal ctrlp#hicheck('CtrlP'.ke, va) | endfo | |
1 0.000012 if synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' | |
sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' | |
en | |
1 0.000006 sy match CtrlPNoEntries '^ == NO ENTRIES ==$' | |
1 0.000004 if hlexists('CtrlPLinePre') | |
sy match CtrlPLinePre '^>' | |
en | |
FUNCTION <SNR>52_log() | |
Called 2 times | |
Total time: 0.000040 | |
Self time: 0.000040 | |
count total (s) self (s) | |
2 0.000010 if exists('g:ctrlp_log') && g:ctrlp_log | if a:m | |
let cadir = ctrlp#utils#cachedir() | |
let apd = g:ctrlp_log > 1 ? '>' : '' | |
sil! exe 'redi! >'.apd cadir.s:lash(cadir).'ctrlp.log' | |
el | |
sil! redi END | |
en | en | |
FUNCTION <SNR>52_mfunc() | |
Called 1 time | |
Total time: 0.000016 | |
Self time: 0.000014 | |
count total (s) self (s) | |
1 0.000001 let mfunc = 'match' | |
1 0.000006 0.000004 if s:byfname() | |
let mfunc = 's:matchfname' | |
elsei s:itemtype > 2 | |
let matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } | |
if has_key(matchtypes, s:matchtype) | |
let mfunc = matchtypes[s:matchtype] | |
en | |
en | |
1 0.000001 retu mfunc | |
FUNCTION <SNR>52_compfnlen() | |
Called 807 times | |
Total time: 0.009883 | |
Self time: 0.009883 | |
count total (s) self (s) | |
" By filename length | |
807 0.004495 let len1 = strlen(split(a:1, s:lash)[-1]) | |
807 0.003589 let len2 = strlen(split(a:2, s:lash)[-1]) | |
807 0.001125 retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1 | |
FUNCTION <SNR>52_maxf() | |
Called 16 times | |
Total time: 0.000043 | |
Self time: 0.000043 | |
count total (s) self (s) | |
16 0.000031 retu s:maxfiles && a:len > s:maxfiles | |
FUNCTION airline#builder#new() | |
Called 81 times | |
Total time: 0.001832 | |
Self time: 0.001832 | |
count total (s) self (s) | |
81 0.000371 let builder = copy(s:prototype) | |
81 0.000158 let builder._context = a:context | |
81 0.000113 let builder._side = 1 | |
81 0.000102 let builder._curgroup = '' | |
81 0.000089 let builder._line = '' | |
81 0.000756 call extend(builder._context, { 'left_sep': g:airline_left_sep, 'left_alt_sep': g:airline_left_alt_sep, 'right_sep': g:airline_right_sep, 'right_alt_sep': g:airline_right_alt_sep, }, 'keep') | |
81 0.000071 return builder | |
FUNCTIONS SORTED ON TOTAL TIME | |
count total (s) self (s) function | |
44 28.141206 27.419367 <SNR>52_BuildPrompt() | |
43 27.494456 0.000423 <SNR>52_PrtFocusMap() | |
43 27.494033 0.000712 <SNR>52_PrtAdd() | |
17 3.953698 0.030597 <SNR>52_GlobPath() | |
1 2.043998 0.000123 ctrlp#init() | |
1 1.389865 0.000025 ctrlp#setlines() | |
1 1.389780 0.000128 ctrlp#files() | |
16 0.714138 0.713401 ctrlp#progress() | |
44 0.660695 0.026522 <SNR>52_Update() | |
17 0.481865 0.171878 ctrlp#dirnfile() | |
44 0.426534 0.009297 <SNR>52_Render() | |
807 0.405763 0.043465 <SNR>52_mixedsort() | |
7776 0.309807 <SNR>52_usrign() | |
3250 0.281106 0.232068 <SNR>52_matchlens() | |
521 0.265150 0.027000 airline#check_mode() | |
807 0.251483 0.011451 <SNR>52_compmatlen() | |
27 0.235429 0.065649 airline#highlighter#highlight() | |
44 0.193864 0.021099 <SNR>52_MatchedItems() | |
44 0.172274 0.150770 <SNR>52_MatchIt() | |
837 0.169407 0.020418 <SNR>36_exec_separator() | |
FUNCTIONS SORTED ON SELF TIME | |
count total (s) self (s) function | |
44 28.141206 27.419367 <SNR>52_BuildPrompt() | |
16 0.714138 0.713401 ctrlp#progress() | |
7776 0.309807 <SNR>52_usrign() | |
3250 0.281106 0.232068 <SNR>52_matchlens() | |
17 0.481865 0.171878 ctrlp#dirnfile() | |
44 0.172274 0.150770 <SNR>52_MatchIt() | |
3069 0.090849 airline#highlighter#exec() | |
3348 0.071279 <SNR>36_get_syn() | |
27 0.235429 0.065649 airline#highlighter#highlight() | |
1616 0.051878 <SNR>52_getparent() | |
807 0.405763 0.043465 <SNR>52_mixedsort() | |
944 0.032479 ctrlp#utils#fnesc() | |
1674 0.117086 0.032251 airline#highlighter#get_highlight() | |
17 3.953698 0.030597 <SNR>52_GlobPath() | |
521 0.265150 0.027000 airline#check_mode() | |
44 0.660695 0.026522 <SNR>52_Update() | |
423 0.093495 0.023792 8() | |
44 0.021441 <SNR>52_sublist() | |
44 0.193864 0.021099 <SNR>52_MatchedItems() | |
837 0.169407 0.020418 <SNR>36_exec_separator() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment