[
  {
    "path": ".gitignore",
    "content": "*.markdown\n*.zip\nnote.txt\ntags\n.hg*\ntmp/*\n"
  },
  {
    "path": "autoload/ctrlp/bookmarkdir.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/bookmarkdir.vim\n\" Description:   Bookmarked directories extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir\n\tfini\nen\nlet g:loaded_ctrlp_bookmarkdir = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#bookmarkdir#init()',\n\t\\ 'accept': 'ctrlp#bookmarkdir#accept',\n\t\\ 'lname': 'bookmarked dirs',\n\t\\ 'sname': 'bkd',\n\t\\ 'type': 'tabs',\n\t\\ 'opmul': 1,\n\t\\ 'nolim': 1,\n\t\\ 'wipe': 'ctrlp#bookmarkdir#remove',\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\" Utilities {{{1\nfu! s:getinput(str, ...)\n\techoh Identifier\n\tcal inputsave()\n\tlet input = call('input', a:0 ? [a:str] + a:000 : [a:str])\n\tcal inputrestore()\n\techoh None\n\tretu input\nendf\n\nfu! s:cachefile()\n\tif !exists('s:cadir') || !exists('s:cafile')\n\t\tlet s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'\n\t\tlet s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'\n\ten\n\tretu s:cafile\nendf\n\nfu! s:writecache(lines)\n\tcal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)\nendf\n\nfu! s:getbookmarks()\n\tretu ctrlp#utils#readfile(s:cachefile())\nendf\n\nfu! s:savebookmark(name, cwd)\n\tlet cwds = exists('+ssl') ? [tr(a:cwd, '\\', '/'), tr(a:cwd, '/', '\\')] : [a:cwd]\n\tlet entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')\n\tcal s:writecache(insert(entries, a:name.'\t'.a:cwd))\nendf\n\nfu! s:setentries()\n\tlet time = getftime(s:cachefile())\n\tif !( exists('s:bookmarks') && time == s:bookmarks[0] )\n\t\tlet s:bookmarks = [time, s:getbookmarks()]\n\ten\nendf\n\nfu! s:parts(str)\n\tlet mlist = matchlist(a:str, '\\v([^\\t]+)\\t(.*)$')\n\tretu mlist != [] ? mlist[1:2] : ['', '']\nendf\n\nfu! s:process(entries, type)\n\tretu map(a:entries, 's:modify(v:val, a:type)')\nendf\n\nfu! s:modify(entry, type)\n\tlet [name, dir] = s:parts(a:entry)\n\tlet dir = fnamemodify(dir, a:type)\n\tretu name.'\t'.( dir == '' ? '.' : dir )\nendf\n\nfu! s:msg(name, cwd)\n\tredr\n\techoh Identifier | echon 'Bookmarked ' | echoh Constant\n\techon a:name.' ' | echoh Directory | echon a:cwd\n\techoh None\nendf\n\nfu! s:syntax()\n\tif !ctrlp#nosy()\n\t\tcal ctrlp#hicheck('CtrlPBookmark', 'Identifier')\n\t\tcal ctrlp#hicheck('CtrlPTabExtra', 'Comment')\n\t\tsy match CtrlPBookmark '^> [^\\t]\\+' contains=CtrlPLinePre\n\t\tsy match CtrlPTabExtra '\\zs\\t.*\\ze$'\n\ten\nendf\n\" Public {{{1\nfu! ctrlp#bookmarkdir#init()\n\tcal s:setentries()\n\tcal s:syntax()\n\tretu s:process(copy(s:bookmarks[1]), ':.')\nendf\n\nfu! ctrlp#bookmarkdir#accept(mode, str)\n\tlet parts = s:parts(s:modify(a:str, ':p'))\n\tcal call('s:savebookmark', parts)\n\tif a:mode =~ 't\\|v\\|h'\n\t\tcal ctrlp#exit()\n\ten\n\tcal ctrlp#setdir(parts[1], a:mode =~ 't\\|h' ? 'chd!' : 'lc!')\n\tif a:mode == 'e'\n\t\tcal ctrlp#switchtype(0)\n\t\tcal ctrlp#recordhist()\n\t\tcal ctrlp#prtclear()\n\ten\nendf\n\nfu! ctrlp#bookmarkdir#add(dir, ...)\n\tlet str = 'Directory to bookmark: '\n\tlet cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')\n\tif cwd == '' | retu | en\n\tlet cwd = fnamemodify(cwd, ':p')\n\tlet name = a:0 && a:1 != '' ? a:1 : s:getinput('Bookmark as: ', cwd)\n\tif name == '' | retu | en\n\tlet name = tr(name, '\t', ' ')\n\tcal s:savebookmark(name, cwd)\n\tcal s:msg(name, cwd)\nendf\n\nfu! ctrlp#bookmarkdir#remove(entries)\n\tcal s:process(a:entries, ':p')\n\tcal s:writecache(a:entries == [] ? [] :\n\t\t\\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))\n\tcal s:setentries()\n\tretu s:process(copy(s:bookmarks[1]), ':.')\nendf\n\nfu! ctrlp#bookmarkdir#id()\n\tretu s:id\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/buffertag.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/buffertag.vim\n\" Description:   Buffer Tag extension\n\" Maintainer:    Kien Nguyen <github.com/kien>\n\" Credits:       Much of the code was taken from tagbar.vim by Jan Larres, plus\n\"                a few lines from taglist.vim by Yegappan Lakshmanan and from\n\"                buffertag.vim by Takeshi Nishida.\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag\n\tfini\nen\nlet g:loaded_ctrlp_buftag = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#buffertag#init(s:crfile)',\n\t\\ 'accept': 'ctrlp#buffertag#accept',\n\t\\ 'lname': 'buffer tags',\n\t\\ 'sname': 'bft',\n\t\\ 'exit': 'ctrlp#buffertag#exit()',\n\t\\ 'type': 'tabs',\n\t\\ 'opts': 'ctrlp#buffertag#opts()',\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\nlet [s:pref, s:opts] = ['g:ctrlp_buftag_', {\n\t\\ 'systemenc': ['s:enc', &enc],\n\t\\ 'ctags_bin': ['s:bin', ''],\n\t\\ 'types': ['s:usr_types', {}],\n\t\\ }]\n\nlet s:bins = [\n\t\\ 'ctags-exuberant',\n\t\\ 'exuberant-ctags',\n\t\\ 'exctags',\n\t\\ '/usr/local/bin/ctags',\n\t\\ '/opt/local/bin/ctags',\n\t\\ 'ctags',\n\t\\ 'ctags.exe',\n\t\\ 'tags',\n\t\\ ]\n\nlet s:types = {\n\t\\ 'asm'    : '%sasm%sasm%sdlmt',\n\t\\ 'aspperl': '%sasp%sasp%sfsv',\n\t\\ 'aspvbs' : '%sasp%sasp%sfsv',\n\t\\ 'awk'    : '%sawk%sawk%sf',\n\t\\ 'beta'   : '%sbeta%sbeta%sfsv',\n\t\\ 'c'      : '%sc%sc%sdgsutvf',\n\t\\ 'cpp'    : '%sc++%sc++%snvdtcgsuf',\n\t\\ 'cs'     : '%sc#%sc#%sdtncEgsipm',\n\t\\ 'cobol'  : '%scobol%scobol%sdfgpPs',\n\t\\ 'eiffel' : '%seiffel%seiffel%scf',\n\t\\ 'erlang' : '%serlang%serlang%sdrmf',\n\t\\ 'expect' : '%stcl%stcl%scfp',\n\t\\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',\n\t\\ 'html'   : '%shtml%shtml%saf',\n\t\\ 'java'   : '%sjava%sjava%spcifm',\n\t\\ 'javascript': '%sjavascript%sjavascript%sf',\n\t\\ 'lisp'   : '%slisp%slisp%sf',\n\t\\ 'lua'    : '%slua%slua%sf',\n\t\\ 'make'   : '%smake%smake%sm',\n\t\\ 'ocaml'  : '%socaml%socaml%scmMvtfCre',\n\t\\ 'pascal' : '%spascal%spascal%sfp',\n\t\\ 'perl'   : '%sperl%sperl%sclps',\n\t\\ 'php'    : '%sphp%sphp%scdvf',\n\t\\ 'python' : '%spython%spython%scmf',\n\t\\ 'rexx'   : '%srexx%srexx%ss',\n\t\\ 'ruby'   : '%sruby%sruby%scfFm',\n\t\\ 'scheme' : '%sscheme%sscheme%ssf',\n\t\\ 'sh'     : '%ssh%ssh%sf',\n\t\\ 'csh'    : '%ssh%ssh%sf',\n\t\\ 'zsh'    : '%ssh%ssh%sf',\n\t\\ 'slang'  : '%sslang%sslang%snf',\n\t\\ 'sml'    : '%ssml%ssml%secsrtvf',\n\t\\ 'sql'    : '%ssql%ssql%scFPrstTvfp',\n\t\\ 'tcl'    : '%stcl%stcl%scfmp',\n\t\\ 'vera'   : '%svera%svera%scdefgmpPtTvx',\n\t\\ 'verilog': '%sverilog%sverilog%smcPertwpvf',\n\t\\ 'vim'    : '%svim%svim%savf',\n\t\\ 'yacc'   : '%syacc%syacc%sl',\n\t\\ }\n\ncal map(s:types, 'printf(v:val, \"--language-force=\", \" --\", \"-types=\")')\n\nif executable('jsctags')\n\tcal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })\nen\n\nfu! ctrlp#buffertag#opts()\n\tfor [ke, va] in items(s:opts)\n\t\tlet {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]\n\tendfo\n\t\" Ctags bin\n\tif empty(s:bin)\n\t\tfor bin in s:bins | if executable(bin)\n\t\t\tlet s:bin = bin\n\t\t\tbrea\n\t\ten | endfo\n\tel\n\t\tlet s:bin = expand(s:bin, 1)\n\ten\n\t\" Types\n\tcal extend(s:types, s:usr_types)\nendf\n\" Utilities {{{1\nfu! s:validfile(fname, ftype)\n\tif ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)\n\t\t\\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en\n\tretu 0\nendf\n\nfu! s:exectags(cmd)\n\tif exists('+ssl')\n\t\tlet [ssl, &ssl] = [&ssl, 0]\n\ten\n\tif &sh =~ 'cmd\\.exe'\n\t\tlet [sxq, &sxq, shcf, &shcf] = [&sxq, '\"', &shcf, '/s /c']\n\ten\n\tlet output = system(a:cmd)\n\tif &sh =~ 'cmd\\.exe'\n\t\tlet [&sxq, &shcf] = [sxq, shcf]\n\ten\n\tif exists('+ssl')\n\t\tlet &ssl = ssl\n\ten\n\tretu output\nendf\n\nfu! s:exectagsonfile(fname, ftype)\n\tlet [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]\n\tif type(s:types[ft]) == 1\n\t\tlet ags .= s:types[ft]\n\t\tlet bin = s:bin\n\telsei type(s:types[ft]) == 4\n\t\tlet ags = s:types[ft]['args']\n\t\tlet bin = expand(s:types[ft]['bin'], 1)\n\ten\n\tif empty(bin) | retu '' | en\n\tlet cmd = s:esctagscmd(bin, ags, a:fname)\n\tif empty(cmd) | retu '' | en\n\tlet output = s:exectags(cmd)\n\tif v:shell_error || output =~ 'Warning: cannot open' | retu '' | en\n\tretu output\nendf\n\nfu! s:esctagscmd(bin, args, ...)\n\tif exists('+ssl')\n\t\tlet [ssl, &ssl] = [&ssl, 0]\n\ten\n\tlet fname = a:0 ? shellescape(a:1) : ''\n\tlet cmd = shellescape(a:bin).' '.a:args.' '.fname\n\tif &sh =~ 'cmd\\.exe'\n\t\tlet cmd = substitute(cmd, '[&()@^<>|]', '^\\0', 'g')\n\ten\n\tif exists('+ssl')\n\t\tlet &ssl = ssl\n\ten\n\tif has('iconv')\n\t\tlet last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc\n\t\tlet cmd = iconv(cmd, &enc, last)\n\ten\n\tretu cmd\nendf\n\nfu! s:process(fname, ftype)\n\tif !s:validfile(a:fname, a:ftype) | retu [] | endif\n\tlet ftime = getftime(a:fname)\n\tif has_key(g:ctrlp_buftags, a:fname)\n\t\t\\ && g:ctrlp_buftags[a:fname]['time'] >= ftime\n\t\tlet lines = g:ctrlp_buftags[a:fname]['lines']\n\tel\n\t\tlet data = s:exectagsonfile(a:fname, a:ftype)\n\t\tlet [raw, lines] = [split(data, '\\n\\+'), []]\n\t\tfor line in raw\n\t\t\tif line !~# '^!_TAG_' && len(split(line, ';\"')) == 2\n\t\t\t\tlet parsed_line = s:parseline(line)\n\t\t\t\tif parsed_line != ''\n\t\t\t\t\tcal add(lines, parsed_line)\n\t\t\t\ten\n\t\t\ten\n\t\tendfo\n\t\tlet cache = { a:fname : { 'time': ftime, 'lines': lines } }\n\t\tcal extend(g:ctrlp_buftags, cache)\n\ten\n\tretu lines\nendf\n\nfu! s:parseline(line)\n\tlet vals = matchlist(a:line,\n\t\t\\ '\\v^([^\\t]+)\\t(.+)\\t[?/]\\^?(.{-1,})\\$?[?/]\\;\\\"\\t(.+)\\tline(no)?\\:(\\d+)')\n\tif vals == [] | retu '' | en\n\tlet [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]\n\tretu vals[1].'\t'.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]\nendf\n\nfu! s:syntax()\n\tif !ctrlp#nosy()\n\t\tcal ctrlp#hicheck('CtrlPTagKind', 'Title')\n\t\tcal ctrlp#hicheck('CtrlPBufName', 'Directory')\n\t\tcal ctrlp#hicheck('CtrlPTabExtra', 'Comment')\n\t\tsy match CtrlPTagKind '\\zs[^\\t|]\\+\\ze|\\d\\+:[^|]\\+|\\d\\+|'\n\t\tsy match CtrlPBufName '|\\d\\+:\\zs[^|]\\+\\ze|\\d\\+|'\n\t\tsy match CtrlPTabExtra '\\zs\\t.*\\ze$' contains=CtrlPBufName,CtrlPTagKind\n\ten\nendf\n\nfu! s:chknearby(pat)\n\tif match(getline('.'), a:pat) < 0\n\t\tlet [int, forw, maxl] = [1, 1, line('$')]\n\t\twh !search(a:pat, 'W'.( forw ? '' : 'b' ))\n\t\t\tif !forw\n\t\t\t\tif int > maxl | brea | en\n\t\t\t\tlet int += int\n\t\t\ten\n\t\t\tlet forw = !forw\n\t\tendw\n\ten\nendf\n\" Public {{{1\nfu! ctrlp#buffertag#init(fname)\n\tlet bufs = exists('s:btmode') && s:btmode\n\t\t\\ ? filter(ctrlp#buffers(), 'filereadable(v:val)')\n\t\t\\ : [exists('s:bufname') ? s:bufname : a:fname]\n\tlet lines = []\n\tfor each in bufs\n\t\tlet bname = fnamemodify(each, ':p')\n\t\tlet tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\\.'), 0, '')\n\t\tcal extend(lines, s:process(bname, tftype))\n\tendfo\n\tcal s:syntax()\n\tretu lines\nendf\n\nfu! ctrlp#buffertag#accept(mode, str)\n\tlet vals = matchlist(a:str,\n\t\t\\ '\\v^[^\\t]+\\t+[^\\t|]+\\|(\\d+)\\:[^\\t|]+\\|(\\d+)\\|\\s(.+)$')\n\tlet bufnr = str2nr(get(vals, 1))\n\tif bufnr\n\t\tcal ctrlp#acceptfile(a:mode, bufnr)\n\t\texe 'norm!' str2nr(get(vals, 2, line('.'))).'G'\n\t\tcal s:chknearby('\\V\\C'.get(vals, 3, ''))\n\t\tsil! norm! zvzz\n\ten\nendf\n\nfu! ctrlp#buffertag#cmd(mode, ...)\n\tlet s:btmode = a:mode\n\tif a:0 && !empty(a:1)\n\t\tlet s:btmode = 0\n\t\tlet bname = a:1 =~# '^%$\\|^#\\d*$' ? expand(a:1) : a:1\n\t\tlet s:bufname = fnamemodify(bname, ':p')\n\ten\n\tretu s:id\nendf\n\nfu! ctrlp#buffertag#exit()\n\tunl! s:btmode s:bufname\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/changes.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/changes.vim\n\" Description:   Change list extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes\n\tfini\nen\nlet g:loaded_ctrlp_changes = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',\n\t\\ 'accept': 'ctrlp#changes#accept',\n\t\\ 'lname': 'changes',\n\t\\ 'sname': 'chs',\n\t\\ 'exit': 'ctrlp#changes#exit()',\n\t\\ 'type': 'tabe',\n\t\\ 'sort': 0,\n\t\\ 'nolim': 1,\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\" Utilities {{{1\nfu! s:changelist(bufnr)\n\tsil! exe 'noa hid b' a:bufnr\n\tredi => result\n\tsil! changes\n\tredi END\n\tretu map(split(result, \"\\n\")[1:], 'tr(v:val, \"\t\", \" \")')\nendf\n\nfu! s:process(clines, ...)\n\tlet [clines, evas] = [[], []]\n\tfor each in a:clines\n\t\tlet parts = matchlist(each, '\\v^.\\s*\\d+\\s+(\\d+)\\s+(\\d+)\\s(.*)$')\n\t\tif !empty(parts)\n\t\t\tif parts[3] == '' | let parts[3] = ' ' | en\n\t\t\tcal add(clines, parts[3].'\t|'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|')\n\t\ten\n\tendfo\n\tretu reverse(filter(clines, 'count(clines, v:val) == 1'))\nendf\n\nfu! s:syntax()\n\tif !ctrlp#nosy()\n\t\tcal ctrlp#hicheck('CtrlPBufName', 'Directory')\n\t\tcal ctrlp#hicheck('CtrlPTabExtra', 'Comment')\n\t\tsy match CtrlPBufName '\\t|\\d\\+:\\zs[^|]\\+\\ze|\\d\\+:\\d\\+|$'\n\t\tsy match CtrlPTabExtra '\\zs\\t.*\\ze$' contains=CtrlPBufName\n\ten\nendf\n\" Public {{{1\nfu! ctrlp#changes#init(original_bufnr, bufnr)\n\tlet bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr\n\tlet bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]\n\tcal filter(bufs, 'v:val > 0')\n\tlet [swb, &swb] = [&swb, '']\n\tlet lines = []\n\tfor each in bufs\n\t\tlet bname = bufname(each)\n\t\tlet fnamet = fnamemodify(bname == '' ? '[No Name]' : bname, ':t')\n\t\tcal extend(lines, s:process(s:changelist(each), each, fnamet))\n\tendfo\n\tsil! exe 'noa hid b' a:original_bufnr\n\tlet &swb = swb\n\tcal ctrlp#syntax()\n\tcal s:syntax()\n\tretu lines\nendf\n\nfu! ctrlp#changes#accept(mode, str)\n\tlet info = matchlist(a:str, '\\t|\\(\\d\\+\\):[^|]\\+|\\(\\d\\+\\):\\(\\d\\+\\)|$')\n\tlet bufnr = str2nr(get(info, 1))\n\tif bufnr\n\t\tcal ctrlp#acceptfile(a:mode, bufnr)\n\t\tcal cursor(get(info, 2), get(info, 3))\n\t\tsil! norm! zvzz\n\ten\nendf\n\nfu! ctrlp#changes#cmd(mode, ...)\n\tlet s:clmode = a:mode\n\tif a:0 && !empty(a:1)\n\t\tlet s:clmode = 0\n\t\tlet bname = a:1 =~# '^%$\\|^#\\d*$' ? expand(a:1) : a:1\n\t\tlet s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$')\n\ten\n\tretu s:id\nendf\n\nfu! ctrlp#changes#exit()\n\tunl! s:clmode s:bufnr\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/dir.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/dir.vim\n\" Description:   Directory extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir\n\tfini\nen\nlet [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]\n\nlet s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',\n\t\\ 'accept': 'ctrlp#dir#accept',\n\t\\ 'lname': 'dirs',\n\t\\ 'sname': 'dir',\n\t\\ 'type': 'path',\n\t\\ 'specinput': 1,\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\nlet s:dircounts = {}\n\" Utilities {{{1\nfu! s:globdirs(dirs, depth)\n\tlet entries = split(globpath(a:dirs, s:glob), \"\\n\")\n\tlet [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]\n\tcal extend(g:ctrlp_alldirs, dirs)\n\tlet nr = len(g:ctrlp_alldirs)\n\tif !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth\n\t\tsil! cal ctrlp#progress(nr)\n\t\tcal map(dirs, 'ctrlp#utils#fnesc(v:val, \"g\", \",\")')\n\t\tcal s:globdirs(join(dirs, ','), depth)\n\ten\nendf\n\nfu! s:max(len, max)\n\tretu a:max && a:len > a:max\nendf\n\nfu! s:nocache()\n\tretu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )\nendf\n\" Public {{{1\nfu! ctrlp#dir#init(...)\n\tlet s:cwd = getcwd()\n\tfor each in range(len(s:ars))\n\t\tlet {s:ars[each]} = a:{each + 1}\n\tendfo\n\tlet cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'\n\tlet cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')\n\tif g:ctrlp_newdir || s:nocache() || !filereadable(cafile)\n\t\tlet [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]\n\t\tif !ctrlp#igncwd(s:cwd)\n\t\t\tcal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)\n\t\ten\n\t\tcal ctrlp#rmbasedir(g:ctrlp_alldirs)\n\t\tif len(g:ctrlp_alldirs) <= s:compare_lim\n\t\t\tcal sort(g:ctrlp_alldirs, 'ctrlp#complen')\n\t\ten\n\t\tcal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)\n\t\tlet g:ctrlp_newdir = 0\n\tel\n\t\tif !( exists('s:initcwd') && s:initcwd == s:cwd )\n\t\t\tlet s:initcwd = s:cwd\n\t\t\tlet g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)\n\t\ten\n\ten\n\tcal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })\n\tretu g:ctrlp_alldirs\nendf\n\nfu! ctrlp#dir#accept(mode, str)\n\tlet path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#call('s:lash', s:cwd).a:str\n\tif a:mode =~ 't\\|v\\|h'\n\t\tcal ctrlp#exit()\n\ten\n\tcal ctrlp#setdir(path, a:mode =~ 't\\|h' ? 'chd!' : 'lc!')\n\tif a:mode == 'e'\n\t\tsil! cal ctrlp#statusline()\n\t\tcal ctrlp#setlines(s:id)\n\t\tcal ctrlp#recordhist()\n\t\tcal ctrlp#prtclear()\n\ten\nendf\n\nfu! ctrlp#dir#id()\n\tretu s:id\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/line.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/line.vim\n\" Description:   Line extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line\n\tfini\nen\nlet g:loaded_ctrlp_line = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#line#init(s:crbufnr)',\n\t\\ 'accept': 'ctrlp#line#accept',\n\t\\ 'lname': 'lines',\n\t\\ 'sname': 'lns',\n\t\\ 'type': 'tabe',\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\" Utilities {{{1\nfu! s:syntax()\n\tif !ctrlp#nosy()\n\t\tcal ctrlp#hicheck('CtrlPBufName', 'Directory')\n\t\tcal ctrlp#hicheck('CtrlPTabExtra', 'Comment')\n\t\tsy match CtrlPBufName '\\t|\\zs[^|]\\+\\ze|\\d\\+:\\d\\+|$'\n\t\tsy match CtrlPTabExtra '\\zs\\t.*\\ze$' contains=CtrlPBufName\n\ten\nendf\n\" Public {{{1\nfu! ctrlp#line#init(bufnr)\n\tlet [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr]\n\tlet bufs = exists('s:lnmode') && s:lnmode ? ctrlp#buffers('id') : [bufnr]\n\tfor bufnr in bufs\n\t\tlet [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]\n\t\tif lfb == [] && bufn != ''\n\t\t\tlet lfb = ctrlp#utils#readfile(fnamemodify(bufn, ':p'))\n\t\ten\n\t\tcal map(lfb, 'tr(v:val, ''\t'', '' '')')\n\t\tlet [linenr, len_lfb] = [1, len(lfb)]\n\t\tlet buft = bufn == '' ? '[No Name]' : fnamemodify(bufn, ':t')\n\t\twh linenr <= len_lfb\n\t\t\tlet lfb[linenr - 1] .= '\t|'.buft.'|'.bufnr.':'.linenr.'|'\n\t\t\tlet linenr += 1\n\t\tendw\n\t\tcal extend(lines, filter(lfb, 'v:val !~ ''^\\s*\\t|[^|]\\+|\\d\\+:\\d\\+|$'''))\n\tendfo\n\tcal s:syntax()\n\tretu lines\nendf\n\nfu! ctrlp#line#accept(mode, str)\n\tlet info = matchlist(a:str, '\\t|[^|]\\+|\\(\\d\\+\\):\\(\\d\\+\\)|$')\n\tlet bufnr = str2nr(get(info, 1))\n\tif bufnr\n\t\tcal ctrlp#acceptfile(a:mode, bufnr, get(info, 2))\n\ten\nendf\n\nfu! ctrlp#line#cmd(mode, ...)\n\tlet s:lnmode = a:mode\n\tif a:0 && !empty(a:1)\n\t\tlet s:lnmode = 0\n\t\tlet bname = a:1 =~# '^%$\\|^#\\d*$' ? expand(a:1) : a:1\n\t\tlet s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$')\n\ten\n\tretu s:id\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/mixed.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/mixed.vim\n\" Description:   Mixing Files + MRU + Buffers\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed\n\tfini\nen\nlet [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#mixed#init(s:compare_lim)',\n\t\\ 'accept': 'ctrlp#acceptfile',\n\t\\ 'lname': 'fil + mru + buf',\n\t\\ 'sname': 'mix',\n\t\\ 'type': 'path',\n\t\\ 'opmul': 1,\n\t\\ 'specinput': 1,\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\" Utilities {{{1\nfu! s:newcache(cwd)\n\tif g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en\n\tretu g:ctrlp_allmixes['cwd'] != a:cwd\n\t\t\\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())\n\t\t\\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())\n\t\t\\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())\nendf\n\nfu! s:getnewmix(cwd, clim)\n\tif g:ctrlp_newmix\n\t\tcal ctrlp#mrufiles#refresh('raw')\n\t\tlet g:ctrlp_newcache = 1\n\ten\n\tlet g:ctrlp_lines = copy(ctrlp#files())\n\tcal ctrlp#progress('Mixing...')\n\tlet mrufs = copy(ctrlp#mrufiles#list('raw'))\n\tif exists('+ssl') && &ssl\n\t\tcal map(mrufs, 'tr(v:val, \"\\\\\", \"/\")')\n\ten\n\tlet allbufs = map(ctrlp#buffers(), 'fnamemodify(v:val, \":p\")')\n\tlet [bufs, ubufs] = [[], []]\n\tfor each in allbufs\n\t\tcal add(filereadable(each) ? bufs : ubufs, each)\n\tendfo\n\tlet mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')\n\tif len(mrufs) > len(g:ctrlp_lines)\n\t\tcal filter(mrufs, 'stridx(v:val, a:cwd)')\n\tel\n\t\tlet cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')\n\t\tlet cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)\n\t\tfor each in cwd_mrufs\n\t\t\tlet id = index(g:ctrlp_lines, each)\n\t\t\tif id >= 0 | cal remove(g:ctrlp_lines, id) | en\n\t\tendfo\n\ten\n\tlet mrufs += ubufs\n\tcal map(mrufs, 'fnamemodify(v:val, \":.\")')\n\tlet g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)\n\t\t\\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines\n\tif len(g:ctrlp_lines) <= a:clim\n\t\tcal sort(g:ctrlp_lines, 'ctrlp#complen')\n\ten\n\tlet g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),\n\t\t\\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,\n\t\t\\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }\nendf\n\" Public {{{1\nfu! ctrlp#mixed#init(clim)\n\tlet cwd = getcwd()\n\tif s:newcache(cwd)\n\t\tcal s:getnewmix(cwd, a:clim)\n\tel\n\t\tlet g:ctrlp_lines = g:ctrlp_allmixes['data']\n\ten\n\tlet g:ctrlp_newmix = 0\n\tretu g:ctrlp_lines\nendf\n\nfu! ctrlp#mixed#id()\n\tretu s:id\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/mrufiles.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/mrufiles.vim\n\" Description:   Most Recently Used Files extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Static variables {{{1\nlet [s:mrbs, s:mrufs] = [[], []]\n\nfu! ctrlp#mrufiles#opts()\n\tlet [pref, opts] = ['g:ctrlp_mruf_', {\n\t\t\\ 'max': ['s:max', 250],\n\t\t\\ 'include': ['s:in', ''],\n\t\t\\ 'exclude': ['s:ex', ''],\n\t\t\\ 'case_sensitive': ['s:cseno', 1],\n\t\t\\ 'relative': ['s:re', 0],\n\t\t\\ 'save_on_update': ['s:soup', 1],\n\t\t\\ }]\n\tfor [ke, va] in items(opts)\n\t\tlet [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]\n\tendfo\nendf\ncal ctrlp#mrufiles#opts()\n\" Utilities {{{1\nfu! s:excl(fn)\n\tretu !empty({s:ex}) && a:fn =~# {s:ex}\nendf\n\nfu! s:mergelists()\n\tlet diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())\n\tcal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')\n\tlet mrufs = s:mrufs + diskmrufs\n\tretu s:chop(mrufs)\nendf\n\nfu! s:chop(mrufs)\n\tif len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en\n\tretu a:mrufs\nendf\n\nfu! s:reformat(mrufs, ...)\n\tlet cwd = getcwd()\n\tlet cwd .= cwd !~ '[\\/]$' ? ctrlp#utils#lash() : ''\n\tif {s:re}\n\t\tlet cwd = exists('+ssl') ? tr(cwd, '/', '\\') : cwd\n\t\tcal filter(a:mrufs, '!stridx(v:val, cwd)')\n\ten\n\tif a:0 && a:1 == 'raw' | retu a:mrufs | en\n\tlet idx = strlen(cwd)\n\tif exists('+ssl') && &ssl\n\t\tlet cwd = tr(cwd, '\\', '/')\n\t\tcal map(a:mrufs, 'tr(v:val, \"\\\\\", \"/\")')\n\ten\n\tretu map(a:mrufs, '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val')\nendf\n\nfu! s:record(bufnr)\n\tif s:locked | retu | en\n\tlet bufnr = a:bufnr + 0\n\tlet bufname = bufname(bufnr)\n\tif bufnr > 0 && !empty(bufname)\n\t\tcal filter(s:mrbs, 'v:val != bufnr')\n\t\tcal insert(s:mrbs, bufnr)\n\t\tcal s:addtomrufs(bufname)\n\ten\nendf\n\nfu! s:addtomrufs(fname)\n\tlet fn = fnamemodify(a:fname, ':p')\n\tlet fn = exists('+ssl') ? tr(fn, '/', '\\') : fn\n\tif ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )\n\t\t\\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu\n\ten\n\tlet idx = index(s:mrufs, fn, 0, !{s:cseno})\n\tif idx\n\t\tcal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')\n\t\tcal insert(s:mrufs, fn)\n\t\tif {s:soup} && idx < 0\n\t\t\tcal s:savetofile(s:mergelists())\n\t\ten\n\ten\nendf\n\nfu! s:savetofile(mrufs)\n\tcal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)\nendf\n\" Public {{{1\nfu! ctrlp#mrufiles#refresh(...)\n\tlet mrufs = s:mergelists()\n\tcal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')\n\tif exists('+ssl')\n\t\tcal map(mrufs, 'tr(v:val, \"/\", \"\\\\\")')\n\t\tcal map(s:mrufs, 'tr(v:val, \"/\", \"\\\\\")')\n\t\tlet cond = 'count(mrufs, v:val, !{s:cseno}) == 1'\n\t\tcal filter(mrufs, cond)\n\t\tcal filter(s:mrufs, cond)\n\ten\n\tcal s:savetofile(mrufs)\n\tretu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs)\nendf\n\nfu! ctrlp#mrufiles#remove(files)\n\tlet mrufs = []\n\tif a:files != []\n\t\tlet mrufs = s:mergelists()\n\t\tlet cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0'\n\t\tcal filter(mrufs, cond)\n\t\tcal filter(s:mrufs, cond)\n\ten\n\tcal s:savetofile(mrufs)\n\tretu s:reformat(mrufs)\nendf\n\nfu! ctrlp#mrufiles#add(fn)\n\tif !empty(a:fn)\n\t\tcal s:addtomrufs(a:fn)\n\ten\nendf\n\nfu! ctrlp#mrufiles#list(...)\n\tretu a:0 ? a:1 == 'raw' ? s:reformat(s:mergelists(), a:1) : 0\n\t\t\\ : s:reformat(s:mergelists())\nendf\n\nfu! ctrlp#mrufiles#bufs()\n\tretu s:mrbs\nendf\n\nfu! ctrlp#mrufiles#tgrel()\n\tlet {s:re} = !{s:re}\nendf\n\nfu! ctrlp#mrufiles#cachefile()\n\tif !exists('s:cadir') || !exists('s:cafile')\n\t\tlet s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'\n\t\tlet s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'\n\ten\n\tretu s:cafile\nendf\n\nfu! ctrlp#mrufiles#init()\n\tif !has('autocmd') | retu | en\n\tlet s:locked = 0\n\taug CtrlPMRUF\n\t\tau!\n\t\tau BufAdd,BufEnter,BufLeave,BufWritePost * cal s:record(expand('<abuf>', 1))\n\t\tau QuickFixCmdPre  *vimgrep* let s:locked = 1\n\t\tau QuickFixCmdPost *vimgrep* let s:locked = 0\n\t\tau VimLeavePre * cal s:savetofile(s:mergelists())\n\taug END\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/quickfix.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/quickfix.vim\n\" Description:   Quickfix extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix\n\tfini\nen\nlet g:loaded_ctrlp_quickfix = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#quickfix#init()',\n\t\\ 'accept': 'ctrlp#quickfix#accept',\n\t\\ 'lname': 'quickfix',\n\t\\ 'sname': 'qfx',\n\t\\ 'type': 'line',\n\t\\ 'sort': 0,\n\t\\ 'nolim': 1,\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\nfu! s:lineout(dict)\n\tretu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],\n\t\t\\ a:dict['col'], matchstr(a:dict['text'], '\\s*\\zs.*\\S'))\nendf\n\" Utilities {{{1\nfu! s:syntax()\n\tif !ctrlp#nosy()\n\t\tcal ctrlp#hicheck('CtrlPqfLineCol', 'Search')\n\t\tsy match CtrlPqfLineCol '|\\zs\\d\\+:\\d\\+\\ze|'\n\ten\nendf\n\" Public {{{1\nfu! ctrlp#quickfix#init()\n\tcal s:syntax()\n\tretu map(getqflist(), 's:lineout(v:val)')\nendf\n\nfu! ctrlp#quickfix#accept(mode, str)\n\tlet vals = matchlist(a:str, '^\\([^|]\\+\\ze\\)|\\(\\d\\+\\):\\(\\d\\+\\)|')\n\tif vals == [] || vals[1] == '' | retu | en\n\tcal ctrlp#acceptfile(a:mode, vals[1])\n\tlet cur_pos = getpos('.')[1:2]\n\tif cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')\n\t\tmark '\n\ten\n\tcal cursor(vals[2], vals[3])\n\tsil! norm! zvzz\nendf\n\nfu! ctrlp#quickfix#id()\n\tretu s:id\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/rtscript.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/rtscript.vim\n\" Description:   Runtime scripts extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript\n\tfini\nen\nlet [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#rtscript#init(s:caching)',\n\t\\ 'accept': 'ctrlp#acceptfile',\n\t\\ 'lname': 'runtime scripts',\n\t\\ 'sname': 'rts',\n\t\\ 'type': 'path',\n\t\\ 'opmul': 1,\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\nlet s:filecounts = {}\n\" Utilities {{{1\nfu! s:nocache()\n\tretu g:ctrlp_newrts ||\n\t\t\\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )\nendf\n\" Public {{{1\nfu! ctrlp#rtscript#init(caching)\n\tlet [s:caching, s:cwd] = [a:caching, getcwd()]\n\tif s:nocache() ||\n\t\t\\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )\n\t\tsil! cal ctrlp#progress('Indexing...')\n\t\tlet entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), \"\\n\")\n\t\tcal filter(entries, 'count(entries, v:val) == 1')\n\t\tlet [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]\n\tel\n\t\tlet [entries, results] = g:ctrlp_rtscache[2:3]\n\ten\n\tif s:nocache() ||\n\t\t\\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )\n\t\tif !exists('echoed')\n\t\t\tsil! cal ctrlp#progress('Processing...')\n\t\ten\n\t\tlet results = map(copy(entries), 'fnamemodify(v:val, '':.'')')\n\ten\n\tlet [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]\n\tcal extend(s:filecounts, { s:cwd : len(results) })\n\tretu results\nendf\n\nfu! ctrlp#rtscript#id()\n\tretu s:id\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/tag.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/tag.vim\n\" Description:   Tag file extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag\n\tfini\nen\nlet g:loaded_ctrlp_tag = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#tag#init()',\n\t\\ 'accept': 'ctrlp#tag#accept',\n\t\\ 'lname': 'tags',\n\t\\ 'sname': 'tag',\n\t\\ 'enter': 'ctrlp#tag#enter()',\n\t\\ 'type': 'tabs',\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\" Utilities {{{1\nfu! s:findcount(str)\n\tlet [tg, ofname] = split(a:str, '\\t\\+\\ze[^\\t]\\+$')\n\tlet tgs = taglist('^'.tg.'$')\n\tif len(tgs) < 2\n\t\tretu [0, 0, 0, 0]\n\ten\n\tlet bname = fnamemodify(bufname('%'), ':p')\n\tlet fname = expand(fnamemodify(simplify(ofname), ':s?^[.\\/]\\+??:p:.'), 1)\n\tlet [fnd, cnt, pos, ctgs, otgs] = [0, 0, 0, [], []]\n\tfor tgi in tgs\n\t\tlet lst = bname == fnamemodify(tgi[\"filename\"], ':p') ? 'ctgs' : 'otgs'\n\t\tcal call('add', [{lst}, tgi])\n\tendfo\n\tlet ntgs = ctgs + otgs\n\tfor tgi in ntgs\n\t\tlet cnt += 1\n\t\tlet fulname = fnamemodify(tgi[\"filename\"], ':p')\n\t\tif stridx(fulname, fname) >= 0\n\t\t\t\\ && strlen(fname) + stridx(fulname, fname) == strlen(fulname)\n\t\t\tlet fnd += 1\n\t\t\tlet pos = cnt\n\t\ten\n\tendfo\n\tlet cnt = 0\n\tfor tgi in ntgs\n\t\tlet cnt += 1\n\t\tif tgi[\"filename\"] == ofname\n\t\t\tlet [fnd, pos] = [0, cnt]\n\t\ten\n\tendfo\n\tretu [1, fnd, pos, len(ctgs)]\nendf\n\nfu! s:filter(tags)\n\tlet nr = 0\n\twh 0 < 1\n\t\tif a:tags == [] | brea | en\n\t\tif a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_'\n\t\t\tlet nr += 1\n\t\t\tcon\n\t\ten\n\t\tif a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr\n\t\t\tcal remove(a:tags, nr)\n\t\tel\n\t\t\tbrea\n\t\ten\n\tendw\n\tretu a:tags\nendf\n\nfu! s:syntax()\n\tif !ctrlp#nosy()\n\t\tcal ctrlp#hicheck('CtrlPTabExtra', 'Comment')\n\t\tsy match CtrlPTabExtra '\\zs\\t.*\\ze$'\n\ten\nendf\n\" Public {{{1\nfu! ctrlp#tag#init()\n\tif empty(s:tagfiles) | retu [] | en\n\tlet g:ctrlp_alltags = []\n\tlet tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))\n\tfor each in tagfiles\n\t\tlet alltags = s:filter(ctrlp#utils#readfile(each))\n\t\tcal extend(g:ctrlp_alltags, alltags)\n\tendfo\n\tcal s:syntax()\n\tretu g:ctrlp_alltags\nendf\n\nfu! ctrlp#tag#accept(mode, str)\n\tcal ctrlp#exit()\n\tlet str = matchstr(a:str, '^[^\\t]\\+\\t\\+[^\\t]\\+\\ze\\t')\n\tlet [tg, fdcnt] = [split(str, '^[^\\t]\\+\\zs\\t')[0], s:findcount(str)]\n\tlet cmds = {\n\t\t\\ 't': ['tab sp', 'tab stj'],\n\t\t\\ 'h': ['sp', 'stj'],\n\t\t\\ 'v': ['vs', 'vert stj'],\n\t\t\\ 'e': ['', 'tj'],\n\t\t\\ }\n\tlet utg = fdcnt[3] < 2 && fdcnt[0] == 1 && fdcnt[1] == 1\n\tlet cmd = !fdcnt[0] || utg ? cmds[a:mode][0] : cmds[a:mode][1]\n\tlet cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)\n\t\t\\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd\n\tlet cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd\n\tif !fdcnt[0] || utg\n\t\tif cmd != ''\n\t\t\texe cmd\n\t\ten\n\t\tlet save_cst = &cst\n\t\tset cst&\n\t\tcal feedkeys(\":\".( utg ? fdcnt[2] : \"\" ).\"ta \".tg.\"\\r\", 'nt')\n\t\tlet &cst = save_cst\n\tel\n\t\tlet ext = \"\"\n\t\tif fdcnt[1] < 2 && fdcnt[2]\n\t\t\tlet [sav_more, &more] = [&more, 0]\n\t\t\tlet ext = fdcnt[2].\"\\r\".\":let &more = \".sav_more.\"\\r\"\n\t\ten\n\t\tcal feedkeys(\":\".cmd.\" \".tg.\"\\r\".ext, 'nt')\n\ten\n\tcal ctrlp#setlcdir()\nendf\n\nfu! ctrlp#tag#id()\n\tretu s:id\nendf\n\nfu! ctrlp#tag#enter()\n\tlet tfs = tagfiles()\n\tlet s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, \":p\")'),\n\t\t\\ 'filereadable(v:val)') : []\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/undo.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/undo.vim\n\" Description:   Undo extension\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Init {{{1\nif ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )\n\tfini\nen\nlet g:loaded_ctrlp_undo = 1\n\ncal add(g:ctrlp_ext_vars, {\n\t\\ 'init': 'ctrlp#undo#init()',\n\t\\ 'accept': 'ctrlp#undo#accept',\n\t\\ 'lname': 'undo',\n\t\\ 'sname': 'udo',\n\t\\ 'enter': 'ctrlp#undo#enter()',\n\t\\ 'exit': 'ctrlp#undo#exit()',\n\t\\ 'type': 'line',\n\t\\ 'sort': 0,\n\t\\ 'nolim': 1,\n\t\\ })\n\nlet s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)\n\nlet s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',\n\t\\ 'months', 'years'], '\" \".v:val.\" ago\"')\n\" Utilities {{{1\nfu! s:getundo()\n\tif exists('*undotree')\n\t\t\\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )\n\t\tretu [1, undotree()]\n\tel\n\t\tredi => result\n\t\tsil! undol\n\t\tredi END\n\t\tretu [0, split(result, \"\\n\")[1:]]\n\ten\nendf\n\nfu! s:flatten(tree, cur)\n\tlet flatdict = {}\n\tfor each in a:tree\n\t\tlet saved = has_key(each, 'save') ? 'saved' : ''\n\t\tlet current = each['seq'] == a:cur ? 'current' : ''\n\t\tcal extend(flatdict, { each['seq'] : [each['time'], saved, current] })\n\t\tif has_key(each, 'alt')\n\t\t\tcal extend(flatdict, s:flatten(each['alt'], a:cur))\n\t\ten\n\tendfo\n\tretu flatdict\nendf\n\nfu! s:elapsed(nr)\n\tlet [text, time] = [s:text, localtime() - a:nr]\n\tlet mins = time / 60\n\tlet hrs  = time / 3600\n\tlet days = time / 86400\n\tlet wks  = time / 604800\n\tlet mons = time / 2592000\n\tlet yrs  = time / 31536000\n\tif yrs > 1\n\t\tretu yrs.text[7]\n\telsei mons > 1\n\t\tretu mons.text[6]\n\telsei wks > 1\n\t\tretu wks.text[5]\n\telsei days > 1\n\t\tretu days.text[4]\n\telsei hrs > 1\n\t\tretu hrs.text[3]\n\telsei mins > 1\n\t\tretu mins.text[2]\n\telsei time == 1\n\t\tretu time.text[0]\n\telsei time < 120\n\t\tretu time.text[1]\n\ten\nendf\n\nfu! s:syntax()\n\tif ctrlp#nosy() | retu | en\n\tfor [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',\n\t\t\\ 'Sv': 'Comment', 'Po': 'Title'})\n\t\tcal ctrlp#hicheck('CtrlPUndo'.ke, va)\n\tendfo\n\tsy match CtrlPUndoT '\\v\\d+ \\zs[^ ]+\\ze|\\d+:\\d+:\\d+'\n\tsy match CtrlPUndoBr '\\[\\|\\]'\n\tsy match CtrlPUndoNr '\\[\\d\\+\\]' contains=CtrlPUndoBr\n\tsy match CtrlPUndoSv 'saved'\n\tsy match CtrlPUndoPo 'current'\nendf\n\nfu! s:dict2list(dict)\n\tfor ke in keys(a:dict)\n\t\tlet a:dict[ke][0] = s:elapsed(a:dict[ke][0])\n\tendfo\n\tretu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')')\nendf\n\nfu! s:compval(...)\n\tretu a:2[0] - a:1[0]\nendf\n\nfu! s:format(...)\n\tlet saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : ''\n\tlet current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : ''\n\tretu a:1[1][0].' ['.a:1[0].']'.saved.current\nendf\n\nfu! s:formatul(...)\n\tlet parts = matchlist(a:1,\n\t\t\\ '\\v^\\s+(\\d+)\\s+\\d+\\s+([^ ]+\\s?[^ ]+|\\d+\\s\\w+\\s\\w+)(\\s*\\d*)$')\n\tretu parts == [] ? '----'\n\t\t\\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )\nendf\n\" Public {{{1\nfu! ctrlp#undo#init()\n\tlet entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]\n\tif empty(entries) | retu [] | en\n\tif !exists('s:lines')\n\t\tif s:undos[0]\n\t\t\tlet entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))\n\t\t\tlet s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')\n\t\tel\n\t\t\tlet s:lines = map(reverse(entries), 's:formatul(v:val)')\n\t\ten\n\ten\n\tcal s:syntax()\n\tretu s:lines\nendf\n\nfu! ctrlp#undo#accept(mode, str)\n\tlet undon = matchstr(a:str, '\\[\\zs\\d\\+\\ze\\]')\n\tif empty(undon) | retu | en\n\tcal ctrlp#exit()\n\texe 'u' undon\nendf\n\nfu! ctrlp#undo#id()\n\tretu s:id\nendf\n\nfu! ctrlp#undo#enter()\n\tlet s:undos = s:getundo()\nendf\n\nfu! ctrlp#undo#exit()\n\tunl! s:lines\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp/utils.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp/utils.vim\n\" Description:   Utilities\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\n\" Static variables {{{1\nfu! ctrlp#utils#lash()\n\tretu &ssl || !exists('+ssl') ? '/' : '\\'\nendf\n\nfu! s:lash(...)\n\tretu ( a:0 ? a:1 : getcwd() ) !~ '[\\/]$' ? s:lash : ''\nendf\n\nfu! ctrlp#utils#opts()\n\tlet s:lash = ctrlp#utils#lash()\n\tlet usrhome = $HOME . s:lash( $HOME )\n\tlet cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'\n\tlet cadir = isdirectory(usrhome.'.ctrlp_cache')\n\t\t\\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'\n\tif exists('g:ctrlp_cache_dir')\n\t\tlet cadir = expand(g:ctrlp_cache_dir, 1)\n\t\tif isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')\n\t\t\tlet cadir = cadir.s:lash(cadir).'.ctrlp_cache'\n\t\ten\n\ten\n\tlet s:cache_dir = cadir\nendf\ncal ctrlp#utils#opts()\n\nlet s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )\n\" Files and Directories {{{1\nfu! ctrlp#utils#cachedir()\n\tretu s:cache_dir\nendf\n\nfu! ctrlp#utils#cachefile(...)\n\tlet [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]\n\tlet cache_file = substitute(dir, '\\([\\/]\\|^\\a\\zs:\\)', '%', 'g').tail.'.txt'\n\tretu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file\nendf\n\nfu! ctrlp#utils#readfile(file)\n\tif filereadable(a:file)\n\t\tlet data = readfile(a:file)\n\t\tif empty(data) || type(data) != 3\n\t\t\tunl data\n\t\t\tlet data = []\n\t\ten\n\t\tretu data\n\ten\n\tretu []\nendf\n\nfu! ctrlp#utils#mkdir(dir)\n\tif exists('*mkdir') && !isdirectory(a:dir)\n\t\tsil! cal mkdir(a:dir, 'p')\n\ten\n\tretu a:dir\nendf\n\nfu! ctrlp#utils#writecache(lines, ...)\n\tif isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))\n\t\tsil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())\n\ten\nendf\n\nfu! ctrlp#utils#glob(...)\n\tlet path = ctrlp#utils#fnesc(a:1, 'g')\n\tretu s:wig_cond ? glob(path, a:2) : glob(path)\nendf\n\nfu! ctrlp#utils#globpath(...)\n\tretu call('globpath', s:wig_cond ? a:000 : a:000[:1])\nendf\n\nfu! ctrlp#utils#fnesc(path, type, ...)\n\tif exists('*fnameescape')\n\t\tif exists('+ssl')\n\t\t\tif a:type == 'c'\n\t\t\t\tlet path = escape(a:path, '%#')\n\t\t\telsei a:type == 'f'\n\t\t\t\tlet path = fnameescape(a:path)\n\t\t\telsei a:type == 'g'\n\t\t\t\tlet path = escape(a:path, '?*')\n\t\t\ten\n\t\t\tlet path = substitute(path, '[', '[[]', 'g')\n\t\tel\n\t\t\tlet path = fnameescape(a:path)\n\t\ten\n\tel\n\t\tif exists('+ssl')\n\t\t\tif a:type == 'c'\n\t\t\t\tlet path = escape(a:path, '%#')\n\t\t\telsei a:type == 'f'\n\t\t\t\tlet path = escape(a:path, \" \\t\\n%#*?|<\\\"\")\n\t\t\telsei a:type == 'g'\n\t\t\t\tlet path = escape(a:path, '?*')\n\t\t\ten\n\t\t\tlet path = substitute(path, '[', '[[]', 'g')\n\t\tel\n\t\t\tlet path = escape(a:path, \" \\t\\n*?[{`$\\\\%#'\\\"|!<\")\n\t\ten\n\ten\n\tretu a:0 ? escape(path, a:1) : path\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "autoload/ctrlp.vim",
    "content": "\" =============================================================================\n\" File:          autoload/ctrlp.vim\n\" Description:   Fuzzy file, buffer, mru, tag, etc finder.\n\" Author:        Kien Nguyen <github.com/kien>\n\" Version:       1.79\n\" =============================================================================\n\n\" ** Static variables {{{1\n\" s:ignore() {{{2\nfu! s:ignore()\n\tlet igdirs = [\n\t\t\\ '\\.git',\n\t\t\\ '\\.hg',\n\t\t\\ '\\.svn',\n\t\t\\ '_darcs',\n\t\t\\ '\\.bzr',\n\t\t\\ '\\.cdv',\n\t\t\\ '\\~\\.dep',\n\t\t\\ '\\~\\.dot',\n\t\t\\ '\\~\\.nib',\n\t\t\\ '\\~\\.plst',\n\t\t\\ '\\.pc',\n\t\t\\ '_MTN',\n\t\t\\ 'blib',\n\t\t\\ 'CVS',\n\t\t\\ 'RCS',\n\t\t\\ 'SCCS',\n\t\t\\ '_sgbak',\n\t\t\\ 'autom4te\\.cache',\n\t\t\\ 'cover_db',\n\t\t\\ '_build',\n\t\t\\ ]\n\tlet igfiles = [\n\t\t\\ '\\~$',\n\t\t\\ '#.+#$',\n\t\t\\ '[._].*\\.swp$',\n\t\t\\ 'core\\.\\d+$',\n\t\t\\ '\\.exe$',\n\t\t\\ '\\.so$',\n\t\t\\ '\\.bak$',\n\t\t\\ '\\.png$',\n\t\t\\ '\\.jpg$',\n\t\t\\ '\\.gif$',\n\t\t\\ '\\.zip$',\n\t\t\\ '\\.rar$',\n\t\t\\ '\\.tar\\.gz$',\n\t\t\\ ]\n\tretu {\n\t\t\\ 'dir': '\\v[\\/]('.join(igdirs, '|').')$',\n\t\t\\ 'file': '\\v'.join(igfiles, '|'),\n\t\t\\ }\nendf\n\" Script local vars {{{2\nlet [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =\n\t\\ ['g:ctrlp_', 'b:ctrlp_', {\n\t\\ 'abbrev':                ['s:abbrev', {}],\n\t\\ 'arg_map':               ['s:argmap', 0],\n\t\\ 'buffer_func':           ['s:buffunc', {}],\n\t\\ 'by_filename':           ['s:byfname', 0],\n\t\\ 'custom_ignore':         ['s:usrign', s:ignore()],\n\t\\ 'default_input':         ['s:deftxt', 0],\n\t\\ 'dont_split':            ['s:nosplit', 'netrw'],\n\t\\ 'dotfiles':              ['s:showhidden', 0],\n\t\\ 'extensions':            ['s:extensions', []],\n\t\\ 'follow_symlinks':       ['s:folsym', 0],\n\t\\ 'highlight_match':       ['s:mathi', [1, 'CtrlPMatch']],\n\t\\ 'jump_to_buffer':        ['s:jmptobuf', 'Et'],\n\t\\ 'key_loop':              ['s:keyloop', 0],\n\t\\ 'lazy_update':           ['s:lazy', 0],\n\t\\ 'match_func':            ['s:matcher', {}],\n\t\\ 'match_window':          ['s:mw', ''],\n\t\\ 'match_window_bottom':   ['s:mwbottom', 1],\n\t\\ 'match_window_reversed': ['s:mwreverse', 1],\n\t\\ 'max_depth':             ['s:maxdepth', 40],\n\t\\ 'max_files':             ['s:maxfiles', 10000],\n\t\\ 'max_height':            ['s:mxheight', 10],\n\t\\ 'max_history':           ['s:maxhst', exists('+hi') ? &hi : 20],\n\t\\ 'mruf_default_order':    ['s:mrudef', 0],\n\t\\ 'open_func':             ['s:openfunc', {}],\n\t\\ 'open_multi':            ['s:opmul', '1v'],\n\t\\ 'open_new_file':         ['s:newfop', 'v'],\n\t\\ 'prompt_mappings':       ['s:urprtmaps', 0],\n\t\\ 'regexp_search':         ['s:regexp', 0],\n\t\\ 'root_markers':          ['s:rmarkers', []],\n\t\\ 'split_window':          ['s:splitwin', 0],\n\t\\ 'status_func':           ['s:status', {}],\n\t\\ 'tabpage_position':      ['s:tabpage', 'ac'],\n\t\\ 'use_caching':           ['s:caching', 1],\n\t\\ 'use_migemo':            ['s:migemo', 0],\n\t\\ 'user_command':          ['s:usrcmd', ''],\n\t\\ 'working_path_mode':     ['s:pathmode', 'ra'],\n\t\\ }, {\n\t\\ 'open_multiple_files':   's:opmul',\n\t\\ 'regexp':                's:regexp',\n\t\\ 'reuse_window':          's:nosplit',\n\t\\ 'show_hidden':           's:showhidden',\n\t\\ 'switch_buffer':         's:jmptobuf',\n\t\\ }, {\n\t\\ 'root_markers':          's:rmarkers',\n\t\\ 'user_command':          's:usrcmd',\n\t\\ 'working_path_mode':     's:pathmode',\n\t\\ }]\n\n\" Global options\nlet s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0,\n\t\\ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'ttimeout': 0,\n\t\\ 'gcr': 'a:blinkon0', 'ic': 1, 'lmap': '', 'mousef': 0, 'imd': 1 }\n\n\" Keymaps\nlet [s:lcmap, s:prtmaps] = ['nn <buffer> <silent>', {\n\t\\ 'PrtBS()':              ['<bs>', '<c-]>'],\n\t\\ 'PrtDelete()':          ['<del>'],\n\t\\ 'PrtDeleteWord()':      ['<c-w>'],\n\t\\ 'PrtClear()':           ['<c-u>'],\n\t\\ 'PrtSelectMove(\"j\")':   ['<c-j>', '<down>'],\n\t\\ 'PrtSelectMove(\"k\")':   ['<c-k>', '<up>'],\n\t\\ 'PrtSelectMove(\"t\")':   ['<Home>', '<kHome>'],\n\t\\ 'PrtSelectMove(\"b\")':   ['<End>', '<kEnd>'],\n\t\\ 'PrtSelectMove(\"u\")':   ['<PageUp>', '<kPageUp>'],\n\t\\ 'PrtSelectMove(\"d\")':   ['<PageDown>', '<kPageDown>'],\n\t\\ 'PrtHistory(-1)':       ['<c-n>'],\n\t\\ 'PrtHistory(1)':        ['<c-p>'],\n\t\\ 'AcceptSelection(\"e\")': ['<cr>', '<2-LeftMouse>'],\n\t\\ 'AcceptSelection(\"h\")': ['<c-x>', '<c-cr>', '<c-s>'],\n\t\\ 'AcceptSelection(\"t\")': ['<c-t>'],\n\t\\ 'AcceptSelection(\"v\")': ['<c-v>', '<RightMouse>'],\n\t\\ 'ToggleFocus()':        ['<s-tab>'],\n\t\\ 'ToggleRegex()':        ['<c-r>'],\n\t\\ 'ToggleByFname()':      ['<c-d>'],\n\t\\ 'ToggleType(1)':        ['<c-f>', '<c-up>'],\n\t\\ 'ToggleType(-1)':       ['<c-b>', '<c-down>'],\n\t\\ 'PrtExpandDir()':       ['<tab>'],\n\t\\ 'PrtInsert(\"c\")':       ['<MiddleMouse>', '<insert>'],\n\t\\ 'PrtInsert()':          ['<c-\\>'],\n\t\\ 'PrtCurStart()':        ['<c-a>'],\n\t\\ 'PrtCurEnd()':          ['<c-e>'],\n\t\\ 'PrtCurLeft()':         ['<c-h>', '<left>', '<c-^>'],\n\t\\ 'PrtCurRight()':        ['<c-l>', '<right>'],\n\t\\ 'PrtClearCache()':      ['<F5>'],\n\t\\ 'PrtDeleteEnt()':       ['<F7>'],\n\t\\ 'CreateNewFile()':      ['<c-y>'],\n\t\\ 'MarkToOpen()':         ['<c-z>'],\n\t\\ 'OpenMulti()':          ['<c-o>'],\n\t\\ 'PrtExit()':            ['<esc>', '<c-c>', '<c-g>'],\n\t\\ }]\n\nif !has('gui_running')\n\tcal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0))\nen\n\nlet s:compare_lim = 3000\n\nlet s:ficounts = {}\n\nlet s:ccex = s:pref.'clear_cache_on_exit'\n\n\" Regexp\nlet s:fpats = {\n\t\\ '^\\(\\\\|\\)\\|\\(\\\\|\\)$': '\\\\|',\n\t\\ '^\\\\\\(zs\\|ze\\|<\\|>\\)': '^\\\\\\(zs\\|ze\\|<\\|>\\)',\n\t\\ '^\\S\\*$': '\\*',\n\t\\ '^\\S\\\\?$': '\\\\?',\n\t\\ }\n\n\" Keypad\nlet s:kprange = {\n\t\\ 'Plus': '+',\n\t\\ 'Minus': '-',\n\t\\ 'Divide': '/',\n\t\\ 'Multiply': '*',\n\t\\ 'Point': '.',\n\t\\ }\n\n\" Highlight groups\nlet s:hlgrps = {\n\t\\ 'NoEntries': 'Error',\n\t\\ 'Mode1': 'Character',\n\t\\ 'Mode2': 'LineNr',\n\t\\ 'Stats': 'Function',\n\t\\ 'Match': 'Identifier',\n\t\\ 'PrtBase': 'Comment',\n\t\\ 'PrtText': 'Normal',\n\t\\ 'PrtCursor': 'Constant',\n\t\\ }\n\" Get the options {{{2\nfu! s:opts(...)\n\tunl! s:usrign s:usrcmd s:urprtmaps\n\tfor each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each)\n\t\tlet {each} = s:{each}\n\ten | endfo\n\tfor [ke, va] in items(s:opts)\n\t\tlet {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]\n\tendfo\n\tunl va\n\tfor [ke, va] in items(s:new_opts)\n\t\tlet {va} = {exists(s:pref.ke) ? s:pref.ke : va}\n\tendfo\n\tunl va\n\tfor [ke, va] in items(s:lc_opts)\n\t\tif exists(s:bpref.ke)\n\t\t\tunl {va}\n\t\t\tlet {va} = {s:bpref.ke}\n\t\ten\n\tendfo\n\t\" Match window options\n\tcal s:match_window_opts()\n\t\" One-time values\n\tif a:0 && a:1 != {}\n\t\tunl va\n\t\tfor [ke, va] in items(a:1)\n\t\t\tlet opke = substitute(ke, '\\(\\w:\\)\\?ctrlp_', '', '')\n\t\t\tif has_key(s:lc_opts, opke)\n\t\t\t\tlet sva = s:lc_opts[opke]\n\t\t\t\tunl {sva}\n\t\t\t\tlet {sva} = va\n\t\t\ten\n\t\tendfo\n\ten\n\tfor each in ['byfname', 'regexp'] | if exists(each)\n\t\tlet s:{each} = {each}\n\ten | endfo\n\tif !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en\n\tlet s:maxdepth = min([s:maxdepth, 100])\n\tlet s:glob = s:showhidden ? '.*\\|*' : '*'\n\tlet s:igntype = empty(s:usrign) ? -1 : type(s:usrign)\n\tlet s:lash = ctrlp#utils#lash()\n\tif s:keyloop\n\t\tlet [s:lazy, s:glbs['imd']] = [0, 0]\n\ten\n\tif s:lazy\n\t\tcal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) })\n\ten\n\t\" Extensions\n\tif !( exists('extensions') && extensions == s:extensions )\n\t\tfor each in s:extensions\n\t\t\texe 'ru autoload/ctrlp/'.each.'.vim'\n\t\tendfo\n\ten\n\t\" Keymaps\n\tif type(s:urprtmaps) == 4\n\t\tcal extend(s:prtmaps, s:urprtmaps)\n\ten\nendf\n\nfu! s:match_window_opts()\n\tlet s:mw_pos =\n\t\t\\ s:mw =~ 'top\\|bottom' ? matchstr(s:mw, 'top\\|bottom') :\n\t\t\\ exists('g:ctrlp_match_window_bottom') ? ( s:mwbottom ? 'bottom' : 'top' )\n\t\t\\ : 'bottom'\n\tlet s:mw_order =\n\t\t\\ s:mw =~ 'order:[^,]\\+' ? matchstr(s:mw, 'order:\\zs[^,]\\+') :\n\t\t\\ exists('g:ctrlp_match_window_reversed') ? ( s:mwreverse ? 'btt' : 'ttb' )\n\t\t\\ : 'btt'\n\tlet s:mw_max =\n\t\t\\ s:mw =~ 'max:[^,]\\+' ? str2nr(matchstr(s:mw, 'max:\\zs\\d\\+')) :\n\t\t\\ exists('g:ctrlp_max_height') ? s:mxheight\n\t\t\\ : 10\n\tlet s:mw_min =\n\t\t\\ s:mw =~ 'min:[^,]\\+' ? str2nr(matchstr(s:mw, 'min:\\zs\\d\\+')) : 1\n\tlet [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])]\n\tlet s:mw_min = min([s:mw_min, s:mw_max])\n\tlet s:mw_res =\n\t\t\\ s:mw =~ 'results:[^,]\\+' ? str2nr(matchstr(s:mw, 'results:\\zs\\d\\+'))\n\t\t\\ : min([s:mw_max, &lines])\n\tlet s:mw_res = max([s:mw_res, 1])\nendf\n\"}}}1\n\" * Open & Close {{{1\nfu! s:Open()\n\tcal s:log(1)\n\tcal s:getenv()\n\tcal s:execextvar('enter')\n\tsil! exe 'keepa' ( s:mw_pos == 'top' ? 'to' : 'bo' ) '1new ControlP'\n\tcal s:buffunc(1)\n\tlet [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)]\n\tlet [s:focus, s:prompt] = [1, ['', '', '']]\n\tabc <buffer>\n\tif !exists('s:hstry')\n\t\tlet hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : ['']\n\t\tlet s:hstry = empty(hst) || !s:maxhst ? [''] : hst\n\ten\n\tfor [ke, va] in items(s:glbs) | if exists('+'.ke)\n\t\tsil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va)\n\ten | endfo\n\tif s:opmul != '0' && has('signs')\n\t\tsign define ctrlpmark text=+> texthl=Search\n\ten\n\tcal s:setupblank()\nendf\n\nfu! s:Close()\n\tcal s:buffunc(0)\n\tif winnr('$') == 1\n\t\tbw!\n\tel\n\t\ttry | bun!\n\t\tcat | clo! | endt\n\t\tcal s:unmarksigns()\n\ten\n\tfor key in keys(s:glbs) | if exists('+'.key)\n\t\tsil! exe 'let &'.key.' = s:glb_'.key\n\ten | endfo\n\tif exists('s:glb_acd') | let &acd = s:glb_acd | en\n\tlet g:ctrlp_lines = []\n\tif s:winres[1] >= &lines && s:winres[2] == winnr('$')\n\t\texe s:winres[0].s:winres[0]\n\ten\n\tunl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr\n\t\t\\ s:mrbs s:did_exp\n\tcal ctrlp#recordhist()\n\tcal s:execextvar('exit')\n\tcal s:log(0)\n\tlet v:errmsg = s:ermsg\n\tec\nendf\n\" * Clear caches {{{1\nfu! ctrlp#clr(...)\n\tlet [s:matches, g:ctrlp_new{ a:0 ? a:1 : 'cache' }] = [1, 1]\nendf\n\nfu! ctrlp#clra()\n\tlet cadir = ctrlp#utils#cachedir()\n\tif isdirectory(cadir)\n\t\tlet cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), \"\\n\")\n\t\tlet eval = '!isdirectory(v:val) && v:val !~ ''\\v[\\/]cache[.a-z]+$|\\.log$'''\n\t\tsil! cal map(s:ifilter(cafiles, eval), 'delete(v:val)')\n\ten\n\tcal ctrlp#clr()\nendf\n\nfu! s:Reset(args)\n\tlet opts = has_key(a:args, 'opts') ? [a:args['opts']] : []\n\tcal call('s:opts', opts)\n\tcal s:autocmds()\n\tcal ctrlp#utils#opts()\n\tcal s:execextvar('opts')\nendf\n\" * Files {{{1\nfu! ctrlp#files()\n\tlet cafile = ctrlp#utils#cachefile()\n\tif g:ctrlp_newcache || !filereadable(cafile) || s:nocache(cafile)\n\t\tlet [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []]\n\t\t\" Get the list of files\n\t\tif empty(lscmd)\n\t\t\tif !ctrlp#igncwd(s:dyncwd)\n\t\t\t\tcal s:GlobPath(s:fnesc(s:dyncwd, 'g', ','), 0)\n\t\t\ten\n\t\tel\n\t\t\tsil! cal ctrlp#progress('Indexing...')\n\t\t\ttry | cal s:UserCmd(lscmd)\n\t\t\tcat | retu [] | endt\n\t\ten\n\t\t\" Remove base directory\n\t\tcal ctrlp#rmbasedir(g:ctrlp_allfiles)\n\t\tif len(g:ctrlp_allfiles) <= s:compare_lim\n\t\t\tcal sort(g:ctrlp_allfiles, 'ctrlp#complen')\n\t\ten\n\t\tcal s:writecache(cafile)\n\t\tlet catime = getftime(cafile)\n\tel\n\t\tlet catime = getftime(cafile)\n\t\tif !( exists('s:initcwd') && s:initcwd == s:dyncwd )\n\t\t\t\\ || get(s:ficounts, s:dyncwd, [0, catime])[1] != catime\n\t\t\tlet s:initcwd = s:dyncwd\n\t\t\tlet g:ctrlp_allfiles = ctrlp#utils#readfile(cafile)\n\t\ten\n\ten\n\tcal extend(s:ficounts, { s:dyncwd : [len(g:ctrlp_allfiles), catime] })\n\tretu g:ctrlp_allfiles\nendf\n\nfu! s:GlobPath(dirs, depth)\n\tlet entries = split(globpath(a:dirs, s:glob), \"\\n\")\n\tlet [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1]\n\tcal extend(g:ctrlp_allfiles, dnf[1])\n\tif !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth\n\t\tsil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1)\n\t\tcal s:GlobPath(join(map(dnf[0], 's:fnesc(v:val, \"g\", \",\")'), ','), depth)\n\ten\nendf\n\nfu! s:UserCmd(lscmd)\n\tlet [path, lscmd] = [s:dyncwd, a:lscmd]\n\tlet do_ign =\n\t\t\\ type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore']\n\tif do_ign && ctrlp#igncwd(s:cwd) | retu | en\n\tif exists('+ssl') && &ssl\n\t\tlet [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\\')]\n\ten\n\tif has('win32') || has('win64')\n\t\tlet lscmd = substitute(lscmd, '\\v(^|\\&\\&\\s*)\\zscd (/d)@!', 'cd /d ', '')\n\ten\n\tlet path = exists('*shellescape') ? shellescape(path) : path\n\tlet g:ctrlp_allfiles = split(system(printf(lscmd, path)), \"\\n\")\n\tif exists('+ssl') && exists('ssl')\n\t\tlet &ssl = ssl\n\t\tcal map(g:ctrlp_allfiles, 'tr(v:val, \"\\\\\", \"/\")')\n\ten\n\tif exists('s:vcscmd') && s:vcscmd\n\t\tcal map(g:ctrlp_allfiles, 'tr(v:val, \"/\", \"\\\\\")')\n\ten\n\tif do_ign\n\t\tif !empty(s:usrign)\n\t\t\tlet g:ctrlp_allfiles = ctrlp#dirnfile(g:ctrlp_allfiles)[1]\n\t\ten\n\t\tif &wig != ''\n\t\t\tcal filter(g:ctrlp_allfiles, 'glob(v:val) != \"\"')\n\t\ten\n\ten\nendf\n\nfu! s:lsCmd()\n\tlet cmd = s:usrcmd\n\tif type(cmd) == 1\n\t\tretu cmd\n\telsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', '']\n\t\tif s:findroot(s:dyncwd, cmd[0], 0, 1) == []\n\t\t\tretu len(cmd) == 3 ? cmd[2] : ''\n\t\ten\n\t\tlet s:vcscmd = s:lash == '\\'\n\t\tretu cmd[1]\n\telsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') )\n\t\tlet fndroot = []\n\t\tif has_key(cmd, 'types') && cmd['types'] != {}\n\t\t\tlet [markrs, cmdtypes] = [[], values(cmd['types'])]\n\t\t\tfor pair in cmdtypes\n\t\t\t\tcal add(markrs, pair[0])\n\t\t\tendfo\n\t\t\tlet fndroot = s:findroot(s:dyncwd, markrs, 0, 1)\n\t\ten\n\t\tif fndroot == []\n\t\t\tretu has_key(cmd, 'fallback') ? cmd['fallback'] : ''\n\t\ten\n\t\tfor pair in cmdtypes\n\t\t\tif pair[0] == fndroot[0] | brea | en\n\t\tendfo\n\t\tlet s:vcscmd = s:lash == '\\'\n\t\tretu pair[1]\n\ten\nendf\n\" - Buffers {{{1\nfu! ctrlp#buffers(...)\n\tlet ids = sort(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, \"&bt\"))'\n\t\t\\ .' && getbufvar(v:val, \"&bl\")'), 's:compmreb')\n\tif a:0 && a:1 == 'id'\n\t\tretu ids\n\tel\n\t\tlet bufs = [[], []]\n\t\tfor id in ids\n\t\t\tlet bname = bufname(id)\n\t\t\tlet ebname = bname == ''\n\t\t\tlet fname = fnamemodify(ebname ? '['.id.'*No Name]' : bname, ':.')\n\t\t\tcal add(bufs[ebname], fname)\n\t\tendfo\n\t\tretu bufs[0] + bufs[1]\n\ten\nendf\n\" * MatchedItems() {{{1\nfu! s:MatchIt(items, pat, limit, exc)\n\tlet [lines, id] = [[], 0]\n\tlet pat =\n\t\t\\ s:byfname() ? map(split(a:pat, '^[^;]\\+\\\\\\@<!\\zs;', 1), 's:martcs.v:val')\n\t\t\\ : s:martcs.a:pat\n\tfor item in a:items\n\t\tlet id += 1\n\t\ttry | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0\n\t\t\tcal add(lines, item)\n\t\ten | cat | brea | endt\n\t\tif a:limit > 0 && len(lines) >= a:limit | brea | en\n\tendfo\n\tlet s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)]\n\tretu lines\nendf\n\nfu! s:MatchedItems(items, pat, limit)\n\tlet exc = exists('s:crfilerel') ? s:crfilerel : ''\n\tlet items = s:narrowable() ? s:matched + s:mdata[3] : a:items\n\tif s:matcher != {}\n\t\tlet argms =\n\t\t\t\\ has_key(s:matcher, 'arg_type') && s:matcher['arg_type'] == 'dict' ? [{\n\t\t\t\\ 'items':  items,\n\t\t\t\\ 'str':    a:pat,\n\t\t\t\\ 'limit':  a:limit,\n\t\t\t\\ 'mmode':  s:mmode(),\n\t\t\t\\ 'ispath': s:ispath,\n\t\t\t\\ 'crfile': exc,\n\t\t\t\\ 'regex':  s:regexp,\n\t\t\t\\ }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp]\n\t\tlet lines = call(s:matcher['match'], argms, s:matcher)\n\tel\n\t\tlet lines = s:MatchIt(items, a:pat, a:limit, exc)\n\ten\n\tlet s:matches = len(lines)\n\tunl! s:did_exp\n\tretu lines\nendf\n\nfu! s:SplitPattern(str)\n\tlet str = a:str\n\tif s:migemo && s:regexp && len(str) > 0 && executable('cmigemo')\n\t\tlet str = s:migemo(str)\n\ten\n\tlet s:savestr = str\n\tif s:regexp\n\t\tlet pat = s:regexfilter(str)\n\tel\n\t\tlet lst = split(str, '\\zs')\n\t\tif exists('+ssl') && !&ssl\n\t\t\tcal map(lst, 'escape(v:val, ''\\'')')\n\t\ten\n\t\tfor each in ['^', '$', '.']\n\t\t\tcal map(lst, 'escape(v:val, each)')\n\t\tendfo\n\ten\n\tif exists('lst')\n\t\tlet pat = ''\n\t\tif !empty(lst)\n\t\t\tif s:byfname() && index(lst, ';') > 0\n\t\t\t\tlet fbar = index(lst, ';')\n\t\t\t\tlet lst_1 = s:sublist(lst, 0, fbar - 1)\n\t\t\t\tlet lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : ['']\n\t\t\t\tlet pat = s:buildpat(lst_1).';'.s:buildpat(lst_2)\n\t\t\tel\n\t\t\t\tlet pat = s:buildpat(lst)\n\t\t\ten\n\t\ten\n\ten\n\tretu escape(pat, '~')\nendf\n\" * BuildPrompt() {{{1\nfu! s:Render(lines, pat)\n\tlet [&ma, lines, s:res_count] = [1, a:lines, len(a:lines)]\n\tlet height = min([max([s:mw_min, s:res_count]), s:winmaxh])\n\tlet pat = s:byfname() ? split(a:pat, '^[^;]\\+\\\\\\@<!\\zs;', 1)[0] : a:pat\n\tlet cur_cmd = 'keepj norm! '.( s:mw_order == 'btt' ? 'G' : 'gg' ).'1|'\n\t\" Setup the match window\n\tsil! exe '%d _ | res' height\n\t\" Print the new items\n\tif empty(lines)\n\t\tlet [s:matched, s:lines] = [[], []]\n\t\tlet lines = [' == NO ENTRIES ==']\n\t\tcal setline(1, s:offset(lines, height - 1))\n\t\tsetl noma nocul\n\t\texe cur_cmd\n\t\tcal s:unmarksigns()\n\t\tif s:dohighlight() | cal clearmatches() | en\n\t\tretu\n\ten\n\tlet s:matched = copy(lines)\n\t\" Sorting\n\tif !s:nosort()\n\t\tlet s:compat = s:martcs.pat\n\t\tcal sort(lines, 's:mixedsort')\n\t\tunl s:compat\n\ten\n\tif s:mw_order == 'btt' | cal reverse(lines) | en\n\tlet s:lines = copy(lines)\n\tcal map(lines, 's:formatline(v:val)')\n\tcal setline(1, s:offset(lines, height))\n\tsetl noma cul\n\texe cur_cmd\n\tcal s:unmarksigns()\n\tcal s:remarksigns()\n\tif exists('s:cline') && s:nolim != 1\n\t\tcal cursor(s:cline, 1)\n\ten\n\t\" Highlighting\n\tif s:dohighlight()\n\t\tcal s:highlight(pat, s:mathi[1])\n\ten\nendf\n\nfu! s:Update(str)\n\t\" Get the previous string if existed\n\tlet oldstr = exists('s:savestr') ? s:savestr : ''\n\t\" Get the new string sans tail\n\tlet str = s:sanstail(a:str)\n\t\" Stop if the string's unchanged\n\tif str == oldstr && !empty(str) && !exists('s:force') | retu | en\n\tlet s:martcs = &scs && str =~ '\\u' ? '\\C' : ''\n\tlet pat = s:matcher == {} ? s:SplitPattern(str) : str\n\tlet lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines)\n\t\t\\ : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res)\n\tcal s:Render(lines, pat)\nendf\n\nfu! s:ForceUpdate()\n\tsil! cal s:Update(escape(s:getinput(), '\\'))\nendf\n\nfu! s:BuildPrompt(upd)\n\tlet base = ( s:regexp ? 'r' : '>' ).( s:byfname() ? 'd' : '>' ).'> '\n\tlet str = escape(s:getinput(), '\\')\n\tlet lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy\n\tif a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp')\n\t\t\\ || str =~ '\\(\\\\\\(<\\|>\\)\\|[*|]\\)\\|\\(\\\\\\:\\([^:]\\|\\\\:\\)*$\\)' )\n\t\tsil! cal s:Update(str)\n\ten\n\tsil! cal ctrlp#statusline()\n\t\" Toggling\n\tlet [hiactive, hicursor, base] = s:focus\n\t\t\\ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base]\n\t\t\\ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')]\n\tlet hibase = 'CtrlPPrtBase'\n\t\" Build it\n\tredr\n\tlet prt = copy(s:prompt)\n\tcal map(prt, 'escape(v:val, ''\"\\'')')\n\texe 'echoh' hibase '| echon \"'.base.'\"\n\t\t\\ | echoh' hiactive '| echon \"'.prt[0].'\"\n\t\t\\ | echoh' hicursor '| echon \"'.prt[1].'\"\n\t\t\\ | echoh' hiactive '| echon \"'.prt[2].'\" | echoh None'\n\t\" Append the cursor at the end\n\tif empty(prt[1]) && s:focus\n\t\texe 'echoh' hibase '| echon \"_\" | echoh None'\n\ten\nendf\n\" - SetDefTxt() {{{1\nfu! s:SetDefTxt()\n\tif s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en\n\tlet txt = s:deftxt\n\tif !type(txt)\n\t\tlet path = s:crfpath.s:lash(s:crfpath)\n\t\tlet txt = txt && !stridx(path, s:dyncwd) ? ctrlp#rmbasedir([path])[0] : ''\n\ten\n\tlet s:prompt[0] = txt\nendf\n\" ** Prt Actions {{{1\n\" Editing {{{2\nfu! s:PrtClear()\n\tif !s:focus | retu | en\n\tunl! s:hstgot\n\tlet [s:prompt, s:matches] = [['', '', ''], 1]\n\tcal s:BuildPrompt(1)\nendf\n\nfu! s:PrtAdd(char)\n\tunl! s:hstgot\n\tlet s:act_add = 1\n\tlet s:prompt[0] .= a:char\n\tcal s:BuildPrompt(1)\n\tunl s:act_add\nendf\n\nfu! s:PrtBS()\n\tif !s:focus | retu | en\n\tunl! s:hstgot\n\tlet [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1]\n\tcal s:BuildPrompt(1)\nendf\n\nfu! s:PrtDelete()\n\tif !s:focus | retu | en\n\tunl! s:hstgot\n\tlet [prt, s:matches] = [s:prompt, 1]\n\tlet prt[1] = matchstr(prt[2], '^.')\n\tlet prt[2] = substitute(prt[2], '^.', '', '')\n\tcal s:BuildPrompt(1)\nendf\n\nfu! s:PrtDeleteWord()\n\tif !s:focus | retu | en\n\tunl! s:hstgot\n\tlet [str, s:matches] = [s:prompt[0], 1]\n\tlet str = str =~ '\\W\\w\\+$' ? matchstr(str, '^.\\+\\W\\ze\\w\\+$')\n\t\t\\ : str =~ '\\w\\W\\+$' ? matchstr(str, '^.\\+\\w\\ze\\W\\+$')\n\t\t\\ : str =~ '\\s\\+$' ? matchstr(str, '^.*\\S\\ze\\s\\+$')\n\t\t\\ : str =~ '\\v^(\\S+|\\s+)$' ? '' : str\n\tlet s:prompt[0] = str\n\tcal s:BuildPrompt(1)\nendf\n\nfu! s:PrtInsert(...)\n\tif !s:focus | retu | en\n\tlet type = !a:0 ? '' : a:1\n\tif !a:0\n\t\tlet type = s:insertstr()\n\t\tif type == 'cancel' | retu | en\n\ten\n\tif type ==# 'r'\n\t\tlet regcont = s:getregs()\n\t\tif regcont < 0 | retu | en\n\ten\n\tunl! s:hstgot\n\tlet s:act_add = 1\n\tlet s:prompt[0] .= type ==# 'w' ? s:crword\n\t\t\\ : type ==# 'f' ? s:crgfile\n\t\t\\ : type ==# 's' ? s:regisfilter('/')\n\t\t\\ : type ==# 'v' ? s:crvisual\n\t\t\\ : type ==# 'c' ? s:regisfilter('+')\n\t\t\\ : type ==# 'r' ? regcont : ''\n\tcal s:BuildPrompt(1)\n\tunl s:act_add\nendf\n\nfu! s:PrtExpandDir()\n\tif !s:focus | retu | en\n\tlet str = s:getinput('c')\n\tif str =~ '\\v^\\@(cd|lc[hd]?|chd)\\s.+' && s:spi\n\t\tlet hasat = split(str, '\\v^\\@(cd|lc[hd]?|chd)\\s*\\zs')\n\t\tlet str = get(hasat, 1, '')\n\t\tif str =~# '\\v^[~$]\\i{-}[\\/]?|^#(\\<?\\d+)?:(p|h|8|\\~|\\.|g?s+)'\n\t\t\tlet str = expand(s:fnesc(str, 'g'))\n\t\telsei str =~# '\\v^(\\%|\\<c\\h{4}\\>):(p|h|8|\\~|\\.|g?s+)'\n\t\t\tlet spc = str =~# '^%' ? s:crfile\n\t\t\t\t\\ : str =~# '^<cfile>' ? s:crgfile\n\t\t\t\t\\ : str =~# '^<cword>' ? s:crword\n\t\t\t\t\\ : str =~# '^<cWORD>' ? s:crnbword : ''\n\t\t\tlet pat = '(:(p|h|8|\\~|\\.|g?s(.)[^\\3]*\\3[^\\3]*\\3))+'\n\t\t\tlet mdr = matchstr(str, '\\v^[^:]+\\zs'.pat)\n\t\t\tlet nmd = matchstr(str, '\\v^[^:]+'.pat.'\\zs.{-}$')\n\t\t\tlet str = fnamemodify(s:fnesc(spc, 'g'), mdr).nmd\n\t\ten\n\ten\n\tif str == '' | retu | en\n\tunl! s:hstgot\n\tlet s:act_add = 1\n\tlet [base, seed] = s:headntail(str)\n\tif str =~# '^[\\/]'\n\t\tlet base = expand('/').base\n\ten\n\tlet dirs = s:dircompl(base, seed)\n\tif len(dirs) == 1\n\t\tlet str = dirs[0]\n\telsei len(dirs) > 1\n\t\tlet str .= s:findcommon(dirs, str)\n\ten\n\tlet s:prompt[0] = exists('hasat') ? hasat[0].str : str\n\tcal s:BuildPrompt(1)\n\tunl s:act_add\nendf\n\" Movement {{{2\nfu! s:PrtCurLeft()\n\tif !s:focus | retu | en\n\tlet prt = s:prompt\n\tif !empty(prt[0])\n\t\tlet s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'),\n\t\t\t\\ prt[1] . prt[2]]\n\ten\n\tcal s:BuildPrompt(0)\nendf\n\nfu! s:PrtCurRight()\n\tif !s:focus | retu | en\n\tlet prt = s:prompt\n\tlet s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'),\n\t\t\\ substitute(prt[2], '^.', '', '')]\n\tcal s:BuildPrompt(0)\nendf\n\nfu! s:PrtCurStart()\n\tif !s:focus | retu | en\n\tlet str = join(s:prompt, '')\n\tlet s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')]\n\tcal s:BuildPrompt(0)\nendf\n\nfu! s:PrtCurEnd()\n\tif !s:focus | retu | en\n\tlet s:prompt = [join(s:prompt, ''), '', '']\n\tcal s:BuildPrompt(0)\nendf\n\nfu! s:PrtSelectMove(dir)\n\tlet wht = winheight(0)\n\tlet dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}\n\texe 'keepj norm!' dirs[a:dir]\n\tif s:nolim != 1 | let s:cline = line('.') | en\n\tif line('$') > winheight(0) | cal s:BuildPrompt(0) | en\nendf\n\nfu! s:PrtSelectJump(char)\n\tlet lines = copy(s:lines)\n\tif s:byfname()\n\t\tcal map(lines, 'split(v:val, ''[\\/]\\ze[^\\/]\\+$'')[-1]')\n\ten\n\t\" Cycle through matches, use s:jmpchr to store last jump\n\tlet chr = escape(matchstr(a:char, '^.'), '.~')\n\tlet smartcs = &scs && chr =~ '\\u' ? '\\C' : ''\n\tif match(lines, smartcs.'^'.chr) >= 0\n\t\t\" If not exists or does but not for the same char\n\t\tlet pos = match(lines, smartcs.'^'.chr)\n\t\tif !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr )\n\t\t\tlet [jmpln, s:jmpchr] = [pos, [chr, pos]]\n\t\telsei exists('s:jmpchr') && s:jmpchr[0] == chr\n\t\t\t\" Start of lines\n\t\t\tif s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en\n\t\t\tlet npos = match(lines, smartcs.'^'.chr, s:jmpchr[1] + 1)\n\t\t\tlet [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]\n\t\ten\n\t\texe 'keepj norm!' ( jmpln + 1 ).'G'\n\t\tif s:nolim != 1 | let s:cline = line('.') | en\n\t\tif line('$') > winheight(0) | cal s:BuildPrompt(0) | en\n\ten\nendf\n\" Misc {{{2\nfu! s:PrtFocusMap(char)\n\tcal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char])\nendf\n\nfu! s:PrtClearCache()\n\tif s:itemtype == 0\n\t\tcal ctrlp#clr()\n\telsei s:itemtype > 2\n\t\tcal ctrlp#clr(s:statypes[s:itemtype][1])\n\ten\n\tif s:itemtype == 2\n\t\tlet g:ctrlp_lines = ctrlp#mrufiles#refresh()\n\tel\n\t\tcal ctrlp#setlines()\n\ten\n\tlet s:force = 1\n\tcal s:BuildPrompt(1)\n\tunl s:force\nendf\n\nfu! s:PrtDeleteEnt()\n\tif s:itemtype == 2\n\t\tcal s:PrtDeleteMRU()\n\telsei type(s:getextvar('wipe')) == 1\n\t\tcal s:delent(s:getextvar('wipe'))\n\ten\nendf\n\nfu! s:PrtDeleteMRU()\n\tif s:itemtype == 2\n\t\tcal s:delent('ctrlp#mrufiles#remove')\n\ten\nendf\n\nfu! s:PrtExit()\n\tif bufnr('%') == s:bufnr && bufname('%') == 'ControlP'\n\t\tnoa cal s:Close()\n\t\tnoa winc p\n\ten\nendf\n\nfu! s:PrtHistory(...)\n\tif !s:focus || !s:maxhst | retu | en\n\tlet [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1]\n\t\" Save to history if not saved before\n\tlet [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)]\n\tlet idx = exists('s:hisidx') ? s:hisidx + a:1 : a:1\n\t\" Limit idx within 0 and hslen\n\tlet idx = idx < 0 ? 0 : idx >= hslen ? hslen > 1 ? hslen - 1 : 0 : idx\n\tlet s:prompt = [hst[idx], '', '']\n\tlet [s:hisidx, s:hstgot, s:force] = [idx, 1, 1]\n\tcal s:BuildPrompt(1)\n\tunl s:force\nendf\n\"}}}1\n\" * Mappings {{{1\nfu! s:MapNorms()\n\tif exists('s:nmapped') && s:nmapped == s:bufnr | retu | en\n\tlet pcmd = \"nn \\<buffer> \\<silent> \\<k%s> :\\<c-u>cal \\<SID>%s(\\\"%s\\\")\\<cr>\"\n\tlet cmd = substitute(pcmd, 'k%s', 'char-%d', '')\n\tlet pfunc = 'PrtFocusMap'\n\tlet ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123)\n\tfor each in [34, 92, 124]\n\t\texe printf(cmd, each, pfunc, escape(nr2char(each), '\"|\\'))\n\tendfo\n\tfor each in ranges\n\t\texe printf(cmd, each, pfunc, nr2char(each))\n\tendfo\n\tfor each in range(0, 9)\n\t\texe printf(pcmd, each, pfunc, each)\n\tendfo\n\tfor [ke, va] in items(s:kprange)\n\t\texe printf(pcmd, ke, pfunc, va)\n\tendfo\n\tlet s:nmapped = s:bufnr\nendf\n\nfu! s:MapSpecs()\n\tif !( exists('s:smapped') && s:smapped == s:bufnr )\n\t\t\" Correct arrow keys in terminal\n\t\tif ( has('termresponse') && v:termresponse =~ \"\\<ESC>\" )\n\t\t\t\\ || &term =~? '\\vxterm|<k?vt|gnome|screen|linux|ansi'\n\t\t\tfor each in ['\\A <up>','\\B <down>','\\C <right>','\\D <left>']\n\t\t\t\texe s:lcmap.' <esc>['.each\n\t\t\tendfo\n\t\ten\n\ten\n\tfor [ke, va] in items(s:prtmaps) | for kp in va\n\t\texe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>'\n\tendfo | endfo\n\tlet s:smapped = s:bufnr\nendf\n\nfu! s:KeyLoop()\n\twh exists('s:init') && s:keyloop\n\t\tredr\n\t\tlet nr = getchar()\n\t\tlet chr = !type(nr) ? nr2char(nr) : nr\n\t\tif nr >=# 0x20\n\t\t\tcal s:PrtFocusMap(chr)\n\t\tel\n\t\t\tlet cmd = matchstr(maparg(chr), ':<C-U>\\zs.\\+\\ze<CR>$')\n\t\t\texe ( cmd != '' ? cmd : 'norm '.chr )\n\t\ten\n\tendw\nendf\n\" * Toggling {{{1\nfu! s:ToggleFocus()\n\tlet s:focus = !s:focus\n\tcal s:BuildPrompt(0)\nendf\n\nfu! s:ToggleRegex()\n\tlet s:regexp = !s:regexp\n\tcal s:PrtSwitcher()\nendf\n\nfu! s:ToggleByFname()\n\tif s:ispath\n\t\tlet s:byfname = !s:byfname\n\t\tlet s:mfunc = s:mfunc()\n\t\tcal s:PrtSwitcher()\n\ten\nendf\n\nfu! s:ToggleType(dir)\n\tlet max = len(g:ctrlp_ext_vars) + 2\n\tlet next = s:walker(max, s:itemtype, a:dir)\n\tcal ctrlp#syntax()\n\tcal ctrlp#setlines(next)\n\tcal s:PrtSwitcher()\nendf\n\nfu! s:ToggleKeyLoop()\n\tlet s:keyloop = !s:keyloop\n\tif exists('+imd')\n\t\tlet &imd = !s:keyloop\n\ten\n\tif s:keyloop\n\t\tlet [&ut, s:lazy] = [0, 0]\n\t\tcal s:KeyLoop()\n\telsei has_key(s:glbs, 'ut')\n\t\tlet [&ut, s:lazy] = [s:glbs['ut'], 1]\n\ten\nendf\n\nfu! s:ToggleMRURelative()\n\tcal ctrlp#mrufiles#tgrel()\n\tcal s:PrtClearCache()\nendf\n\nfu! s:PrtSwitcher()\n\tlet [s:force, s:matches] = [1, 1]\n\tcal s:BuildPrompt(1)\n\tunl s:force\nendf\n\" - SetWD() {{{1\nfu! s:SetWD(args)\n\tif has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0\n\t\t\\ && exists('s:dyncwd')\n\t\tcal ctrlp#setdir(s:dyncwd) | retu\n\ten\n\tif has_key(a:args, 'dir') && a:args['dir'] != ''\n\t\tcal ctrlp#setdir(a:args['dir']) | retu\n\ten\n\tlet pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode\n\tlet [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]\n\tif s:crfile =~ '^.\\+://' | retu | en\n\tif pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 )\n\t\t\\ || ( !type(pmode) && pmode )\n\t\tif exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en\n\t\tcal ctrlp#setdir(s:crfpath)\n\ten\n\tif pmode =~ 'r' || pmode == 2\n\t\tlet markers = ['.git', '.hg', '.svn', '.bzr', '_darcs']\n\t\tlet spath = pmode =~ 'd' ? s:dyncwd : pmode =~ 'w' ? s:cwd : s:crfpath\n\t\tif type(s:rmarkers) == 3 && !empty(s:rmarkers)\n\t\t\tif s:findroot(spath, s:rmarkers, 0, 0) != [] | retu | en\n\t\t\tcal filter(markers, 'index(s:rmarkers, v:val) < 0')\n\t\ten\n\t\tcal s:findroot(spath, markers, 0, 0)\n\ten\nendf\n\" * AcceptSelection() {{{1\nfu! ctrlp#acceptfile(...)\n\tlet useb = 0\n\tif a:0 == 1 && type(a:1) == 4\n\t\tlet [md, line] = [a:1['action'], a:1['line']]\n\t\tlet atl = has_key(a:1, 'tail') ? a:1['tail'] : ''\n\tel\n\t\tlet [md, line] = [a:1, a:2]\n\t\tlet atl = a:0 > 2 ? a:3 : ''\n\ten\n\tif !type(line)\n\t\tlet [filpath, bufnr, useb] = [line, line, 1]\n\tel\n\t\tlet filpath = fnamemodify(line, ':p')\n\t\tif s:nonamecond(line, filpath)\n\t\t\tlet bufnr = str2nr(matchstr(line, '[\\/]\\?\\[\\zs\\d\\+\\ze\\*No Name\\]$'))\n\t\t\tlet [filpath, useb] = [bufnr, 1]\n\t\tel\n\t\t\tlet bufnr = bufnr('^'.filpath.'$')\n\t\ten\n\ten\n\tcal s:PrtExit()\n\tlet tail = s:tail()\n\tlet j2l = atl != '' ? atl : matchstr(tail, '^ +\\zs\\d\\+$')\n\tif ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0\n\t\t\\ && !( md == 'e' && bufnr == bufnr('%') )\n\t\tlet [jmpb, bufwinnr] = [1, bufwinnr(bufnr)]\n\t\tlet buftab = ( s:jmptobuf =~# '[tTVH]' || s:jmptobuf > 1 )\n\t\t\t\\ ? s:buftab(bufnr, md) : [0, 0]\n\ten\n\t\" Switch to existing buffer or open new one\n\tif exists('jmpb') && bufwinnr > 0\n\t\t\\ && !( md == 't' && ( s:jmptobuf !~# toupper(md) || buftab[0] ) )\n\t\texe bufwinnr.'winc w'\n\t\tif j2l | cal ctrlp#j2l(j2l) | en\n\telsei exists('jmpb') && buftab[0]\n\t\t\\ && !( md =~ '[evh]' && s:jmptobuf !~# toupper(md) )\n\t\texe 'tabn' buftab[0]\n\t\texe buftab[1].'winc w'\n\t\tif j2l | cal ctrlp#j2l(j2l) | en\n\tel\n\t\t\" Determine the command to use\n\t\tlet useb = bufnr > 0 && buflisted(bufnr) && ( empty(tail) || useb )\n\t\tlet cmd =\n\t\t\t\\ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) :\n\t\t\t\\ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) :\n\t\t\t\\ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) :\n\t\t\t\\ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e'])\n\t\t\" Reset &switchbuf option\n\t\tlet [swb, &swb] = [&swb, '']\n\t\t\" Open new window/buffer\n\t\tlet [fid, tail] = [( useb ? bufnr : filpath ), ( atl != '' ? ' +'.atl : tail )]\n\t\tlet args = [cmd, fid, tail, 1, [useb, j2l]]\n\t\tcal call('s:openfile', args)\n\t\tlet &swb = swb\n\ten\nendf\n\nfu! s:SpecInputs(str)\n\tif a:str =~ '\\v^(\\.\\.([\\/]\\.\\.)*[\\/]?[.\\/]*)$' && s:spi\n\t\tlet cwd = s:dyncwd\n\t\tcal ctrlp#setdir(a:str =~ '^\\.\\.\\.*$' ?\n\t\t\t\\ '../'.repeat('../', strlen(a:str) - 2) : a:str)\n\t\tif cwd != s:dyncwd | cal ctrlp#setlines() | en\n\t\tcal s:PrtClear()\n\t\tretu 1\n\telsei a:str == s:lash && s:spi\n\t\tcal s:SetWD({ 'mode': 'rd' })\n\t\tcal ctrlp#setlines()\n\t\tcal s:PrtClear()\n\t\tretu 1\n\telsei a:str =~ '^@.\\+' && s:spi\n\t\tretu s:at(a:str)\n\telsei a:str == '?'\n\t\tcal s:PrtExit()\n\t\tlet hlpwin = &columns > 159 ? '| vert res 80' : ''\n\t\tsil! exe 'bo vert h ctrlp-mappings' hlpwin '| norm! 0'\n\t\tretu 1\n\ten\n\tretu 0\nendf\n\nfu! s:AcceptSelection(action)\n\tlet [md, icr] = [a:action[0], match(a:action, 'r') >= 0]\n\tlet subm = icr || ( !icr && md == 'e' )\n\tif !subm && s:OpenMulti(md) != -1 | retu | en\n\tlet str = s:getinput()\n\tif subm | if s:SpecInputs(str) | retu | en | en\n\t\" Get the selected line\n\tlet line = ctrlp#getcline()\n\tif !subm && !s:itemtype && line == '' && line('.') > s:offset\n\t\t\\ && str !~ '\\v^(\\.\\.([\\/]\\.\\.)*[\\/]?[.\\/]*|/|\\\\|\\?|\\@.+)$'\n\t\tcal s:CreateNewFile(md) | retu\n\ten\n\tif empty(line) | retu | en\n\t\" Do something with it\n\tif s:openfunc != {} && has_key(s:openfunc, s:ctype)\n\t\tlet actfunc = s:openfunc[s:ctype]\n\t\tlet type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'list'\n\tel\n\t\tif s:itemtype < 3\n\t\t\tlet [actfunc, type] = ['ctrlp#acceptfile', 'dict']\n\t\tel\n\t\t\tlet [actfunc, exttype] = [s:getextvar('accept'), s:getextvar('act_farg')]\n\t\t\tlet type = exttype == 'dict' ? exttype : 'list'\n\t\ten\n\ten\n\tlet actargs = type == 'dict' ? [{ 'action': md, 'line': line, 'icr': icr }]\n\t\t\\ : [md, line]\n\tcal call(actfunc, actargs)\nendf\n\" - CreateNewFile() {{{1\nfu! s:CreateNewFile(...)\n\tlet [md, str] = ['', s:getinput('n')]\n\tif empty(str) | retu | en\n\tif s:argmap && !a:0\n\t\t\" Get the extra argument\n\t\tlet md = s:argmaps(md, 1)\n\t\tif md == 'cancel' | retu | en\n\ten\n\tlet str = s:sanstail(str)\n\tlet [base, fname] = s:headntail(str)\n\tif fname =~ '^[\\/]$' | retu | en\n\tif exists('s:marked') && len(s:marked)\n\t\t\" Use the first marked file's path\n\t\tlet path = fnamemodify(values(s:marked)[0], ':p:h')\n\t\tlet base = path.s:lash(path).base\n\t\tlet str = fnamemodify(base.s:lash.fname, ':.')\n\ten\n\tif base != '' | if isdirectory(ctrlp#utils#mkdir(base))\n\t\tlet optyp = str | en | el | let optyp = fname\n\ten\n\tif !exists('optyp') | retu | en\n\tlet [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()]\n\tif !stridx(filpath, s:dyncwd) | cal s:insertcache(str) | en\n\tcal s:PrtExit()\n\tlet cmd = md == 'r' ? ctrlp#normcmd('e') :\n\t\t\\ s:newfop =~ '1\\|t' || ( a:0 && a:1 == 't' ) || md == 't' ? 'tabe' :\n\t\t\\ s:newfop =~ '2\\|h' || ( a:0 && a:1 == 'h' ) || md == 'h' ? 'new' :\n\t\t\\ s:newfop =~ '3\\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' :\n\t\t\\ ctrlp#normcmd('e')\n\tcal s:openfile(cmd, filpath, tail, 1)\nendf\n\" * OpenMulti() {{{1\nfu! s:MarkToOpen()\n\tif s:bufnr <= 0 || s:opmul == '0'\n\t\t\\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )\n\t\tretu\n\ten\n\tlet line = ctrlp#getcline()\n\tif empty(line) | retu | en\n\tlet filpath = s:ispath ? fnamemodify(line, ':p') : line\n\tif exists('s:marked') && s:dictindex(s:marked, filpath) > 0\n\t\t\" Unmark and remove the file from s:marked\n\t\tlet key = s:dictindex(s:marked, filpath)\n\t\tcal remove(s:marked, key)\n\t\tif empty(s:marked) | unl s:marked | en\n\t\tif has('signs')\n\t\t\texe 'sign unplace' key 'buffer='.s:bufnr\n\t\ten\n\tel\n\t\t\" Add to s:marked and place a new sign\n\t\tif exists('s:marked')\n\t\t\tlet vac = s:vacantdict(s:marked)\n\t\t\tlet key = empty(vac) ? len(s:marked) + 1 : vac[0]\n\t\t\tlet s:marked = extend(s:marked, { key : filpath })\n\t\tel\n\t\t\tlet [key, s:marked] = [1, { 1 : filpath }]\n\t\ten\n\t\tif has('signs')\n\t\t\texe 'sign place' key 'line='.line('.').' name=ctrlpmark buffer='.s:bufnr\n\t\ten\n\ten\n\tsil! cal ctrlp#statusline()\nendf\n\nfu! s:OpenMulti(...)\n\tlet has_marked = exists('s:marked')\n\tif ( !has_marked && a:0 ) || s:opmul == '0' || !s:ispath\n\t\t\\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )\n\t\tretu -1\n\ten\n\t\" Get the options\n\tlet [nr, md] = [matchstr(s:opmul, '\\d\\+'), matchstr(s:opmul, '[thvi]')]\n\tlet [ur, jf] = [s:opmul =~ 'r', s:opmul =~ 'j']\n\tlet md = a:0 ? a:1 : ( md == '' ? 'v' : md )\n\tlet nopt = exists('g:ctrlp_open_multiple_files')\n\tif !has_marked\n\t\tlet line = ctrlp#getcline()\n\t\tif line == '' | retu | en\n\t\tlet marked = { 1 : fnamemodify(line, ':p') }\n\t\tlet [nr, ur, jf, nopt] = ['1', 0, 0, 1]\n\ten\n\tif ( s:argmap || !has_marked ) && !a:0\n\t\tlet md = s:argmaps(md, !has_marked ? 2 : 0)\n\t\tif md == 'c'\n\t\t\tcal s:unmarksigns()\n\t\t\tunl! s:marked\n\t\t\tcal s:BuildPrompt(0)\n\t\telsei !has_marked && md =~ '[axd]'\n\t\t\tretu s:OpenNoMarks(md, line)\n\t\ten\n\t\tif md =~ '\\v^c(ancel)?$' | retu | en\n\t\tlet nr = nr == '0' ? ( nopt ? '' : '1' ) : nr\n\t\tlet ur = !has_marked && md == 'r' ? 1 : ur\n\ten\n\tlet mkd = values(has_marked ? s:marked : marked)\n\tcal s:sanstail(join(s:prompt, ''))\n\tcal s:PrtExit()\n\tif nr == '0' || md == 'i'\n\t\tretu map(mkd, \"s:openfile('bad', v:val, '', 0)\")\n\ten\n\tlet tail = s:tail()\n\tlet [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')]\n\tlet useb = bufnr > 0 && buflisted(bufnr) && emptytail\n\t\" Move to a replaceable window\n\tlet ncmd = ( useb ? ['b', 'bo vert sb'] : ['e', 'bo vne'] )\n\t\t\\ + ( ur ? [] : ['ignruw'] )\n\tlet fst = call('ctrlp#normcmd', ncmd)\n\t\" Check if the current window has a replaceable buffer\n\tlet repabl = !( md == 't' && !ur ) && empty(bufname('%')) && empty(&l:ft)\n\t\" Commands for the rest of the files\n\tlet [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'],\n\t\t\\ 't': ['tab sb', 'tabe'] }]\n\tlet [swb, &swb] = [&swb, '']\n\tif md == 't' && ctrlp#tabcount() < tabpagenr()\n\t\tlet s:tabct = ctrlp#tabcount()\n\ten\n\t\" Open the files\n\tfor va in mkd\n\t\tlet bufnr = bufnr('^'.va.'$')\n\t\tif bufnr < 0 && getftype(va) == '' | con | en\n\t\tlet useb = bufnr > 0 && buflisted(bufnr) && emptytail\n\t\tlet snd = md != '' && has_key(cmds, md) ?\n\t\t\t\\ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' )\n\t\tlet cmd = ic == 1 && ( !( !ur && fst =~ '^[eb]$' ) || repabl ) ? fst : snd\n\t\tlet conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ),\n\t\t\t\\ nr != '' && nr < ic]\n\t\tif conds[nopt]\n\t\t\tif !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en\n\t\tel\n\t\t\tcal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1)\n\t\t\tif jf | if ic == 1\n\t\t\t\tlet crpos = [tabpagenr(), winnr()]\n\t\t\tel\n\t\t\t\tlet crpos[0] += tabpagenr() <= crpos[0]\n\t\t\t\tlet crpos[1] += winnr() <= crpos[1]\n\t\t\ten | en\n\t\t\tlet ic += 1\n\t\ten\n\tendfo\n\tif jf && exists('crpos') && ic > 2\n\t\texe ( md == 't' ? 'tabn '.crpos[0] : crpos[1].'winc w' )\n\ten\n\tlet &swb = swb\n\tunl! s:tabct\nendf\n\nfu! s:OpenNoMarks(md, line)\n\tif a:md == 'a'\n\t\tlet [s:marked, key] = [{}, 1]\n\t\tfor line in s:lines\n\t\t\tlet s:marked = extend(s:marked, { key : fnamemodify(line, ':p') })\n\t\t\tlet key += 1\n\t\tendfo\n\t\tcal s:remarksigns()\n\t\tcal s:BuildPrompt(0)\n\telsei a:md == 'x'\n\t\tlet type = has_key(s:openfunc, 'arg_type') ? s:openfunc['arg_type'] : 'dict'\n\t\tlet argms = type == 'dict' ? [{ 'action': a:md, 'line': a:line }]\n\t\t\t\\ : [a:md, a:line]\n\t\tcal call(s:openfunc[s:ctype], argms, s:openfunc)\n\telsei a:md == 'd'\n\t\tlet dir = fnamemodify(a:line, ':h')\n\t\tif isdirectory(dir)\n\t\t\tcal ctrlp#setdir(dir)\n\t\t\tcal ctrlp#switchtype(0)\n\t\t\tcal ctrlp#recordhist()\n\t\t\tcal s:PrtClear()\n\t\ten\n\ten\nendf\n\" ** Helper functions {{{1\n\" Sorting {{{2\nfu! ctrlp#complen(...)\n\t\" By length\n\tlet [len1, len2] = [strlen(a:1), strlen(a:2)]\n\tretu len1 == len2 ? 0 : len1 > len2 ? 1 : -1\nendf\n\nfu! s:compmatlen(...)\n\t\" By match length\n\tlet mln1 = s:shortest(s:matchlens(a:1, s:compat))\n\tlet mln2 = s:shortest(s:matchlens(a:2, s:compat))\n\tretu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1\nendf\n\nfu! s:comptime(...)\n\t\" By last modified time\n\tlet [time1, time2] = [getftime(a:1), getftime(a:2)]\n\tretu time1 == time2 ? 0 : time1 < time2 ? 1 : -1\nendf\n\nfu! s:compmreb(...)\n\t\" By last entered time (bufnr)\n\tlet [id1, id2] = [index(s:mrbs, a:1), index(s:mrbs, a:2)]\n\tretu id1 == id2 ? 0 : id1 > id2 ? 1 : -1\nendf\n\nfu! s:compmref(...)\n\t\" By last entered time (MRU)\n\tlet [id1, id2] = [index(g:ctrlp_lines, a:1), index(g:ctrlp_lines, a:2)]\n\tretu id1 == id2 ? 0 : id1 > id2 ? 1 : -1\nendf\n\nfu! s:comparent(...)\n\t\" By same parent dir\n\tif !stridx(s:crfpath, s:dyncwd)\n\t\tlet [as1, as2] = [s:dyncwd.s:lash().a:1, s:dyncwd.s:lash().a:2]\n\t\tlet [loc1, loc2] = [s:getparent(as1), s:getparent(as2)]\n\t\tif loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en\n\t\tif loc2 == s:crfpath && loc1 != s:crfpath | retu 1  | en\n\t\tretu 0\n\ten\n\tretu 0\nendf\n\nfu! s:compfnlen(...)\n\t\" By filename length\n\tlet len1 = strlen(split(a:1, s:lash)[-1])\n\tlet len2 = strlen(split(a:2, s:lash)[-1])\n\tretu len1 == len2 ? 0 : len1 > len2 ? 1 : -1\nendf\n\nfu! s:matchlens(str, pat, ...)\n\tif empty(a:pat) || index(['^', '$'], a:pat) >= 0 | retu {} | en\n\tlet st   = a:0 ? a:1 : 0\n\tlet lens = a:0 >= 2 ? a:2 : {}\n\tlet nr   = a:0 >= 3 ? a:3 : 0\n\tif nr > 20 | retu {} | en\n\tif match(a:str, a:pat, st) >= 0\n\t\tlet [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)]\n\t\tlet lens = extend(lens, { nr : [strlen(mst), mst] })\n\t\tlet lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1)\n\ten\n\tretu lens\nendf\n\nfu! s:shortest(lens)\n\tretu min(map(values(a:lens), 'v:val[0]'))\nendf\n\nfu! s:mixedsort(...)\n\tif s:itemtype == 1\n\t\tlet pat = '[\\/]\\?\\[\\d\\+\\*No Name\\]$'\n\t\tif a:1 =~# pat && a:2 =~# pat | retu 0\n\t\telsei a:1 =~# pat | retu 1\n\t\telsei a:2 =~# pat | retu -1 | en\n\ten\n\tlet [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)]\n\tif s:ispath\n\t\tlet ms = []\n\t\tif s:res_count < 21\n\t\t\tlet ms += [s:compfnlen(a:1, a:2)]\n\t\t\tif s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en\n\t\t\tif !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en\n\t\ten\n\t\tif s:itemtype =~ '^[12]$'\n\t\t\tlet ms += [s:compmref(a:1, a:2)]\n\t\t\tlet cln = cml ? cln : 0\n\t\ten\n\t\tlet ms += [cml, 0, 0, 0]\n\t\tlet mp = call('s:multipliers', ms[:3])\n\t\tretu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3]\n\ten\n\tretu cln + cml * 2\nendf\n\nfu! s:multipliers(...)\n\tlet mp0 = !a:1 ? 0 : 2\n\tlet mp1 = !a:2 ? 0 : 1 + ( !mp0 ? 1 : mp0 )\n\tlet mp2 = !a:3 ? 0 : 1 + ( !( mp0 + mp1 ) ? 1 : ( mp0 + mp1 ) )\n\tlet mp3 = !a:4 ? 0 : 1 + ( !( mp0 + mp1 + mp2 ) ? 1 : ( mp0 + mp1 + mp2 ) )\n\tretu [mp0, mp1, mp2, mp3]\nendf\n\nfu! s:compval(...)\n\tretu a:1 - a:2\nendf\n\" Statusline {{{2\nfu! ctrlp#statusline()\n\tif !exists('s:statypes')\n\t\tlet s:statypes = [\n\t\t\t\\ ['files', 'fil'],\n\t\t\t\\ ['buffers', 'buf'],\n\t\t\t\\ ['mru files', 'mru'],\n\t\t\t\\ ]\n\t\tif !empty(g:ctrlp_ext_vars)\n\t\t\tcal map(copy(g:ctrlp_ext_vars),\n\t\t\t\t\\ 'add(s:statypes, [ v:val[\"lname\"], v:val[\"sname\"] ])')\n\t\ten\n\ten\n\tlet tps = s:statypes\n\tlet max = len(tps) - 1\n\tlet nxt = tps[s:walker(max, s:itemtype,  1)][1]\n\tlet prv = tps[s:walker(max, s:itemtype, -1)][1]\n\tlet s:ctype = tps[s:itemtype][0]\n\tlet focus   = s:focus ? 'prt'  : 'win'\n\tlet byfname = s:ispath ? s:byfname ? 'file' : 'path' : 'line'\n\tlet marked  = s:opmul != '0' ?\n\t\t\\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''\n\tif s:status != {}\n\t\tlet argms =\n\t\t\t\\ has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict' ? [{\n\t\t\t\\ 'focus':   focus,\n\t\t\t\\ 'byfname': byfname,\n\t\t\t\\ 'regex':   s:regexp,\n\t\t\t\\ 'prev':    prv,\n\t\t\t\\ 'item':    s:ctype,\n\t\t\t\\ 'next':    nxt,\n\t\t\t\\ 'marked':  marked,\n\t\t\t\\ }] : [focus, byfname, s:regexp, prv, s:ctype, nxt, marked]\n\t\tlet &l:stl = call(s:status['main'], argms, s:status)\n\tel\n\t\tlet item    = '%#CtrlPMode1# '.s:ctype.' %*'\n\t\tlet focus   = '%#CtrlPMode2# '.focus.' %*'\n\t\tlet byfname = '%#CtrlPMode1# '.byfname.' %*'\n\t\tlet regex   = s:regexp  ? '%#CtrlPMode2# regex %*' : ''\n\t\tlet slider  = ' <'.prv.'>={'.item.'}=<'.nxt.'>'\n\t\tlet dir     = ' %=%<%#CtrlPMode2# %{getcwd()} %*'\n\t\tlet &l:stl  = focus.byfname.regex.slider.marked.dir\n\ten\nendf\n\nfu! s:dismrk()\n\tretu has('signs') ? len(s:marked) :\n\t\t\\ '%<'.join(values(map(copy(s:marked), 'split(v:val, \"[\\\\/]\")[-1]')), ', ')\nendf\n\nfu! ctrlp#progress(enum, ...)\n\tif has('macunix') || has('mac') | sl 1m | en\n\tlet txt = a:0 ? '(press ctrl-c to abort)' : ''\n\tif s:status != {}\n\t\tlet argms = has_key(s:status, 'arg_type') && s:status['arg_type'] == 'dict'\n\t\t\t\\ ? [{ 'str': a:enum }] : [a:enum]\n\t\tlet &l:stl = call(s:status['prog'], argms, s:status)\n\tel\n\t\tlet &l:stl = '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*'\n\ten\n\tredraws\nendf\n\" *** Paths {{{2\n\" Line formatting {{{3\nfu! s:formatline(str)\n\tlet str = a:str\n\tif s:itemtype == 1\n\t\tlet filpath = fnamemodify(str, ':p')\n\t\tlet bufnr = s:nonamecond(str, filpath)\n\t\t\t\\ ? str2nr(matchstr(str, '[\\/]\\?\\[\\zs\\d\\+\\ze\\*No Name\\]$'))\n\t\t\t\\ : bufnr('^'.filpath.'$')\n\t\tlet idc = ( bufnr == bufnr('#') ? '#' : '' )\n\t\t\t\\ . ( getbufvar(bufnr, '&ma') ? '' : '-' )\n\t\t\t\\ . ( getbufvar(bufnr, '&ro') ? '=' : '' )\n\t\t\t\\ . ( getbufvar(bufnr, '&mod') ? '+' : '' )\n\t\tlet str .= idc != '' ? ' '.idc : ''\n\ten\n\tlet cond = s:ispath && ( s:winw - 4 ) < s:strwidth(str)\n\tretu '> '.( cond ? s:pathshorten(str) : str )\nendf\n\nfu! s:pathshorten(str)\n\tretu matchstr(a:str, '^.\\{9}').'...'\n\t\t\\ .matchstr(a:str, '.\\{'.( s:winw - 16 ).'}$')\nendf\n\nfu! s:offset(lines, height)\n\tlet s:offset = s:mw_order == 'btt' ? ( a:height - s:res_count ) : 0\n\tretu s:offset > 0 ? ( repeat([''], s:offset) + a:lines ) : a:lines\nendf\n\" Directory completion {{{3\nfu! s:dircompl(be, sd)\n\tif a:sd == '' | retu [] | en\n\tif a:be == ''\n\t\tlet [be, sd] = [s:dyncwd, a:sd]\n\tel\n\t\tlet be = a:be.s:lash(a:be)\n\t\tlet sd = be.a:sd\n\ten\n\tlet dirs = split(globpath(s:fnesc(be, 'g', ','), a:sd.'*/'), \"\\n\")\n\tif a:be == ''\n\t\tlet dirs = ctrlp#rmbasedir(dirs)\n\ten\n\tcal filter(dirs, '!match(v:val, escape(sd, ''~$.\\''))'\n\t\t\\ . ' && v:val !~ ''\\v(^|[\\/])\\.{1,2}[\\/]$''')\n\tretu dirs\nendf\n\nfu! s:findcommon(items, seed)\n\tlet [items, id, cmn, ic] = [copy(a:items), strlen(a:seed), '', 0]\n\tcal map(items, 'strpart(v:val, id)')\n\tfor char in split(items[0], '\\zs')\n\t\tfor item in items[1:]\n\t\t\tif item[ic] != char | let brk = 1 | brea | en\n\t\tendfo\n\t\tif exists('brk') | brea | en\n\t\tlet cmn .= char\n\t\tlet ic += 1\n\tendfo\n\tretu cmn\nendf\n\" Misc {{{3\nfu! s:headntail(str)\n\tlet parts = split(a:str, '[\\/]\\ze[^\\/]\\+[\\/:]\\?$')\n\tretu len(parts) == 1 ? ['', parts[0]] : len(parts) == 2 ? parts : []\nendf\n\nfu! s:lash(...)\n\tretu ( a:0 ? a:1 : s:dyncwd ) !~ '[\\/]$' ? s:lash : ''\nendf\n\nfu! s:ispathitem()\n\tretu s:itemtype < 3 || ( s:itemtype > 2 && s:getextvar('type') == 'path' )\nendf\n\nfu! ctrlp#igncwd(cwd)\n\tretu ctrlp#utils#glob(a:cwd, 0) == '' ||\n\t\t\\ ( s:igntype >= 0 && s:usrign(a:cwd, getftype(a:cwd)) )\nendf\n\nfu! ctrlp#dirnfile(entries)\n\tlet [items, cwd] = [[[], []], s:dyncwd.s:lash()]\n\tfor each in a:entries\n\t\tlet etype = getftype(each)\n\t\tif s:igntype >= 0 && s:usrign(each, etype) | con | en\n\t\tif etype == 'dir'\n\t\t\tif s:showhidden | if each !~ '[\\/]\\.\\{1,2}$'\n\t\t\t\tcal add(items[0], each)\n\t\t\ten | el\n\t\t\t\tcal add(items[0], each)\n\t\t\ten\n\t\telsei etype == 'link'\n\t\t\tif s:folsym\n\t\t\t\tlet isfile = !isdirectory(each)\n\t\t\t\tif s:folsym == 2 || !s:samerootsyml(each, isfile, cwd)\n\t\t\t\t\tcal add(items[isfile], each)\n\t\t\t\ten\n\t\t\ten\n\t\telsei etype == 'file'\n\t\t\tcal add(items[1], each)\n\t\ten\n\tendfo\n\tretu items\nendf\n\nfu! s:usrign(item, type)\n\tretu s:igntype == 1 ? a:item =~ s:usrign\n\t\t\\ : s:igntype == 4 && has_key(s:usrign, a:type) && s:usrign[a:type] != ''\n\t\t\\ ? a:item =~ s:usrign[a:type] : 0\nendf\n\nfu! s:samerootsyml(each, isfile, cwd)\n\tlet resolve = fnamemodify(resolve(a:each), ':p:h')\n\tlet resolve .= s:lash(resolve)\n\tretu !( stridx(resolve, a:cwd) && ( stridx(a:cwd, resolve) || a:isfile ) )\nendf\n\nfu! ctrlp#rmbasedir(items)\n\tlet cwd = s:dyncwd.s:lash()\n\tif a:items != [] && !stridx(a:items[0], cwd)\n\t\tlet idx = strlen(cwd)\n\t\tretu map(a:items, 'strpart(v:val, idx)')\n\ten\n\tretu a:items\nendf\n\" Working directory {{{3\nfu! s:getparent(item)\n\tlet parent = substitute(a:item, '[\\/][^\\/]\\+[\\/:]\\?$', '', '')\n\tif parent == '' || parent !~ '[\\/]'\n\t\tlet parent .= s:lash\n\ten\n\tretu parent\nendf\n\nfu! s:findroot(curr, mark, depth, type)\n\tlet [depth, fnd] = [a:depth + 1, 0]\n\tif type(a:mark) == 1\n\t\tlet fnd = s:glbpath(s:fnesc(a:curr, 'g', ','), a:mark, 1) != ''\n\telsei type(a:mark) == 3\n\t\tfor markr in a:mark\n\t\t\tif s:glbpath(s:fnesc(a:curr, 'g', ','), markr, 1) != ''\n\t\t\t\tlet fnd = 1\n\t\t\t\tbrea\n\t\t\ten\n\t\tendfo\n\ten\n\tif fnd\n\t\tif !a:type | cal ctrlp#setdir(a:curr) | en\n\t\tretu [exists('markr') ? markr : a:mark, a:curr]\n\telsei depth > s:maxdepth\n\t\tcal ctrlp#setdir(s:cwd)\n\tel\n\t\tlet parent = s:getparent(a:curr)\n\t\tif parent != a:curr\n\t\t\tretu s:findroot(parent, a:mark, depth, a:type)\n\t\ten\n\ten\n\tretu []\nendf\n\nfu! ctrlp#setdir(path, ...)\n\tlet cmd = a:0 ? a:1 : 'lc!'\n\tsil! exe cmd s:fnesc(a:path, 'c')\n\tlet [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]\nendf\n\" Fallbacks {{{3\nfu! s:glbpath(...)\n\tretu call('ctrlp#utils#globpath', a:000)\nendf\n\nfu! s:fnesc(...)\n\tretu call('ctrlp#utils#fnesc', a:000)\nendf\n\nfu! ctrlp#setlcdir()\n\tif exists('*haslocaldir')\n\t\tcal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')\n\ten\nendf\n\" Highlighting {{{2\nfu! ctrlp#syntax()\n\tif ctrlp#nosy() | retu | en\n\tfor [ke, va] in items(s:hlgrps) | cal ctrlp#hicheck('CtrlP'.ke, va) | endfo\n\tif synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\\|^$'\n\t\tsil! exe 'hi CtrlPLinePre '.( has(\"gui_running\") ? 'gui' : 'cterm' ).'fg=bg'\n\ten\n\tsy match CtrlPNoEntries '^ == NO ENTRIES ==$'\n\tif hlexists('CtrlPLinePre')\n\t\tsy match CtrlPLinePre '^>'\n\ten\nendf\n\nfu! s:highlight(pat, grp)\n\tif s:matcher != {} | retu | en\n\tcal clearmatches()\n\tif !empty(a:pat) && s:ispath\n\t\tlet pat = s:regexp ? substitute(a:pat, '\\\\\\@<!\\^', '^> \\\\zs', 'g') : a:pat\n\t\tif s:byfname\n\t\t\tlet pat = substitute(pat, '\\[\\^\\(.\\{-}\\)\\]\\\\{-}', '[^\\\\/\\1]\\\\{-}', 'g')\n\t\t\tlet pat = substitute(pat, '\\$\\@<!$', '\\\\ze[^\\\\/]*$', 'g')\n\t\ten\n\t\tcal matchadd(a:grp, ( s:martcs == '' ? '\\c' : '\\C' ).pat)\n\t\tcal matchadd('CtrlPLinePre', '^>')\n\ten\nendf\n\nfu! s:dohighlight()\n\tretu s:mathi[0] && exists('*clearmatches') && !ctrlp#nosy()\nendf\n\" Prompt history {{{2\nfu! s:gethistloc()\n\tlet utilcadir = ctrlp#utils#cachedir()\n\tlet cache_dir = utilcadir.s:lash(utilcadir).'hist'\n\tretu [cache_dir, cache_dir.s:lash(cache_dir).'cache.txt']\nendf\n\nfu! s:gethistdata()\n\tretu ctrlp#utils#readfile(s:gethistloc()[1])\nendf\n\nfu! ctrlp#recordhist()\n\tlet str = join(s:prompt, '')\n\tif empty(str) || !s:maxhst | retu | en\n\tlet hst = s:hstry\n\tif len(hst) > 1 && hst[1] == str | retu | en\n\tcal extend(hst, [str], 1)\n\tif len(hst) > s:maxhst | cal remove(hst, s:maxhst, -1) | en\n\tcal ctrlp#utils#writecache(hst, s:gethistloc()[0], s:gethistloc()[1])\nendf\n\" Signs {{{2\nfu! s:unmarksigns()\n\tif !s:dosigns() | retu | en\n\tfor key in keys(s:marked)\n\t\texe 'sign unplace' key 'buffer='.s:bufnr\n\tendfo\nendf\n\nfu! s:remarksigns()\n\tif !s:dosigns() | retu | en\n\tfor ic in range(1, len(s:lines))\n\t\tlet line = s:ispath ? fnamemodify(s:lines[ic - 1], ':p') : s:lines[ic - 1]\n\t\tlet key = s:dictindex(s:marked, line)\n\t\tif key > 0\n\t\t\texe 'sign place' key 'line='.ic.' name=ctrlpmark buffer='.s:bufnr\n\t\ten\n\tendfo\nendf\n\nfu! s:dosigns()\n\tretu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs')\nendf\n\" Lists & Dictionaries {{{2\nfu! s:ifilter(list, str)\n\tlet [rlist, estr] = [[], substitute(a:str, 'v:val', 'each', 'g')]\n\tfor each in a:list\n\t\ttry\n\t\t\tif eval(estr)\n\t\t\t\tcal add(rlist, each)\n\t\t\ten\n\t\tcat | con | endt\n\tendfo\n\tretu rlist\nendf\n\nfu! s:dictindex(dict, expr)\n\tfor key in keys(a:dict)\n\t\tif a:dict[key] == a:expr | retu key | en\n\tendfo\n\tretu -1\nendf\n\nfu! s:vacantdict(dict)\n\tretu filter(range(1, max(keys(a:dict))), '!has_key(a:dict, v:val)')\nendf\n\nfu! s:sublist(l, s, e)\n\tretu v:version > 701 ? a:l[(a:s):(a:e)] : s:sublist7071(a:l, a:s, a:e)\nendf\n\nfu! s:sublist7071(l, s, e)\n\tlet [newlist, id, ae] = [[], a:s, a:e == -1 ? len(a:l) - 1 : a:e]\n\twh id <= ae\n\t\tcal add(newlist, get(a:l, id))\n\t\tlet id += 1\n\tendw\n\tretu newlist\nendf\n\" Buffers {{{2\nfu! s:buftab(bufnr, md)\n\tfor tabnr in range(1, tabpagenr('$'))\n\t\tif tabpagenr() == tabnr && a:md == 't' | con | en\n\t\tlet buflist = tabpagebuflist(tabnr)\n\t\tif index(buflist, a:bufnr) >= 0\n\t\t\tfor winnr in range(1, tabpagewinnr(tabnr, '$'))\n\t\t\t\tif buflist[winnr - 1] == a:bufnr | retu [tabnr, winnr] | en\n\t\t\tendfo\n\t\ten\n\tendfo\n\tretu [0, 0]\nendf\n\nfu! s:bufwins(bufnr)\n\tlet winns = 0\n\tfor tabnr in range(1, tabpagenr('$'))\n\t\tlet winns += count(tabpagebuflist(tabnr), a:bufnr)\n\tendfo\n\tretu winns\nendf\n\nfu! s:nonamecond(str, filpath)\n\tretu a:str =~ '[\\/]\\?\\[\\d\\+\\*No Name\\]$' && !filereadable(a:filpath)\n\t\t\\ && bufnr('^'.a:filpath.'$') < 1\nendf\n\nfu! ctrlp#normcmd(cmd, ...)\n\tif a:0 < 2 && s:nosplit() | retu a:cmd | en\n\tlet norwins = filter(range(1, winnr('$')),\n\t\t\\ 'empty(getbufvar(winbufnr(v:val), \"&bt\"))')\n\tfor each in norwins\n\t\tlet bufnr = winbufnr(each)\n\t\tif empty(bufname(bufnr)) && empty(getbufvar(bufnr, '&ft'))\n\t\t\tlet fstemp = each | brea\n\t\ten\n\tendfo\n\tlet norwin = empty(norwins) ? 0 : norwins[0]\n\tif norwin\n\t\tif index(norwins, winnr()) < 0\n\t\t\texe ( exists('fstemp') ? fstemp : norwin ).'winc w'\n\t\ten\n\t\tretu a:cmd\n\ten\n\tretu a:0 ? a:1 : 'bo vne'\nendf\n\nfu! ctrlp#modfilecond(w)\n\tretu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf &&\n\t\t\\ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 )\nendf\n\nfu! s:nosplit()\n\tretu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0\nendf\n\nfu! s:setupblank()\n\tsetl noswf nonu nobl nowrap nolist nospell nocuc wfh\n\tsetl fdc=0 fdl=99 tw=0 bt=nofile bh=unload\n\tif v:version > 702\n\t\tsetl nornu noudf cc=0\n\ten\nendf\n\nfu! s:leavepre()\n\tif exists('s:bufnr') && s:bufnr == bufnr('%') | bw! | en\n\tif !( exists(s:ccex) && !{s:ccex} )\n\t\t\\ && !( has('clientserver') && len(split(serverlist(), \"\\n\")) > 1 )\n\t\tcal ctrlp#clra()\n\ten\nendf\n\nfu! s:checkbuf()\n\tif !exists('s:init') && exists('s:bufnr') && s:bufnr > 0\n\t\texe s:bufnr.'bw!'\n\ten\nendf\n\nfu! s:iscmdwin()\n\tlet ermsg = v:errmsg\n\tsil! noa winc p\n\tsil! noa winc p\n\tlet [v:errmsg, ermsg] = [ermsg, v:errmsg]\n\tretu ermsg =~ '^E11:'\nendf\n\" Arguments {{{2\nfu! s:at(str)\n\tif a:str =~ '\\v^\\@(cd|lc[hd]?|chd).*'\n\t\tlet str = substitute(a:str, '\\v^\\@(cd|lc[hd]?|chd)\\s*', '', '')\n\t\tif str == '' | retu 1 | en\n\t\tlet str = str =~ '^%:.\\+' ? fnamemodify(s:crfile, str[1:]) : str\n\t\tlet path = fnamemodify(expand(str, 1), ':p')\n\t\tif isdirectory(path)\n\t\t\tif path != s:dyncwd\n\t\t\t\tcal ctrlp#setdir(path)\n\t\t\t\tcal ctrlp#setlines()\n\t\t\ten\n\t\t\tcal ctrlp#recordhist()\n\t\t\tcal s:PrtClear()\n\t\ten\n\t\tretu 1\n\ten\n\tretu 0\nendf\n\nfu! s:tail()\n\tif exists('s:optail') && !empty('s:optail')\n\t\tlet tailpref = s:optail !~ '^\\s*+' ? ' +' : ' '\n\t\tretu tailpref.s:optail\n\ten\n\tretu ''\nendf\n\nfu! s:sanstail(str)\n\tlet str = s:spi ?\n\t\t\\ substitute(a:str, '^\\(@.*$\\|\\\\\\\\\\ze@\\|\\.\\.\\zs[.\\/]\\+$\\)', '', 'g') : a:str\n\tlet [str, pat] = [substitute(str, '\\\\\\\\', '\\', 'g'), '\\([^:]\\|\\\\:\\)*$']\n\tunl! s:optail\n\tif str =~ '\\\\\\@<!:'.pat\n\t\tlet s:optail = matchstr(str, '\\\\\\@<!:\\zs'.pat)\n\t\tlet str = substitute(str, '\\\\\\@<!:'.pat, '', '')\n\ten\n\tretu substitute(str, '\\\\\\ze:', '', 'g')\nendf\n\nfu! s:argmaps(md, i)\n\tlet roh = [\n\t\t\\ ['Open Multiple Files', '/h[i]dden/[c]lear', ['i', 'c']],\n\t\t\\ ['Create a New File', '/[r]eplace', ['r']],\n\t\t\\ ['Open Selected', '/[r]eplace', ['r', 'd', 'a']],\n\t\t\\ ]\n\tif a:i == 2\n\t\tif !buflisted(bufnr('^'.fnamemodify(ctrlp#getcline(), ':p').'$'))\n\t\t\tlet roh[2][1] .= '/h[i]dden'\n\t\t\tlet roh[2][2] += ['i']\n\t\ten\n\t\tif s:openfunc != {} && has_key(s:openfunc, s:ctype)\n\t\t\tlet roh[2][1] .= '/e[x]ternal'\n\t\t\tlet roh[2][2] += ['x']\n\t\ten\n\ten\n\tlet str = roh[a:i][0].': [t]ab/[v]ertical/[h]orizontal'.roh[a:i][1].'? '\n\tretu s:choices(str, ['t', 'v', 'h'] + roh[a:i][2], 's:argmaps', [a:md, a:i])\nendf\n\nfu! s:insertstr()\n\tlet str = 'Insert: c[w]ord/c[f]ile/[s]earch/[v]isual/[c]lipboard/[r]egister? '\n\tretu s:choices(str, ['w', 'f', 's', 'v', 'c', 'r'], 's:insertstr', [])\nendf\n\nfu! s:textdialog(str)\n\tredr | echoh MoreMsg | echon a:str | echoh None\n\tretu nr2char(getchar())\nendf\n\nfu! s:choices(str, choices, func, args)\n\tlet char = s:textdialog(a:str)\n\tif index(a:choices, char) >= 0\n\t\tretu char\n\telsei char =~# \"\\\\v\\<Esc>|\\<C-c>|\\<C-g>|\\<C-u>|\\<C-w>|\\<C-[>\"\n\t\tcal s:BuildPrompt(0)\n\t\tretu 'cancel'\n\telsei char =~# \"\\<CR>\" && a:args != []\n\t\tretu a:args[0]\n\ten\n\tretu call(a:func, a:args)\nendf\n\nfu! s:getregs()\n\tlet char = s:textdialog('Insert from register: ')\n\tif char =~# \"\\\\v\\<Esc>|\\<C-c>|\\<C-g>|\\<C-u>|\\<C-w>|\\<C-[>\"\n\t\tcal s:BuildPrompt(0)\n\t\tretu -1\n\telsei char =~# \"\\<CR>\"\n\t\tretu s:getregs()\n\ten\n\tretu s:regisfilter(char)\nendf\n\nfu! s:regisfilter(reg)\n\tretu substitute(getreg(a:reg), \"[\\t\\n]\", ' ', 'g')\nendf\n\" Misc {{{2\nfu! s:modevar()\n\tlet s:matchtype = s:mtype()\n\tlet s:ispath = s:ispathitem()\n\tlet s:mfunc = s:mfunc()\n\tlet s:nolim = s:getextvar('nolim')\n\tlet s:dosort = s:getextvar('sort')\n\tlet s:spi = !s:itemtype || s:getextvar('specinput') > 0\nendf\n\nfu! s:nosort()\n\tretu s:matcher != {} || s:nolim == 1 || ( s:itemtype == 2 && s:mrudef )\n\t\t\\ || ( s:itemtype =~ '\\v^(1|2)$' && s:prompt == ['', '', ''] ) || !s:dosort\nendf\n\nfu! s:byfname()\n\tretu s:ispath && s:byfname\nendf\n\nfu! s:narrowable()\n\tretu exists('s:act_add') && exists('s:matched') && s:matched != []\n\t\t\\ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp]\n\t\t\\ && s:matcher == {} && !exists('s:did_exp')\nendf\n\nfu! s:getinput(...)\n\tlet [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )]\n\tif s:abbrev != {}\n\t\tlet gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : ''\n\t\tlet str = ( gmd =~ 't' && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '')\n\t\tif gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\\k'\n\t\t\tretu join(prt, '')\n\t\ten\n\t\tlet [pf, rz] = [( s:byfname() ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )]\n\t\tfor dict in s:abbrev['abbrevs']\n\t\t\tlet dmd = has_key(dict, 'mode') ? dict['mode'] : ''\n\t\t\tlet pat = escape(dict['pattern'], '~')\n\t\t\tif ( dmd == '' || ( dmd =~ pf && dmd =~ rz && !a:0 )\n\t\t\t\t\\ || dmd =~ '['.spi.']' ) && str =~ pat\n\t\t\t\tlet [str, s:did_exp] = [join(split(str, pat, 1), dict['expanded']), 1]\n\t\t\ten\n\t\tendfo\n\t\tif gmd =~ 't' && !a:0\n\t\t\tlet prt[0] = str\n\t\tel\n\t\t\tretu str\n\t\ten\n\ten\n\tretu spi == 'c' ? prt[0] : join(prt, '')\nendf\n\nfu! s:migemo(str)\n\tlet [str, rtp] = [a:str, s:fnesc(&rtp, 'g')]\n\tlet dict = s:glbpath(rtp, printf(\"dict/%s/migemo-dict\", &enc), 1)\n\tif !len(dict)\n\t\tlet dict = s:glbpath(rtp, \"dict/migemo-dict\", 1)\n\ten\n\tif len(dict)\n\t\tlet [tokens, str, cmd] = [split(str, '\\s'), '', 'cmigemo -v -w %s -d %s']\n\t\tfor token in tokens\n\t\t\tlet rtn = system(printf(cmd, shellescape(token), shellescape(dict)))\n\t\t\tlet str .= !v:shell_error && strlen(rtn) > 0 ? '.*'.rtn : token\n\t\tendfo\n\ten\n\tretu str\nendf\n\nfu! s:strwidth(str)\n\tretu exists('*strdisplaywidth') ? strdisplaywidth(a:str) : strlen(a:str)\nendf\n\nfu! ctrlp#j2l(nr)\n\texe 'norm!' a:nr.'G'\n\tsil! norm! zvzz\nendf\n\nfu! s:maxf(len)\n\tretu s:maxfiles && a:len > s:maxfiles\nendf\n\nfu! s:regexfilter(str)\n\tlet str = a:str\n\tfor key in keys(s:fpats) | if str =~ key\n\t\tlet str = substitute(str, s:fpats[key], '', 'g')\n\ten | endfo\n\tretu str\nendf\n\nfu! s:walker(m, p, d)\n\tretu a:d >= 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m\nendf\n\nfu! s:delent(rfunc)\n\tif a:rfunc == '' | retu | en\n\tlet [s:force, tbrem] = [1, []]\n\tif exists('s:marked')\n\t\tlet tbrem = values(s:marked)\n\t\tcal s:unmarksigns()\n\t\tunl s:marked\n\ten\n\tif tbrem == [] && ( has('dialog_gui') || has('dialog_con') ) &&\n\t\t\\ confirm(\"Wipe all entries?\", \"&OK\\n&Cancel\") != 1\n\t\tunl s:force\n\t\tcal s:BuildPrompt(0)\n\t\tretu\n\ten\n\tlet g:ctrlp_lines = call(a:rfunc, [tbrem])\n\tcal s:BuildPrompt(1)\n\tunl s:force\nendf\n\" Entering & Exiting {{{2\nfu! s:getenv()\n\tlet [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]]\n\tlet [s:crword, s:crnbword] = [expand('<cword>', 1), expand('<cWORD>', 1)]\n\tlet [s:crgfile, s:crline] = [expand('<cfile>', 1), getline('.')]\n\tlet [s:winmaxh, s:crcursor] = [min([s:mw_max, &lines]), getpos('.')]\n\tlet [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]\n\tlet s:crfile = bufname('%') == ''\n\t\t\\ ? '['.s:crbufnr.'*No Name]' : expand('%:p', 1)\n\tlet s:crfpath = expand('%:p:h', 1)\n\tlet s:mrbs = ctrlp#mrufiles#bufs()\nendf\n\nfu! s:lastvisual()\n\tlet cview = winsaveview()\n\tlet [ovreg, ovtype] = [getreg('v'), getregtype('v')]\n\tlet [oureg, outype] = [getreg('\"'), getregtype('\"')]\n\tsil! norm! gv\"vy\n\tlet selected = s:regisfilter('v')\n\tcal setreg('v', ovreg, ovtype)\n\tcal setreg('\"', oureg, outype)\n\tcal winrestview(cview)\n\tretu selected\nendf\n\nfu! s:log(m)\n\tif exists('g:ctrlp_log') && g:ctrlp_log | if a:m\n\t\tlet cadir = ctrlp#utils#cachedir()\n\t\tlet apd = g:ctrlp_log > 1 ? '>' : ''\n\t\tsil! exe 'redi! >'.apd cadir.s:lash(cadir).'ctrlp.log'\n\tel\n\t\tsil! redi END\n\ten | en\nendf\n\nfu! s:buffunc(e)\n\tif a:e && has_key(s:buffunc, 'enter')\n\t\tcal call(s:buffunc['enter'], [], s:buffunc)\n\telsei !a:e && has_key(s:buffunc, 'exit')\n\t\tcal call(s:buffunc['exit'], [], s:buffunc)\n\ten\nendf\n\nfu! s:openfile(cmd, fid, tail, chkmod, ...)\n\tlet cmd = a:cmd\n\tif a:chkmod && cmd =~ '^[eb]$' && ctrlp#modfilecond(!( cmd == 'b' && &aw ))\n\t\tlet cmd = cmd == 'b' ? 'sb' : 'sp'\n\ten\n\tlet cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd\n\tlet j2l = a:0 && a:1[0] ? a:1[1] : 0\n\texe cmd.( a:0 && a:1[0] ? '' : a:tail ) s:fnesc(a:fid, 'f')\n\tif j2l\n\t\tcal ctrlp#j2l(j2l)\n\ten\n\tif !empty(a:tail)\n\t\tsil! norm! zvzz\n\ten\n\tif cmd != 'bad'\n\t\tcal ctrlp#setlcdir()\n\ten\nendf\n\nfu! ctrlp#tabcount()\n\tif exists('s:tabct')\n\t\tlet tabct = s:tabct\n\t\tlet s:tabct += 1\n\telsei !type(s:tabpage)\n\t\tlet tabct = s:tabpage\n\telsei type(s:tabpage) == 1\n\t\tlet tabpos =\n\t\t\t\\ s:tabpage =~ 'c' ? tabpagenr() :\n\t\t\t\\ s:tabpage =~ 'f' ? 1 :\n\t\t\t\\ s:tabpage =~ 'l' ? tabpagenr('$') :\n\t\t\t\\ tabpagenr()\n\t\tlet tabct =\n\t\t\t\\ s:tabpage =~ 'a' ? tabpos :\n\t\t\t\\ s:tabpage =~ 'b' ? tabpos - 1 :\n\t\t\t\\ tabpos\n\ten\n\tretu tabct < 0 ? 0 : tabct\nendf\n\nfu! s:settype(type)\n\tretu a:type < 0 ? exists('s:itemtype') ? s:itemtype : 0 : a:type\nendf\n\" Matching {{{2\nfu! s:matchfname(item, pat)\n\tlet parts = split(a:item, '[\\/]\\ze[^\\/]\\+$')\n\tlet mfn = match(parts[-1], a:pat[0])\n\tretu len(a:pat) == 1 ? mfn : len(a:pat) == 2 ?\n\t\t\\ ( mfn >= 0 && ( len(parts) == 2 ? match(parts[0], a:pat[1]) : -1 ) >= 0\n\t\t\\ ? 0 : -1 ) : -1\n\ten\nendf\n\nfu! s:matchtabs(item, pat)\n\tretu match(split(a:item, '\\t\\+')[0], a:pat)\nendf\n\nfu! s:matchtabe(item, pat)\n\tretu match(split(a:item, '\\t\\+[^\\t]\\+$')[0], a:pat)\nendf\n\nfu! s:buildpat(lst)\n\tlet pat = a:lst[0]\n\tfor item in range(1, len(a:lst) - 1)\n\t\tlet pat .= '[^'.a:lst[item - 1].']\\{-}'.a:lst[item]\n\tendfo\n\tretu pat\nendf\n\nfu! s:mfunc()\n\tlet mfunc = 'match'\n\tif s:byfname()\n\t\tlet mfunc = 's:matchfname'\n\telsei s:itemtype > 2\n\t\tlet matchtypes = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' }\n\t\tif has_key(matchtypes, s:matchtype)\n\t\t\tlet mfunc = matchtypes[s:matchtype]\n\t\ten\n\ten\n\tretu mfunc\nendf\n\nfu! s:mmode()\n\tlet matchmodes = {\n\t\t\\ 'match': 'full-line',\n\t\t\\ 's:matchfname': 'filename-only',\n\t\t\\ 's:matchtabs': 'first-non-tab',\n\t\t\\ 's:matchtabe': 'until-last-tab',\n\t\t\\ }\n\tretu matchmodes[s:mfunc]\nendf\n\" Cache {{{2\nfu! s:writecache(cafile)\n\tif ( g:ctrlp_newcache || !filereadable(a:cafile) ) && !s:nocache()\n\t\tcal ctrlp#utils#writecache(g:ctrlp_allfiles)\n\t\tlet g:ctrlp_newcache = 0\n\ten\nendf\n\nfu! s:nocache(...)\n\tif !s:caching\n\t\tretu 1\n\telsei s:caching > 1\n\t\tif !( exists(s:ccex) && !{s:ccex} ) || has_key(s:ficounts, s:dyncwd)\n\t\t\tretu get(s:ficounts, s:dyncwd, [0, 0])[0] < s:caching\n\t\telsei a:0 && filereadable(a:1)\n\t\t\tretu len(ctrlp#utils#readfile(a:1)) < s:caching\n\t\ten\n\t\tretu 1\n\ten\n\tretu 0\nendf\n\nfu! s:insertcache(str)\n\tlet [data, g:ctrlp_newcache, str] = [g:ctrlp_allfiles, 1, a:str]\n\tif data == [] || strlen(str) <= strlen(data[0])\n\t\tlet pos = 0\n\telsei strlen(str) >= strlen(data[-1])\n\t\tlet pos = len(data) - 1\n\tel\n\t\tlet pos = 0\n\t\tfor each in data\n\t\t\tif strlen(each) > strlen(str) | brea | en\n\t\t\tlet pos += 1\n\t\tendfo\n\ten\n\tcal insert(data, str, pos)\n\tcal s:writecache(ctrlp#utils#cachefile())\nendf\n\" Extensions {{{2\nfu! s:mtype()\n\tretu s:itemtype > 2 ? s:getextvar('type') : 'path'\nendf\n\nfu! s:execextvar(key)\n\tif !empty(g:ctrlp_ext_vars)\n\t\tcal map(filter(copy(g:ctrlp_ext_vars),\n\t\t\t\\ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])')\n\ten\nendf\n\nfu! s:getextvar(key)\n\tif s:itemtype > 2\n\t\tlet vars = g:ctrlp_ext_vars[s:itemtype - 3]\n\t\tretu has_key(vars, a:key) ? vars[a:key] : -1\n\ten\n\tretu -1\nendf\n\nfu! ctrlp#getcline()\n\tlet [linenr, offset] = [line('.'), ( s:offset > 0 ? s:offset : 0 )]\n\tretu !empty(s:lines) && !( offset && linenr <= offset )\n\t\t\\ ? s:lines[linenr - 1 - offset] : ''\nendf\n\nfu! ctrlp#getmarkedlist()\n\tretu exists('s:marked') ? values(s:marked) : []\nendf\n\nfu! ctrlp#exit()\n\tcal s:PrtExit()\nendf\n\nfu! ctrlp#prtclear()\n\tcal s:PrtClear()\nendf\n\nfu! ctrlp#switchtype(id)\n\tcal s:ToggleType(a:id - s:itemtype)\nendf\n\nfu! ctrlp#nosy()\n\tretu !( has('syntax') && exists('g:syntax_on') )\nendf\n\nfu! ctrlp#hicheck(grp, defgrp)\n\tif !hlexists(a:grp)\n\t\texe 'hi link' a:grp a:defgrp\n\ten\nendf\n\nfu! ctrlp#call(func, ...)\n\tretu call(a:func, a:000)\nendf\n\nfu! ctrlp#getvar(var)\n\tretu {a:var}\nendf\n\"}}}1\n\" * Initialization {{{1\nfu! ctrlp#setlines(...)\n\tif a:0 | let s:itemtype = a:1 | en\n\tcal s:modevar()\n\tlet types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()']\n\tif !empty(g:ctrlp_ext_vars)\n\t\tcal map(copy(g:ctrlp_ext_vars), 'add(types, v:val[\"init\"])')\n\ten\n\tlet g:ctrlp_lines = eval(types[s:itemtype])\nendf\n\nfu! ctrlp#init(type, ...)\n\tif exists('s:init') || s:iscmdwin() | retu | en\n\tlet [s:ermsg, v:errmsg] = [v:errmsg, '']\n\tlet [s:matches, s:init] = [1, 1]\n\tcal s:Reset(a:0 ? a:1 : {})\n\tnoa cal s:Open()\n\tcal s:SetWD(a:0 ? a:1 : {})\n\tcal s:MapNorms()\n\tcal s:MapSpecs()\n\tcal ctrlp#syntax()\n\tcal ctrlp#setlines(s:settype(a:type))\n\tcal s:SetDefTxt()\n\tcal s:BuildPrompt(1)\n\tif s:keyloop | cal s:KeyLoop() | en\nendf\n\" - Autocmds {{{1\nif has('autocmd')\n\taug CtrlPAug\n\t\tau!\n\t\tau BufEnter ControlP cal s:checkbuf()\n\t\tau BufLeave ControlP noa cal s:Close()\n\t\tau VimLeavePre * cal s:leavepre()\n\taug END\nen\n\nfu! s:autocmds()\n\tif !has('autocmd') | retu | en\n\tif exists('#CtrlPLazy')\n\t\tau! CtrlPLazy\n\ten\n\tif s:lazy\n\t\taug CtrlPLazy\n\t\t\tau!\n\t\t\tau CursorHold ControlP cal s:ForceUpdate()\n\t\taug END\n\ten\nendf\n\"}}}\n\n\" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "doc/ctrlp.txt",
    "content": "*ctrlp.txt*       Fuzzy file, buffer, mru, tag, ... finder. v1.79\n*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*\n===============================================================================\n#                                                                             #\n#          :::::::: ::::::::::: :::::::::  :::             :::::::::          #\n#         :+:    :+:    :+:     :+:    :+: :+:             :+:    :+:         #\n#         +:+           +:+     +:+    +:+ +:+             +:+    +:+         #\n#         +#+           +#+     +#++:++#:  +#+             +#++:++#+          #\n#         +#+           +#+     +#+    +#+ +#+             +#+                #\n#         #+#    #+#    #+#     #+#    #+# #+#             #+#                #\n#          ########     ###     ###    ### ##########      ###                #\n#                                                                             #\n===============================================================================\nCONTENTS                                                       *ctrlp-contents*\n\n    1. Intro........................................|ctrlp-intro|\n    2. Options......................................|ctrlp-options|\n    3. Commands.....................................|ctrlp-commands|\n    4. Mappings.....................................|ctrlp-mappings|\n    5. Input Formats................................|ctrlp-input-formats|\n    6. Extensions...................................|ctrlp-extensions|\n\n===============================================================================\nINTRO                                                             *ctrlp-intro*\n\nFull path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface.\nWritten in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full\nsupport for Vim's |regexp| as search pattern, built-in MRU files monitoring,\nproject's root finder, and more.\n\nTo enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.\n\n===============================================================================\nOPTIONS                                                         *ctrlp-options*\n\nOverview:~\n\n  |loaded_ctrlp|................Disable the plugin.\n  |ctrlp_map|...................Default mapping.\n  |ctrlp_cmd|...................Default command used for the default mapping.\n  |ctrlp_by_filename|...........Default to filename mode or not.\n  |ctrlp_regexp|................Default to regexp mode or not.\n  |ctrlp_match_window|..........Order, height and position of the match window.\n  |ctrlp_switch_buffer|.........Jump to an open buffer if already opened.\n  |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).\n  |ctrlp_tabpage_position|......Where to put the new tab page.\n  |ctrlp_working_path_mode|.....How to set CtrlP's local working directory.\n  |ctrlp_root_markers|..........Additional, high priority root markers.\n  |ctrlp_use_caching|...........Use per-session caching or not.\n  |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.\n  |ctrlp_cache_dir|.............Location of the cache directory.\n  |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.\n  |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.\n  |ctrlp_max_files|.............Number of files to scan initially.\n  |ctrlp_max_depth|.............Directory depth to recurse into when scanning.\n  |ctrlp_user_command|..........Use an external scanner.\n  |ctrlp_max_history|...........Number of entries saved in the prompt history.\n  |ctrlp_open_new_file|.........How to open a file created by <c-y>.\n  |ctrlp_open_multiple_files|...How to open files selected by <c-z>.\n  |ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.\n  |ctrlp_follow_symlinks|.......Follow symbolic links or not.\n  |ctrlp_lazy_update|...........Only update when typing has stopped.\n  |ctrlp_default_input|.........Seed the prompt with an initial string.\n  |ctrlp_abbrev|................Input abbreviations.\n  |ctrlp_key_loop|..............Use input looping for multi-byte input.\n  |ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.\n  |ctrlp_prompt_mappings|.......Change the mappings inside the prompt.\n\n  MRU mode:\n  |ctrlp_mruf_max|..............Max MRU entries to remember.\n  |ctrlp_mruf_exclude|..........Files that shouldn't be remembered.\n  |ctrlp_mruf_include|..........Files to be remembered.\n  |ctrlp_mruf_relative|.........Show only MRU files in the working directory.\n  |ctrlp_mruf_default_order|....Disable sorting.\n  |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.\n  |ctrlp_mruf_save_on_update|...Save to disk whenever a new entry is added.\n\n  BufferTag mode: (to enable, see |ctrlp-extensions|)\n  |g:ctrlp_buftag_ctags_bin|....The location of the ctags-compatible binary.\n  |g:ctrlp_buftag_systemenc|....The encoding used for the ctags command.\n  |g:ctrlp_buftag_types|........Add new filetypes and set the cmd arguments.\n\n  Advanced options:\n  |ctrlp_open_func|.............Use custom file opening functions.\n  |ctrlp_status_func|...........Change CtrlP's two statuslines.\n  |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.\n  |ctrlp_match_func|............Replace the built-in matching algorithm.\n\n-------------------------------------------------------------------------------\nDetailed descriptions and default values:~\n\n                                                                *'g:ctrlp_map'*\nUse this option to change the mapping to invoke CtrlP in |Normal| mode: >\n  let g:ctrlp_map = '<c-p>'\n<\n\n                                                                *'g:ctrlp_cmd'*\nSet the default opening command to use when pressing the above mapping: >\n  let g:ctrlp_cmd = 'CtrlP'\n<\n\n                                                             *'g:loaded_ctrlp'*\nUse this to disable the plugin completely: >\n  let g:loaded_ctrlp = 1\n<\n\n                                                        *'g:ctrlp_by_filename'*\nSet this to 1 to set searching by filename (as opposed to full path) as the\ndefault: >\n  let g:ctrlp_by_filename = 0\n<\nCan be toggled on/off by pressing <c-d> inside the prompt.\n\n                                                             *'g:ctrlp_regexp'*\nSet this to 1 to set regexp search as the default: >\n  let g:ctrlp_regexp = 0\n<\nCan be toggled on/off by pressing <c-r> inside the prompt.\n\n                                                       *'g:ctrlp_match_window'*\nChange the postion, the listing order of results, the minimum and the maximum\nheights of the match window: >\n  let g:ctrlp_match_window = ''\n<\nExample: >\n  let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10'\n<\nThe position: (default: bottom)\n  top - show the match window at the top of the screen.\n  bottom - show the match window at the bottom of the screen.\n\nThe listing order of results: (default: btt)\n  order:ttb - from top to bottom.\n  order:btt - from bottom to top.\n\nThe minimum and maximum heights:\n  min:{n} - show minimum {n} lines (default: 1).\n  max:{n} - show maximum {n} lines (default: 10).\n\nThe maximum number of results:\n  results:{n} - list maximum {n} results (default: sync with max height).\n\nNote: When a setting isn't set, its default value will be used.\n\n                                                      *'g:ctrlp_switch_buffer'*\nWhen opening a file, if it's already open in a window somewhere, CtrlP will try\nto jump to it instead of opening a new instance: >\n  let g:ctrlp_switch_buffer = 'Et'\n<\n  e - jump when <cr> is pressed, but only to windows in the current tab.\n  t - jump when <c-t> is pressed, but only to windows in another tab.\n  v - like \"e\", but jump when <c-v> is pressed.\n  h - like \"e\", but jump when <c-x> is pressed.\n  E, T, V, H - like \"e\", \"t\", \"v\", and \"h\", but jump to windows anywhere.\n  0 or <empty> - disable this feature.\n\n                                                       *'g:ctrlp_reuse_window'*\nWhen opening a file with <cr>, CtrlP avoids opening it in windows created by\nplugins, help and quickfix. Use this to setup some exceptions: >\n  let g:ctrlp_reuse_window = 'netrw'\n<\nAcceptable values are partial name, filetype or buftype of the special buffers.\nUse regexp to specify the pattern.\nExample: >\n  let g:ctrlp_reuse_window = 'netrw\\|help\\|quickfix'\n<\n\n                                                   *'g:ctrlp_tabpage_position'*\nWhere to put the new tab page when opening one: >\n  let g:ctrlp_tabpage_position = 'ac'\n<\n  a - after.\n  b - before.\n  c - the current tab page.\n  l - the last tab page.\n  f - the first tab page.\n\n                                                  *'g:ctrlp_working_path_mode'*\nWhen starting up, CtrlP sets its local working directory according to this\nvariable: >\n  let g:ctrlp_working_path_mode = 'ra'\n<\n  c - the directory of the current file.\n  a - like \"c\", but only applies when the current working directory outside of\n      CtrlP isn't a direct ancestor of the directory of the current file.\n  r - the nearest ancestor that contains one of these directories or files:\n      .git .hg .svn .bzr _darcs\n  w - begin finding a root from the current working directory outside of CtrlP\n      instead of from the directory of the current file (default). Only applies\n      when \"r\" is also present.\n  0 or <empty> - disable this feature.\n\nNote #1: if \"a\" or \"c\" is included with \"r\", use the behavior of \"a\" or \"c\" (as\na fallback) when a root can't be found.\n\nNote #2: you can use a |b:var| to set this option on a per buffer basis.\n\n                                                       *'g:ctrlp_root_markers'*\nUse this to set your own root markers in addition to the default ones (.git,\n.hg, .svn, .bzr, and _darcs). Your markers will take precedence: >\n  let g:ctrlp_root_markers = ['']\n<\nNote: you can use a |b:var| to set this option on a per buffer basis.\n\n                                                        *'g:ctrlp_use_caching'*\nEnable/Disable per-session caching: >\n  let g:ctrlp_use_caching = 1\n<\n  0 - Disable caching.\n  1 - Enable caching.\n  n - When bigger than 1, disable caching and use the number as the limit to\n      enable caching again.\n\nNote: you can quickly purge the cache by pressing <F5> while inside CtrlP.\n\n                                                *'g:ctrlp_clear_cache_on_exit'*\nSet this to 0 to enable cross-session caching by not deleting the cache files\nupon exiting Vim: >\n  let g:ctrlp_clear_cache_on_exit = 1\n<\n\n                                                          *'g:ctrlp_cache_dir'*\nSet the directory to store the cache files: >\n  let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'\n<\n\n                                                        *'g:ctrlp_show_hidden'*\nSet this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >\n  let g:ctrlp_show_hidden = 0\n<\nNote: does not apply when a command defined with |g:ctrlp_user_command| is\nbeing used.\n\n                                                           *'ctrlp-wildignore'*\nYou can use Vim's |'wildignore'| to exclude files and directories from the\nresults.\nExamples: >\n  \" Excluding version control directories\n  set wildignore+=*/.git/*,*/.hg/*,*/.svn/*        \" Linux/MacOSX\n  set wildignore+=*\\\\.git\\\\*,*\\\\.hg\\\\*,*\\\\.svn\\\\*  \" Windows ('noshellslash')\n<\nNote #1: the `*/` in front of each directory glob is required.\n\nNote #2: |wildignore| influences the result of |expand()|, |globpath()| and\n|glob()| which many plugins use to find stuff on the system (e.g. VCS related\nplugins look for .git/, .hg/,... some other plugins look for external *.exe\ntools on Windows). So be a little mindful of what you put in your |wildignore|.\n\n                                                      *'g:ctrlp_custom_ignore'*\nIn addition to |'wildignore'|, use this for files and directories you want only\nCtrlP to not show. Use regexp to specify the patterns: >\n  let g:ctrlp_custom_ignore = ''\n<\nExamples: >\n  let g:ctrlp_custom_ignore = '\\v[\\/]\\.(git|hg|svn)$'\n  let g:ctrlp_custom_ignore = {\n    \\ 'dir':  '\\v[\\/]\\.(git|hg|svn)$',\n    \\ 'file': '\\v\\.(exe|so|dll)$',\n    \\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',\n    \\ }\n  let g:ctrlp_custom_ignore = {\n    \\ 'file': '\\v(\\.cpp|\\.h|\\.hh|\\.cxx)@<!$'\n    \\ }\n<\nNote #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when\n|globpath()| is used to scan for files, thus these options do not apply when a\ncommand defined with |g:ctrlp_user_command| is being used.\n\nNote #2: when changing the option's variable type, remember to |:unlet| it\nfirst or restart Vim to avoid the \"E706: Variable type mismatch\" error.\n\n                                                          *'g:ctrlp_max_files'*\nThe maximum number of files to scan, set to 0 for no limit: >\n  let g:ctrlp_max_files = 10000\n<\nNote: does not apply when a command defined with |g:ctrlp_user_command| is\nbeing used.\n\n                                                          *'g:ctrlp_max_depth'*\nThe maximum depth of a directory tree to recurse into: >\n  let g:ctrlp_max_depth = 40\n<\nNote: does not apply when a command defined with |g:ctrlp_user_command| is\nbeing used.\n\n                                                       *'g:ctrlp_user_command'*\nSpecify an external tool to use for listing files instead of using Vim's\n|globpath()|. Use %s in place of the target directory: >\n  let g:ctrlp_user_command = ''\n<\nExamples: >\n  let g:ctrlp_user_command = 'find %s -type f'       \" MacOSX/Linux\n  let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' \" Windows\n<\nYou can also use 'grep', 'findstr' or something else to filter the results.\nExamples: >\n  let g:ctrlp_user_command =\n    \\ 'find %s -type f | grep -v -P \"\\.jpg$|/tmp/\"'          \" MacOSX/Linux\n  let g:ctrlp_user_command =\n    \\ 'dir %s /-n /b /s /a-d | findstr /v /l \".jpg \\\\tmp\\\\\"' \" Windows\n<\nUse a version control listing command when inside a repository, this is faster\nwhen scanning large projects: >\n  let g:ctrlp_user_command = [root_marker, listing_command, fallback_command]\n  let g:ctrlp_user_command = {\n    \\ 'types': {\n      \\ 1: [root_marker_1, listing_command_1],\n      \\ n: [root_marker_n, listing_command_n],\n      \\ },\n    \\ 'fallback': fallback_command,\n    \\ 'ignore': 0 or 1\n    \\ }\n<\nSome examples: >\n  \" Single VCS, listing command does not list untracked files:\n  let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']\n  let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']\n\n  \" Multiple VCS's:\n  let g:ctrlp_user_command = {\n    \\ 'types': {\n      \\ 1: ['.git', 'cd %s && git ls-files'],\n      \\ 2: ['.hg', 'hg --cwd %s locate -I .'],\n      \\ },\n    \\ 'fallback': 'find %s -type f'\n    \\ }\n\n  \" Single VCS, listing command lists untracked files (slower):\n  let g:ctrlp_user_command =\n    \\ ['.git', 'cd %s && git ls-files . -co --exclude-standard']\n\n  let g:ctrlp_user_command =\n    \\ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] \" MacOSX/Linux\n\n  let g:ctrlp_user_command = ['.hg', 'for /f \"tokens=1\" %%a in (''hg root'') '\n    \\ . 'do hg --cwd %s status -numac -I . %%a']           \" Windows\n<\nNote #1: in the |Dictionary| format, 'fallback' and 'ignore' are optional. In\nthe |List| format, fallback_command is optional.\n\nNote #2: if the fallback_command is empty or the 'fallback' key is not defined,\n|globpath()| will then be used when scanning outside of a repository.\n\nNote #3: unless the |Dictionary| format is used and 'ignore' is defined and set\nto 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when\nthese custom commands are being used. When not present, 'ignore' is set to 0 by\ndefault to retain the performance advantage of using external commands.\n\nNote #4: when changing the option's variable type, remember to |:unlet| it\nfirst or restart Vim to avoid the \"E706: Variable type mismatch\" error.\n\nNote #5: you can use a |b:var| to set this option on a per buffer basis.\n\n                                                        *'g:ctrlp_max_history'*\nThe maximum number of input strings you want CtrlP to remember. The default\nvalue mirrors Vim's global |'history'| option: >\n  let g:ctrlp_max_history = &history\n<\nSet to 0 to disable prompt's history. Browse the history with <c-n> and <c-p>.\n\n                                                      *'g:ctrlp_open_new_file'*\nUse this option to specify how the newly created file is to be opened when\npressing <c-y>: >\n  let g:ctrlp_open_new_file = 'v'\n<\n  t - in a new tab.\n  h - in a new horizontal split.\n  v - in a new vertical split.\n  r - in the current window.\n\n                                                *'g:ctrlp_open_multiple_files'*\nIf non-zero, this will enable opening multiple files with <c-z> and <c-o>: >\n  let g:ctrlp_open_multiple_files = 'v'\n<\nExample: >\n  let g:ctrlp_open_multiple_files = '2vjr'\n<\nFor the number:\n  - If given, it'll be used as the maximum number of windows or tabs to create\n    when opening the files (the rest will be opened as hidden buffers).\n  - If not given, <c-o> will open all files, each in a new window or new tab.\n\nFor the letters:\n  t - each file in a new tab.\n  h - each file in a new horizontal split.\n  v - each file in a new vertical split.\n  i - all files as hidden buffers.\n  j - after opening, jump to the first opened tab or window.\n  r - open the first file in the current window, then the remaining files in\n      new splits or new tabs depending on which of \"h\", \"v\" and \"t\" is also\n      present.\n\n                                                            *'g:ctrlp_arg_map'*\nWhen this is set to 1, the <c-o> and <c-y> mappings will accept one extra key\nas an argument to override their default behavior: >\n  let g:ctrlp_arg_map = 0\n<\nPressing <c-o> or <c-y> will then prompt for a keypress. The key can be:\n  t - open in tab(s)\n  h - open in horizontal split(s)\n  v - open in vertical split(s)\n  i - open as hidden buffers (for <c-o> only)\n  c - clear the marked files (for <c-o> only)\n  r - open in the current window (for <c-y> only)\n  <esc>, <c-c>, <c-u> - cancel and go back to the prompt.\n  <cr> - use the default behavior specified with |g:ctrlp_open_new_file| and\n  |g:ctrlp_open_multiple_files|.\n\n                                                    *'g:ctrlp_follow_symlinks'*\nIf non-zero, CtrlP will follow symbolic links when listing files: >\n  let g:ctrlp_follow_symlinks = 0\n<\n  0 - don't follow symbolic links.\n  1 - follow but ignore looped internal symlinks to avoid duplicates.\n  2 - follow all symlinks indiscriminately.\n\nNote: does not apply when a command defined with |g:ctrlp_user_command| is\nbeing used.\n\n                                                        *'g:ctrlp_lazy_update'*\nSet this to 1 to enable the lazy-update feature: only update the match window\nafter typing's been stopped for a certain amount of time: >\n  let g:ctrlp_lazy_update = 0\n<\nIf is 1, update after 250ms. If bigger than 1, the number will be used as the\ndelay time in milliseconds.\n\n                                                      *'g:ctrlp_default_input'*\nSet this to 1 to enable seeding the prompt with the current file's relative\npath: >\n  let g:ctrlp_default_input = 0\n<\nInstead of 1 or 0, if the value of the option is a string, it'll be used as-is\nas the default input: >\n  let g:ctrlp_default_input = 'anystring'\n<\n\n                                                             *'g:ctrlp_abbrev'*\nDefine input abbreviations that can be expanded (either internally or visibly)\nin the prompt: >\n  let g:ctrlp_abbrev = {}\n<\nExamples: >\n  let g:ctrlp_abbrev = {\n    \\ 'gmode': 'i',\n    \\ 'abbrevs': [\n      \\ {\n        \\ 'pattern': '^cd b',\n        \\ 'expanded': '@cd ~/.vim/bundle',\n        \\ 'mode': 'pfrz',\n      \\ },\n      \\ {\n        \\ 'pattern': '\\(^@.\\+\\|\\\\\\@<!:.\\+\\)\\@<! ',\n        \\ 'expanded': '.\\{-}',\n        \\ 'mode': 'pfr',\n      \\ },\n      \\ {\n        \\ 'pattern': '\\\\\\@<!:.\\+\\zs\\\\\\@<! ',\n        \\ 'expanded': '\\ ',\n        \\ 'mode': 'pfz',\n      \\ },\n      \\ ]\n    \\ }\n<\nThe 'pattern' string is regexp matched against the entered input. The expansion\nis as if the 'expanded' string was typed into the prompt.\n\nFor 'gmode' (optional):\n  i - expand internally (default).\n  t - insert the expanded results into the prompt as you type.\n  k - insert the expanded results when a non-keyword character is typed. Only\n      applies when \"t\" is also present.\n\nFor 'mode' (of each entry; optional):\n  f - only in filename mode.\n  p - only in full path mode.\n  r - only in regexp mode.\n  z - only in fuzzy mode.\n  n - only when creating a new file with <c-y> (use the expanded string in the\n      new filename).\n  c - only when auto-completing directory names with <tab> (expand the pattern\n      immediately before doing the auto-completion).\n  <empty> or not defined - always enable.\n\nNote: the abbrev entries are evaluated in sequence, so a later entry can be\nevaluated against the expanded result of a previous entry; this includes itself\nwhen 'gmode' is \"t\".\n\n                                                           *'g:ctrlp_key_loop'*\nAn experimental feature. Set this to 1 to enable input looping for the typing\nof multi-byte characters: >\n  let g:ctrlp_key_loop = 0\n<\nNote #1: when set, this option resets the |g:ctrlp_lazy_update| option.\n\nNote #2: you can toggle this feature inside the prompt with a custom mapping: >\n  let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }\n<\n\n                                                         *'g:ctrlp_use_migemo'*\nSet this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only\nworks in regexp mode. To split the pattern, separate words with space: >\n  let g:ctrlp_use_migemo = 0\n<\n\n                                                    *'g:ctrlp_prompt_mappings'*\nUse this to customize the mappings inside CtrlP's prompt to your liking. You\nonly need to keep the lines that you've changed the values (inside []): >\n  let g:ctrlp_prompt_mappings = {\n    \\ 'PrtBS()':              ['<bs>', '<c-]>'],\n    \\ 'PrtDelete()':          ['<del>'],\n    \\ 'PrtDeleteWord()':      ['<c-w>'],\n    \\ 'PrtClear()':           ['<c-u>'],\n    \\ 'PrtSelectMove(\"j\")':   ['<c-j>', '<down>'],\n    \\ 'PrtSelectMove(\"k\")':   ['<c-k>', '<up>'],\n    \\ 'PrtSelectMove(\"t\")':   ['<Home>', '<kHome>'],\n    \\ 'PrtSelectMove(\"b\")':   ['<End>', '<kEnd>'],\n    \\ 'PrtSelectMove(\"u\")':   ['<PageUp>', '<kPageUp>'],\n    \\ 'PrtSelectMove(\"d\")':   ['<PageDown>', '<kPageDown>'],\n    \\ 'PrtHistory(-1)':       ['<c-n>'],\n    \\ 'PrtHistory(1)':        ['<c-p>'],\n    \\ 'AcceptSelection(\"e\")': ['<cr>', '<2-LeftMouse>'],\n    \\ 'AcceptSelection(\"h\")': ['<c-x>', '<c-cr>', '<c-s>'],\n    \\ 'AcceptSelection(\"t\")': ['<c-t>'],\n    \\ 'AcceptSelection(\"v\")': ['<c-v>', '<RightMouse>'],\n    \\ 'ToggleFocus()':        ['<s-tab>'],\n    \\ 'ToggleRegex()':        ['<c-r>'],\n    \\ 'ToggleByFname()':      ['<c-d>'],\n    \\ 'ToggleType(1)':        ['<c-f>', '<c-up>'],\n    \\ 'ToggleType(-1)':       ['<c-b>', '<c-down>'],\n    \\ 'PrtExpandDir()':       ['<tab>'],\n    \\ 'PrtInsert(\"c\")':       ['<MiddleMouse>', '<insert>'],\n    \\ 'PrtInsert()':          ['<c-\\>'],\n    \\ 'PrtCurStart()':        ['<c-a>'],\n    \\ 'PrtCurEnd()':          ['<c-e>'],\n    \\ 'PrtCurLeft()':         ['<c-h>', '<left>', '<c-^>'],\n    \\ 'PrtCurRight()':        ['<c-l>', '<right>'],\n    \\ 'PrtClearCache()':      ['<F5>'],\n    \\ 'PrtDeleteEnt()':       ['<F7>'],\n    \\ 'CreateNewFile()':      ['<c-y>'],\n    \\ 'MarkToOpen()':         ['<c-z>'],\n    \\ 'OpenMulti()':          ['<c-o>'],\n    \\ 'PrtExit()':            ['<esc>', '<c-c>', '<c-g>'],\n    \\ }\n<\nNote: if pressing <bs> moves the cursor one character to the left instead of\ndeleting a character for you, add this to your |.vimrc| to disable the plugin's\ndefault <c-h> mapping: >\n  let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }\n<\n\n----------------------------------------\nMRU mode options:~\n\n                                                           *'g:ctrlp_mruf_max'*\nSpecify the number of recently opened files you want CtrlP to remember: >\n  let g:ctrlp_mruf_max = 250\n<\n\n                                                       *'g:ctrlp_mruf_exclude'*\nFiles you don't want CtrlP to remember. Use regexp to specify the patterns: >\n  let g:ctrlp_mruf_exclude = ''\n<\nExamples: >\n  let g:ctrlp_mruf_exclude = '/tmp/.*\\|/temp/.*' \" MacOSX/Linux\n  let g:ctrlp_mruf_exclude = '^C:\\\\dev\\\\tmp\\\\.*' \" Windows\n<\n\n                                                       *'g:ctrlp_mruf_include'*\nAnd if you want CtrlP to only remember some files, specify them here: >\n  let g:ctrlp_mruf_include = ''\n<\nExample: >\n  let g:ctrlp_mruf_include = '\\.py$\\|\\.rb$'\n<\n\n                                                      *'g:ctrlp_mruf_relative'*\nSet this to 1 to show only MRU files in the current working directory: >\n  let g:ctrlp_mruf_relative = 0\n<\nNote: you can use a custom mapping to toggle this option inside the prompt: >\n  let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': ['<F2>'] }\n<\n\n                                                 *'g:ctrlp_mruf_default_order'*\nSet this to 1 to disable sorting when searching in MRU mode: >\n  let g:ctrlp_mruf_default_order = 0\n<\n\n                                                *'g:ctrlp_mruf_case_sensitive'*\nMatch this with your file system case-sensitivity setting to avoid duplicate\nMRU entries: >\n  let g:ctrlp_mruf_case_sensitive = 1\n<\n\n                                                *'g:ctrlp_mruf_save_on_update'*\nSet this to 0 to disable saving of the MRU list to hard drive whenever a new\nentry is added, saving will then only occur when exiting Vim: >\n  let g:ctrlp_mruf_save_on_update = 1\n<\n\n----------------------------------------\nAdvanced options:~\n\n                                                          *'g:ctrlp_open_func'*\nDefine a custom function to open the selected file: >\n  let g:ctrlp_open_func = {}\n<\nExample: >\n  let g:ctrlp_open_func = {\n    \\ 'files'     : 'Function_Name_1',\n    \\ 'buffers'   : 'Function_Name_2',\n    \\ 'mru files' : 'Function_Name_3',\n    \\ }\n<\nStructure of the functions: >\n  function! Function_Name(action, line)\n    \" Arguments:\n    \" |\n    \" +- a:action : The opening action:\n    \" |             + 'e' : user pressed <cr>  (default)\n    \" |             + 'h' : user pressed <c-x> (default)\n    \" |             + 'v' : user pressed <c-v> (default)\n    \" |             + 't' : user pressed <c-t> (default)\n    \" |             + 'x' : user used the <c-o> console dialog (default) and\n    \" |                     chose \"e[x]ternal\".\n    \" |\n    \" +- a:line   : The selected line.\n\n  endfunction\n<\nNote: does not apply when opening multiple files with <c-z> and <c-o>.\n\nExample: open HTML files in the default web browser when <c-t> is pressed and\nin Vim otherwise >\n  function! HTMLOpenFunc(action, line)\n    if a:action =~ '^[tx]$' && fnamemodify(a:line, ':e') =~? '^html\\?$'\n\n      \" Get the filename\n      let filename = fnameescape(fnamemodify(a:line, ':p'))\n\n      \" Close CtrlP\n      call ctrlp#exit()\n\n      \" Open the file\n      silent! execute '!xdg-open' filename\n\n    elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\\?$'\n\n      \" Not a HTML file, simulate pressing <c-o> again and wait for new input\n      call feedkeys(\"\\<c-o>\")\n\n    else\n\n      \" Use CtrlP's default file opening function\n      call call('ctrlp#acceptfile', [a:action, a:line])\n\n    endif\n  endfunction\n\n  let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' }\n<\n\n                                                        *'g:ctrlp_status_func'*\nUse this to customize the statuslines for the CtrlP window: >\n  let g:ctrlp_status_func = {}\n<\nExample: >\n  let g:ctrlp_status_func = {\n    \\ 'main': 'Function_Name_1',\n    \\ 'prog': 'Function_Name_2',\n    \\ }\n<\nStructure of the functions: >\n  \" Main statusline\n  function! Function_Name_1(focus, byfname, regex, prev, item, next, marked)\n    \" Arguments:\n    \" |\n    \" +- a:focus   : The focus of the prompt: \"prt\" or \"win\".\n    \" |\n    \" +- a:byfname : In filename mode or in full path mode: \"file\" or \"path\".\n    \" |\n    \" +- a:regex   : In regex mode: 1 or 0.\n    \" |\n    \" +- a:prev    : The previous search mode.\n    \" |\n    \" +- a:item    : The current search mode.\n    \" |\n    \" +- a:next    : The next search mode.\n    \" |\n    \" +- a:marked  : The number of marked files, or a comma separated list of\n    \"                the marked filenames.\n\n    return full_statusline\n  endfunction\n\n  \" Progress statusline\n  function! Function_Name_2(str)\n    \" a:str : Either the number of files scanned so far, or a string indicating\n    \"         the current directory is being scanned with a user_command.\n\n    return full_statusline\n  endfunction\n<\nSee https://gist.github.com/1610859 for a working example.\n\n                                                        *'g:ctrlp_buffer_func'*\nSpecify the functions that will be called after entering and before exiting the\nCtrlP buffer: >\n  let g:ctrlp_buffer_func = {}\n<\nExample: >\n  let g:ctrlp_buffer_func = {\n    \\ 'enter': 'Function_Name_1',\n    \\ 'exit':  'Function_Name_2',\n    \\ }\n<\n\n                                                         *'g:ctrlp_match_func'*\nSet an external fuzzy matching function for CtrlP to use: >\n  let g:ctrlp_match_func = {}\n<\nExample: >\n  let g:ctrlp_match_func = { 'match': 'Function_Name' }\n<\nStructure of the function: >\n  function! Function_Name(items, str, limit, mmode, ispath, crfile, regex)\n    \" Arguments:\n    \" |\n    \" +- a:items  : The full list of items to search in.\n    \" |\n    \" +- a:str    : The string entered by the user.\n    \" |\n    \" +- a:limit  : The max height of the match window. Can be used to limit\n    \" |             the number of items to return.\n    \" |\n    \" +- a:mmode  : The match mode. Can be one of these strings:\n    \" |             + \"full-line\": match the entire line.\n    \" |             + \"filename-only\": match only the filename.\n    \" |             + \"first-non-tab\": match until the first tab char.\n    \" |             + \"until-last-tab\": match until the last tab char.\n    \" |\n    \" +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and\n    \" |             rtscript modes. Is 0 otherwise.\n    \" |\n    \" +- a:crfile : The file in the current window. Should be excluded from the\n    \" |             results when a:ispath == 1.\n    \" |\n    \" +- a:regex  : In regex mode: 1 or 0.\n\n    return list_of_matched_items\n  endfunction\n<\n\nNote: you can extend any of the above options with { 'arg_type': 'dict' } to\nenable passing all the function arguments in a single Dictionary argument. Use\nthe existing argument names as keys in this Dictionary.\n\nExample: >\n  let g:ctrlp_status_func = {\n    \\ 'arg_type' : 'dict',\n    \\ 'enter': 'Function_Name_1',\n    \\ 'exit':  'Function_Name_2',\n    \\ }\n\n  function! Function_Name_1(dict)\n    \" where dict == {\n    \" \\ 'focus':   value,\n    \" \\ 'byfname': value,\n    \" \\ 'regex':   value,\n    \" \\ ...\n    \" }\n  endfunction\n<\n\n===============================================================================\nCOMMANDS                                                       *ctrlp-commands*\n\n                                                                       *:CtrlP*\n:CtrlP [starting-directory]\n   Open CtrlP in find file mode.\n\n   If no argument is given, the value of |g:ctrlp_working_path_mode| will be\n   used to determine the starting directory.\n\n   You can use <tab> to auto-complete the [starting-directory] when typing it.\n\n                                                                 *:CtrlPBuffer*\n:CtrlPBuffer\n   Open CtrlP in find buffer mode.\n\n                                                                    *:CtrlPMRU*\n:CtrlPMRU\n   Open CtrlP in find Most-Recently-Used file mode.\n\n                                                               *:CtrlPLastMode*\n:CtrlPLastMode [--dir]\n   Open CtrlP in the last mode used. When having the \"--dir\" argument, also\n   reuse the last working directory.\n\n                                                                   *:CtrlPRoot*\n:CtrlPRoot\n    This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores\n    the variable's current value.\n\n                                                             *:CtrlPClearCache*\n:CtrlPClearCache\n   Flush the cache for the current working directory. The same as pressing <F5>\n   inside CtrlP.\n   To enable or disable caching, use the |g:ctrlp_use_caching| option.\n\n                                                         *:CtrlPClearAllCaches*\n:CtrlPClearAllCaches\n   Delete all the cache files saved in |g:ctrlp_cache_dir| location.\n\n-------------------------------------------------------------------------------\nFor commands provided by bundled extensions, see |ctrlp-extensions|.\n\n===============================================================================\nMAPPINGS                                                       *ctrlp-mappings*\n\n                                                                *'ctrlp-<c-p>'*\n<c-p>\n   Default |Normal| mode mapping to open the CtrlP prompt in find file mode.\n\n----------------------------------------\nOnce inside the prompt:~\n\n  <c-d>\n    Toggle between full-path search and filename only search.\n    Note: in filename mode, the prompt's base is '>d>' instead of '>>>'\n\n  <c-r>                                                    *'ctrlp-fullregexp'*\n    Toggle between the string mode and full regexp mode.\n    Note: in full regexp mode, the prompt's base is 'r>>' instead of '>>>'\n\n    See also: |input-formats| (guide) and |g:ctrlp_regexp_search| (option).\n\n  <c-f>, 'forward'\n  <c-up>\n    Scroll to the 'next' search mode in the sequence.\n\n  <c-b>, 'backward'\n  <c-down>\n    Scroll to the 'previous' search mode in the sequence.\n\n  <tab>                                                *'ctrlp-autocompletion'*\n    Auto-complete directory names under the current working directory inside\n    the prompt.\n\n  <s-tab>\n    Toggle the focus between the match window and the prompt.\n\n  <esc>,\n  <c-c>\n    Exit CtrlP.\n\nMoving:~\n\n  <c-j>,\n  <down>\n    Move selection down.\n\n  <c-k>,\n  <up>\n    Move selection up.\n\n  <c-a>\n    Move the cursor to the 'start' of the prompt.\n\n  <c-e>\n    Move the cursor to the 'end' of the prompt.\n\n  <c-h>,\n  <left>,\n  <c-^>\n    Move the cursor one character to the 'left'.\n\n  <c-l>,\n  <right>\n    Move the cursor one character to the 'right'.\n\nEditing:~\n\n  <c-]>,\n  <bs>\n    Delete the preceding character.\n\n  <del>\n    Delete the current character.\n\n  <c-w>\n    Delete a preceding inner word.\n\n  <c-u>\n    Clear the input field.\n\nBrowsing input history:~\n\n  <c-n>\n    Next string in the prompt's history.\n\n  <c-p>\n    Previous string in the prompt's history.\n\nOpening/Creating a file:~\n\n  <cr>\n    Open the selected file in the 'current' window if possible.\n\n  <c-t>\n    Open the selected file in a new 'tab'.\n\n  <c-v>\n    Open the selected file in a 'vertical' split.\n\n  <c-x>,\n  <c-cr>,\n  <c-s>\n    Open the selected file in a 'horizontal' split.\n\n  <c-y>\n    Create a new file and its parent directories.\n\nOpening multiple files:~\n\n  <c-z>\n    - Mark/unmark a file to be opened with <c-o>.\n    - Mark/unmark a file to create a new file in its directory using <c-y>.\n\n  <c-o>\n    - Open files marked by <c-z>.\n    - When no file has been marked by <c-z>, open a console dialog with the\n      following options:\n\n      Open the selected file:\n        t - in a tab page.\n        v - in a vertical split.\n        h - in a horizontal split.\n        r - in the current window.\n        i - as a hidden buffer.\n        x - (optional) with the function defined in |g:ctrlp_open_func|.\n\n      Other options (not shown):\n        a - mark all files in the match window.\n        d - change CtrlP's local working directory to the selected file's\n            directory and switch to find file mode.\n\nFunction keys:~\n\n  <F5>\n    - Refresh the match window and purge the cache for the current directory.\n    - Remove deleted files from the MRU list.\n\n  <F7>\n    - Wipe the MRU list.\n    - Delete MRU entries marked by <c-z>.\n\nPasting:~\n\n  <Insert>,                                                   *'ctrlp-pasting'*\n  <MiddleMouse>\n    Paste the clipboard content into the prompt.\n\n  <c-\\>\n    Open a console dialog to paste <cword>, <cfile>, the content of the search\n    register, the last visual selection, the clipboard or any register into the\n    prompt.\n\nChoose your own mappings with |g:ctrlp_prompt_mappings|.\n\n----------------------------------------\nWhen inside the match window (press <s-tab> to switch):~\n\n  a-z\n  0-9\n  ~^-=;`',.+!@#$%&_(){}[]\n    Cycle through the lines which have the matching first character.\n\n===============================================================================\nINPUT FORMATS                                             *ctrlp-input-formats*\n\nFormats for inputting in the prompt:~\n\na)  Simple string.\n\n    E.g. 'abc' is understood internally as 'a[^a]\\{-}b[^b]\\{-}c'\n\nb)  When in regexp mode, the input string's treated as a Vim's regexp |pattern|\n    without any modification.\n\n    E.g. 'abc\\d*efg' will be read as 'abc\\d*efg'.\n\n    See |ctrlp-fullregexp| (keymap) and |g:ctrlp_regexp_search| (option) for\n    how to enable regexp mode.\n\nc)  End the string with a colon ':' followed by a Vim command to execute that\n    command after opening the file. If you need to use ':' literally, escape it\n    with a backslash: '\\:'. When opening multiple files, the command will be\n    executed on each opening file.\n\n    E.g. Use ':45' to jump to line 45.\n\n         Use ':/any\\:string' to jump to the first instance of 'any:string'.\n\n         Use ':+setf\\ myfiletype|50' to set the filetype to 'myfiletype', then\n         jump to line 50.\n\n         Use ':diffthis' when opening multiple files to run |:diffthis| on the\n         first 4 files.\n\n    See also: Vim's |++opt| and |+cmd|.\n\nd)  Submit two dots '..' to go upward the directory tree by 1 level. To go up\n    multiple levels, use one extra dot for each extra level:\n>\n         Raw input    Interpreted as\n         ..           ../\n         ...          ../../\n         ....         ../../../\n<\n    Note: if the parent directories are large and uncached, this can be slow.\n\n    You can also use '@cd path/' to change CtrlP's local working directory.\n    Use '@cd %:h' to change to the directory of the current file.\n\ne)  Similarly, submit '/' or '\\' to find and go to the project's root.\n\n    If the project is large, using a VCS listing command to look for files\n    might help speeding up the intial scan (see |g:ctrlp_user_command| for more\n    details).\n\n    Note: d) and e) only work in file, directory and mixed modes.\n\nf)  Type the name of a non-existent file and press <c-y> to create it. Mark a\n    file with <c-z> to create the new file in the same directory as the marked\n    file.\n\n    E.g. Using 'newdir/newfile.txt' will create a directory named 'newdir' as\n         well as a file named 'newfile.txt'.\n\n         If an entry 'some/old/dirs/oldfile.txt' is marked with <c-z>, then\n         'newdir' and 'newfile.txt' will be created under 'some/old/dirs'. The\n         final path will then be 'some/old/dirs/newdir/newfile.txt'.\n\n    Note: use '\\' in place of '/' on Windows (if |'shellslash'| is not set).\n\ng)  In filename mode (toggle with <c-d>), you can use one primary pattern and\n    one refining pattern separated by a semicolon. Both patterns work like (a),\n    or (b) when in regexp mode.\n\nh)  Submit ? to open this help file.\n\n===============================================================================\nEXTENSIONS                                                   *ctrlp-extensions*\n\nExtensions are optional. To enable an extension, add its name to the variable\ng:ctrlp_extensions: >\n  let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript',\n                          \\ 'undo', 'line', 'changes', 'mixed', 'bookmarkdir']\n<\nThe order of the items will be the order they appear on the statusline and when\nusing <c-f>, <c-b>.\n\nAvailable extensions:~\n\n                                                                    *:CtrlPTag*\n  * Tag mode:~\n    - Name: 'tag'\n    - Command: \":CtrlPTag\"\n    - Search for a tag within a generated central tags file, and jump to the\n      definition. Use the Vim's option |'tags'| to specify the names and the\n      locations of the tags file(s).\n      E.g. set tags+=doc/tags\n\n                                                                 *:CtrlPBufTag*\n                                                              *:CtrlPBufTagAll*\n  * Buffer Tag mode:~\n    - Name: 'buffertag'\n    - Commands: \":CtrlPBufTag [buffer]\",\n                \":CtrlPBufTagAll\".\n    - Search for a tag within the current buffer or all listed buffers and jump\n      to the definition. Requires |exuberant_ctags| or compatible programs.\n\n                                                               *:CtrlPQuickfix*\n  * Quickfix mode:~\n    - Name: 'quickfix'\n    - Command: \":CtrlPQuickfix\"\n    - Search for an entry in the current quickfix errors and jump to it.\n\n                                                                    *:CtrlPDir*\n  * Directory mode:~\n    - Name: 'dir'\n    - Command: \":CtrlPDir [starting-directory]\"\n    - Search for a directory and change the working directory to it.\n    - Mappings:\n      + <cr> change the local working directory for CtrlP and keep it open.\n      + <c-t> change the global working directory (exit).\n      + <c-v> change the local working directory for the current window (exit).\n      + <c-x> change the global working directory to CtrlP's current local\n        working directory (exit).\n\n                                                                    *:CtrlPRTS*\n  * Runtime script mode:~\n    - Name: 'rtscript'\n    - Command: \":CtrlPRTS\"\n    - Search for files (vimscripts, docs, snippets...) in runtimepath.\n\n                                                                   *:CtrlPUndo*\n  * Undo mode:~\n    - Name: 'undo'\n    - Command: \":CtrlPUndo\"\n    - Browse undo history.\n\n                                                                   *:CtrlPLine*\n  * Line mode:~\n    - Name: 'line'\n    - Command: \":CtrlPLine [buffer]\"\n    - Search for a line in all listed buffers or in the specified [buffer].\n\n                                                                 *:CtrlPChange*\n                                                              *:CtrlPChangeAll*\n  * Change list mode:~\n    - Name: 'changes'\n    - Commands: \":CtrlPChange [buffer]\",\n                \":CtrlPChangeAll\".\n    - Search for and jump to a recent change in the current buffer or in all\n      listed buffers.\n\n                                                                  *:CtrlPMixed*\n  * Mixed mode:~\n    - Name: 'mixed'\n    - Command: \":CtrlPMixed\"\n    - Search in files, buffers and MRU files at the same time.\n\n                                                            *:CtrlPBookmarkDir*\n                                                         *:CtrlPBookmarkDirAdd*\n  * BookmarkDir mode:~\n    - Name: 'bookmarkdir'\n    - Commands: \":CtrlPBookmarkDir\",\n                \":CtrlPBookmarkDirAdd [directory]\".\n    - Search for a bookmarked directory and change the working directory to it.\n    - Mappings:\n      + <cr> change the local working directory for CtrlP, keep it open and\n        switch to find file mode.\n      + <c-x> change the global working directory (exit).\n      + <c-v> change the local working directory for the current window (exit).\n      + <F7>\n        - Wipe bookmark list.\n        - Delete entries marked by <c-z>.\n\n----------------------------------------\nBuffer Tag mode options:~\n\n                                                   *'g:ctrlp_buftag_ctags_bin'*\nIf ctags isn't in your $PATH, use this to set its location: >\n  let g:ctrlp_buftag_ctags_bin = ''\n<\n\n                                                   *'g:ctrlp_buftag_systemenc'*\nMatch this with your OS's encoding (not Vim's). The default value mirrors Vim's\nglobal |'encoding'| option: >\n  let g:ctrlp_buftag_systemenc = &encoding\n<\n\n                                                       *'g:ctrlp_buftag_types'*\nUse this to set the arguments for ctags, jsctags... for a given filetype: >\n  let g:ctrlp_buftag_types = ''\n<\nExamples: >\n  let g:ctrlp_buftag_types = {\n    \\ 'erlang'     : '--language-force=erlang --erlang-types=drmf',\n    \\ 'javascript' : {\n      \\ 'bin': 'jsctags',\n      \\ 'args': '-f -',\n      \\ },\n    \\ }\n<\n\n===============================================================================\nCUSTOMIZATION                                             *ctrlp-customization*\n\nHighlighting:~\n  * For the CtrlP buffer:\n    CtrlPNoEntries : the message when no match is found (Error)\n    CtrlPMatch     : the matched pattern (Identifier)\n    CtrlPLinePre   : the line prefix '>' in the match window\n    CtrlPPrtBase   : the prompt's base (Comment)\n    CtrlPPrtText   : the prompt's text (|hl-Normal|)\n    CtrlPPrtCursor : the prompt's cursor when moving over the text (Constant)\n\n  * In extensions:\n    CtrlPTabExtra  : the part of each line that's not matched against (Comment)\n    CtrlPBufName   : the buffer name an entry belongs to (|hl-Directory|)\n    CtrlPTagKind   : the kind of the tag in buffer-tag mode (|hl-Title|)\n    CtrlPqfLineCol : the line and column numbers in quickfix mode (Comment)\n    CtrlPUndoT     : the elapsed time in undo mode (|hl-Directory|)\n    CtrlPUndoBr    : the square brackets [] in undo mode (Comment)\n    CtrlPUndoNr    : the undo number inside [] in undo mode (String)\n    CtrlPUndoSv    : the point where the file was saved (Comment)\n    CtrlPUndoPo    : the current position in the undo tree (|hl-Title|)\n    CtrlPBookmark  : the name of the bookmark (Identifier)\n\nStatuslines:~\n  * Highlight groups:\n    CtrlPMode1 : 'file' or 'path' or 'line', and the current mode (Character)\n    CtrlPMode2 : 'prt' or 'win', 'regex', the working directory (|hl-LineNr|)\n    CtrlPStats : the scanning status (Function)\n\n  For rebuilding the statuslines, see |g:ctrlp_status_func|.\n\n===============================================================================\nMISCELLANEOUS CONFIGS                             *ctrlp-miscellaneous-configs*\n\n* Using |wildignore| for |g:ctrlp_user_command|:\n>\n  function! s:wig2cmd()\n    \" Change wildignore into space or | separated groups\n    \" e.g. .aux .out .toc .jpg .bmp .gif\n    \" or   .aux$\\|.out$\\|.toc$\\|.jpg$\\|.bmp$\\|.gif$\n    let pats = ['[*\\/]*\\([?_.0-9A-Za-z]\\+\\)\\([*\\/]*\\)\\(\\\\\\@<!,\\|$\\)','\\\\\\@<!,']\n    let subs = has('win32') || has('win64') ? ['\\1\\3', ' '] : ['\\1\\2\\3', '\\\\|']\n    let expr = substitute(&wig, pats[0], subs[0], 'g')\n    let expr = substitute(expr, pats[1], subs[1], 'g')\n    let expr = substitute(expr, '\\\\,', ',', 'g')\n\n    \" Set the user_command option\n    let g:ctrlp_user_command = has('win32') || has('win64')\n      \\ ? 'dir %s /-n /b /s /a-d | findstr /V /l \"'.expr.'\"'\n      \\ : 'find %s -type f | grep -v \"'.expr .'\"'\n  endfunction\n\n  call s:wig2cmd()\n<\n(submitted by Rich Alesi <github.com/ralesi>)\n\n* A standalone function to set the working directory to the project's root, or\n  to the parent directory of the current file if a root can't be found:\n>\n  function! s:setcwd()\n    let cph = expand('%:p:h', 1)\n    if cph =~ '^.\\+://' | retu | en\n    for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']\n      let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])\n      if wd != '' | let &acd = 0 | brea | en\n    endfo\n    exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', ''))\n  endfunction\n\n  autocmd BufEnter * call s:setcwd()\n<\n(requires Vim 7.1.299+)\n\n* Using a |count| to invoke different commands using the same mapping:\n>\n  let g:ctrlp_cmd = 'exe \"CtrlP\".get([\"\", \"Buffer\", \"MRU\"], v:count)'\n<\n\n===============================================================================\nCREDITS                                                         *ctrlp-credits*\n\nDeveloped by Kien Nguyen <github.com/kien>. Distributed under Vim's |license|.\n\nProject's homepage:   http://kien.github.com/ctrlp.vim\nGit repository:       https://github.com/kien/ctrlp.vim\nMercurial repository: https://bitbucket.org/kien/ctrlp.vim\n\n-------------------------------------------------------------------------------\nThanks to everyone that has submitted ideas, bug reports or helped debugging on\ngibhub, bitbucket, and through email.\n\nSpecial thanks:~\n\n    * Woojong Koh <github.com/wjkoh>\n    * Simon Ruderich\n    * Yasuhiro Matsumoto <github.com/mattn>\n    * Ken Earley <github.com/kenearley>\n    * Kyo Nagashima <github.com/hail2u>\n    * Zak Johnson <github.com/zakj>\n    * Diego Viola <github.com/diegoviola>\n    * Piet Delport <github.com/pjdelport>\n    * Thibault Duplessis <github.com/ornicar>\n    * Kent Sibilev <github.com/datanoise>\n    * Tacahiroy <github.com/tacahiroy>\n    * Luca Pette <github.com/lucapette>\n    * Seth Fowler <github.com/sfowler>\n    * Lowe Thiderman <github.com/thiderman>\n    * Christopher Fredén <github.com/icetan>\n    * Zahary Karadjov <github.com/zah>\n    * Jo De Boeck <github.com/grimpy>\n    * Rudi Grinberg <github.com/rgrinberg>\n    * Timothy Mellor <github.com/mellort>\n\n===============================================================================\nCHANGELOG                                                     *ctrlp-changelog*\n\n    + Combine *g:ctrlp_match_window_bottom* *g:ctrlp_match_window_reversed* and\n      *g:ctrlp_max_height* into |g:ctrlp_match_window|.\n    + New option: |g:ctrlp_match_window|.\n\nBefore 2012/11/30~\n\n    + New options: |g:ctrlp_abbrev|,\n                   |g:ctrlp_key_loop|,\n                   |g:ctrlp_open_func|,\n                   |g:ctrlp_tabpage_position|,\n                   |g:ctrlp_mruf_save_on_update|\n    + Rename:\n        *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.\n    + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type\n      (old values still work).\n    + New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.\n\nBefore 2012/06/15~\n\n    + New value for |g:ctrlp_follow_symlinks|: 2.\n    + New value for |g:ctrlp_open_multiple_files|: 'j'.\n    + Allow using <c-t>, <c-x>, <c-v> to open files marked by <c-z>.\n    + Extend '..' (|ctrlp-input-formats| (d))\n    + New input format: '@cd' (|ctrlp-input-formats| (d))\n\nBefore 2012/04/30~\n\n    + New option: |g:ctrlp_mruf_default_order|\n    + New feature: Bookmarked directories extension.\n    + New commands: |:CtrlPBookmarkDir|\n                    |:CtrlPBookmarkDirAdd|\n\nBefore 2012/04/15~\n\n    + New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer.\n    + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode.\n    + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used.\n                    |:CtrlPMixed|, search in files, buffers and MRU files.\n\nBefore 2012/03/31~\n\n    + New options: |g:ctrlp_default_input|, default input when entering CtrlP.\n                   |g:ctrlp_match_func|, allow using a custom fuzzy matcher.\n    + Rename:\n        *ClearCtrlPCache* -> |CtrlPClearCache|\n        *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|\n        *ResetCtrlP* -> |CtrlPReload|\n\nBefore 2012/03/02~\n\n    + Rename:\n        *g:ctrlp_regexp_search* -> |g:ctrlp_regexp|,\n        *g:ctrlp_dont_split* -> |g:ctrlp_reuse_window|,\n        *g:ctrlp_jump_to_buffer* -> |g:ctrlp_switch_buffer|.\n    + Rename and tweak:\n        *g:ctrlp_open_multi* -> |g:ctrlp_open_multiple_files|.\n    + Deprecate *g:ctrlp_highlight_match*\n    + Extend |g:ctrlp_user_command| to support multiple commands.\n    + New option: |g:ctrlp_mruf_last_entered| change MRU to Recently-Entered.\n\nBefore 2012/01/15~\n\n    + New mapping: Switch <tab> and <s-tab>. <tab> is now used for completion\n                   of directory names under the current working directory.\n    + New options: |g:ctrlp_arg_map| for <c-y>, <c-o> to accept an argument.\n                   |g:ctrlp_status_func| custom statusline.\n                   |g:ctrlp_mruf_relative| show only MRU files inside cwd.\n    + Extend g:ctrlp_open_multi with new optional values: tr, hr, vr.\n    + Extend |g:ctrlp_custom_ignore| to specifically filter dir, file and link.\n\nBefore 2012/01/05~\n\n    + New feature: Buffer Tag extension.\n    + New commands: |:CtrlPBufTag|, |:CtrlPBufTagAll|.\n    + New options: |g:ctrlp_cmd|,\n                   |g:ctrlp_custom_ignore|\n\nBefore 2011/11/30~\n\n    + New features: Tag, Quickfix and Directory extensions.\n    + New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|.\n    + New options: |g:ctrlp_use_migemo|,\n                   |g:ctrlp_lazy_update|,\n                   |g:ctrlp_follow_symlinks|\n\nBefore 2011/11/13~\n\n    + New special input: '/' and '\\' find root (|ctrlp-input-formats| (e))\n    + Remove ctrlp#SetWorkingPath().\n    + Remove *g:ctrlp_mru_files* and make MRU mode permanent.\n    + Extend g:ctrlp_open_multi, add new ways to open files.\n    + New option: g:ctrlp_dont_split,\n                  |g:ctrlp_mruf_case_sensitive|\n\nBefore 2011/10/30~\n\n    + New feature: Support for custom extensions.\n                   <F5> also removes non-existent files from MRU list.\n    + New option: g:ctrlp_jump_to_buffer\n\nBefore 2011/10/12~\n\n    + New features: Open multiple files.\n                    Pass Vim's |++opt| and |+cmd| to the opening file\n                    (|ctrlp-input-formats| (c))\n                    Auto-complete each dir for |:CtrlP| [starting-directory]\n    + New mappings: <c-z> mark/unmark a file to be opened with <c-o>.\n                    <c-o> open all marked files.\n    + New option: g:ctrlp_open_multi\n    + Remove *g:ctrlp_persistent_input* *g:ctrlp_live_update* and <c-^>.\n\nBefore 2011/09/29~\n\n    + New mappings: <c-n>, <c-p> next/prev string in the input history.\n                    <c-y> create a new file and its parent dirs.\n    + New options: |g:ctrlp_open_new_file|,\n                   |g:ctrlp_max_history|\n    + Added a new open-in-horizontal-split mapping: <c-x>\n\nBefore 2011/09/19~\n\n    + New command: ResetCtrlP\n    + New options: |g:ctrlp_max_files|,\n                   |g:ctrlp_max_depth|,\n                   g:ctrlp_live_update\n    + New mapping: <c-^>\n\nBefore 2011/09/12~\n\n    + Ability to cycle through matched lines in the match window.\n    + Extend the behavior of g:ctrlp_persistent_input\n    + Extend the behavior of |:CtrlP|\n    + New options: |g:ctrlp_dotfiles|,\n                   |g:ctrlp_clear_cache_on_exit|,\n                   g:ctrlp_highlight_match,\n                   |g:ctrlp_user_command|\n    + New special input: '..' (|ctrlp-input-formats| (d))\n    + New mapping: <F5>.\n    + New commands: |:CtrlPCurWD|,\n                    |:CtrlPCurFile|,\n                    |:CtrlPRoot|\n\n    + New feature: Search in most recently used (MRU) files\n    + New mapping: <c-b>.\n    + Extended the behavior of <c-f>.\n    + New options: g:ctrlp_mru_files,\n                   |g:ctrlp_mruf_max|,\n                   |g:ctrlp_mruf_exclude|,\n                   |g:ctrlp_mruf_include|\n    + New command: |:CtrlPMRU|\n\nFirst public release: 2011/09/06~\n\n===============================================================================\nvim:ft=help:et:ts=2:sw=2:sts=2:norl\n"
  },
  {
    "path": "plugin/ctrlp.vim",
    "content": "\" =============================================================================\n\" File:          plugin/ctrlp.vim\n\" Description:   Fuzzy file, buffer, mru, tag, etc finder.\n\" Author:        Kien Nguyen <github.com/kien>\n\" =============================================================================\n\" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip\n\nif ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp\n\tfini\nen\nlet g:loaded_ctrlp = 1\n\nlet [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,\n\t\\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]\n\t\\ = [[], [], [], [], {}, {}, [], 2]\n\nif !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en\nif !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en\n\ncom! -n=? -com=dir CtrlP         cal ctrlp#init(0, { 'dir': <q-args> })\ncom! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })\n\ncom! -bar CtrlPBuffer   cal ctrlp#init(1)\ncom! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })\n\ncom! -bar CtrlPClearCache     cal ctrlp#clr()\ncom! -bar CtrlPClearAllCaches cal ctrlp#clra()\n\ncom! -bar ClearCtrlPCache     cal ctrlp#clr()\ncom! -bar ClearAllCtrlPCaches cal ctrlp#clra()\n\ncom! -bar CtrlPCurWD   cal ctrlp#init(0, { 'mode': '' })\ncom! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })\ncom! -bar CtrlPRoot    cal ctrlp#init(0, { 'mode': 'r' })\n\nif g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')\n\texe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'\nen\n\ncal ctrlp#mrufiles#init()\n\ncom! -bar CtrlPTag      cal ctrlp#init(ctrlp#tag#id())\ncom! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())\n\ncom! -n=? -com=dir CtrlPDir\n\t\\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })\n\ncom! -n=? -com=buffer CtrlPBufTag\n\t\\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))\n\ncom! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))\ncom! -bar CtrlPRTS       cal ctrlp#init(ctrlp#rtscript#id())\ncom! -bar CtrlPUndo      cal ctrlp#init(ctrlp#undo#id())\n\ncom! -n=? -com=buffer CtrlPLine\n\t\\ cal ctrlp#init(ctrlp#line#cmd(1, <q-args>))\n\ncom! -n=? -com=buffer CtrlPChange\n\t\\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))\n\ncom! -bar CtrlPChangeAll   cal ctrlp#init(ctrlp#changes#cmd(1))\ncom! -bar CtrlPMixed       cal ctrlp#init(ctrlp#mixed#id())\ncom! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())\n\ncom! -n=? -com=dir CtrlPBookmarkDirAdd\n\t\\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)\n\n\" vim:ts=2:sw=2:sts=2\n"
  },
  {
    "path": "readme.md",
    "content": "#**This project is unmaintained** \n**You should use [this fork](https://github.com/ctrlpvim/ctrlp.vim) instead.**\n\n# ctrlp.vim\nFull path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.\n\n* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.\n* Full support for Vim's regexp as search patterns.\n* Built-in Most Recently Used (MRU) files monitoring.\n* Built-in project's root finder.\n* Open multiple files at once.\n* Create new files and directories.\n* [Extensible][2].\n\n![ctrlp][1]\n\n## Basic Usage\n* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.\n* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.\n* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time.\n\nCheck `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.\n\n##### Once CtrlP is open:\n* Press `<F5>` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.\n* Press `<c-f>` and `<c-b>` to cycle between modes.\n* Press `<c-d>` to switch to filename only search instead of full path.\n* Press `<c-r>` to switch to regexp mode.\n* Use `<c-j>`, `<c-k>` or the arrow keys to navigate the result list.\n* Use `<c-t>` or `<c-v>`, `<c-x>` to open the selected entry in a new tab or in a new split.\n* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.\n* Use `<c-y>` to create a new file and its parent directories.\n* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.\n\nRun `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.\n\n* Submit two or more dots `..` to go up the directory tree by one or multiple levels.\n* End the input string with a colon `:` followed by a command to execute it on the opening file(s):  \nUse `:25` to jump to line 25.  \nUse `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.\n\n## Basic Options\n* Change the default mapping and the default command to invoke CtrlP:\n\n    ```vim\n    let g:ctrlp_map = '<c-p>'\n    let g:ctrlp_cmd = 'CtrlP'\n    ```\n\n* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:\n\n    ```vim\n    let g:ctrlp_working_path_mode = 'ra'\n    ```\n\n    `'c'` - the directory of the current file.  \n    `'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`  \n    `'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.  \n    `0` or `''` (empty string) - disable this feature.\n\n    Define additional root markers with the `g:ctrlp_root_markers` option.\n\n* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:\n\n    ```vim\n    set wildignore+=*/tmp/*,*.so,*.swp,*.zip     \" MacOSX/Linux\n    set wildignore+=*\\\\tmp\\\\*,*.swp,*.zip,*.exe  \" Windows\n\n    let g:ctrlp_custom_ignore = '\\v[\\/]\\.(git|hg|svn)$'\n    let g:ctrlp_custom_ignore = {\n      \\ 'dir':  '\\v[\\/]\\.(git|hg|svn)$',\n      \\ 'file': '\\v\\.(exe|so|dll)$',\n      \\ 'link': 'some_bad_symbolic_links',\n      \\ }\n    ```\n\n* Use a custom file listing command:\n\n    ```vim\n    let g:ctrlp_user_command = 'find %s -type f'        \" MacOSX/Linux\n    let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d'  \" Windows\n    ```\n\nCheck `:help ctrlp-options` for other options.\n\n## Installation\nUse your favorite method or check the homepage for a [quick installation guide][3].\n\n[1]: http://i.imgur.com/yIynr.png\n[2]: https://github.com/kien/ctrlp.vim/tree/extensions\n[3]: http://kien.github.com/ctrlp.vim#installation\n"
  }
]