Preset ext_vars
This commit is contained in:
parent
9f0cd39ea9
commit
59f64d698b
@ -11,8 +11,8 @@ fu! s:opts()
|
||||
let hst = exists('+hi') ? &hi : 20
|
||||
let [pref, opts] = ['g:ctrlp_', {
|
||||
\ 'arg_map': ['s:argmap', 0],
|
||||
\ 'by_filename': ['s:byfname', 0],
|
||||
\ 'buffer_func': ['s:buffunc', {}],
|
||||
\ 'by_filename': ['s:byfname', 0],
|
||||
\ 'clear_cache_on_exit': ['s:clrex', 1],
|
||||
\ 'custom_ignore': ['s:usrign', ''],
|
||||
\ 'default_input': ['s:deftxt', 0],
|
||||
@ -713,10 +713,11 @@ fu! s:ToggleByFname()
|
||||
endf
|
||||
|
||||
fu! s:ToggleType(dir)
|
||||
let ext = exists('g:ctrlp_ext_vars') ? len(g:ctrlp_ext_vars) : 0
|
||||
let max = len(g:ctrlp_ext_vars) + 2
|
||||
let next = s:walker(max, s:itemtype, a:dir)
|
||||
unl! g:ctrlp_nolimit
|
||||
cal ctrlp#syntax()
|
||||
cal ctrlp#setlines(s:walker(2 + ext, s:itemtype, a:dir))
|
||||
cal ctrlp#setlines(next)
|
||||
cal s:PrtSwitcher()
|
||||
endf
|
||||
|
||||
@ -1037,7 +1038,7 @@ fu! ctrlp#statusline()
|
||||
\ ['buffers', 'buf'],
|
||||
\ ['mru files', 'mru'],
|
||||
\ ]
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
if !empty(g:ctrlp_ext_vars)
|
||||
cal map(copy(g:ctrlp_ext_vars),
|
||||
\ 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])')
|
||||
en
|
||||
@ -1591,7 +1592,7 @@ fu! s:mtype()
|
||||
endf
|
||||
|
||||
fu! s:execextvar(key)
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
if !empty(g:ctrlp_ext_vars)
|
||||
cal map(filter(copy(g:ctrlp_ext_vars),
|
||||
\ 'has_key(v:val, a:key)'), 'eval(v:val[a:key])')
|
||||
en
|
||||
@ -1632,7 +1633,7 @@ fu! ctrlp#setlines(...)
|
||||
if a:0 | let s:itemtype = a:1 | en
|
||||
cal s:modevar()
|
||||
let types = ['ctrlp#files()', 'ctrlp#buffers()', 'ctrlp#mrufiles#list()']
|
||||
if exists('g:ctrlp_ext_vars')
|
||||
if !empty(g:ctrlp_ext_vars)
|
||||
cal map(copy(g:ctrlp_ext_vars), 'add(types, v:val["init"])')
|
||||
en
|
||||
let g:ctrlp_lines = eval(types[s:itemtype])
|
||||
|
@ -13,7 +13,7 @@ if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
||||
en
|
||||
let g:loaded_ctrlp_buftag = 1
|
||||
|
||||
let s:buftag_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
||||
\ 'accept': 'ctrlp#buffertag#accept',
|
||||
\ 'lname': 'buffer tags',
|
||||
@ -21,10 +21,7 @@ let s:buftag_var = {
|
||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opts': 'ctrlp#buffertag#opts()',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:buftag_var) : [s:buftag_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
@ -199,13 +196,14 @@ fu! s:parseline(line)
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if ctrlp#nosy() | retu | en
|
||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#buffertag#init(fname)
|
||||
|
@ -10,7 +10,7 @@ if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
||||
en
|
||||
let g:loaded_ctrlp_changes = 1
|
||||
|
||||
let s:changes_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crfile)',
|
||||
\ 'accept': 'ctrlp#changes#accept',
|
||||
\ 'lname': 'changes',
|
||||
@ -18,10 +18,7 @@ let s:changes_var = {
|
||||
\ 'exit': 'ctrlp#changes#exit()',
|
||||
\ 'type': 'tabe',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:changes_var) : [s:changes_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@ -46,11 +43,12 @@ fu! s:process(clines, ...)
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if ctrlp#nosy() | retu | en
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#changes#init(original_bufnr, fname)
|
||||
|
@ -17,17 +17,14 @@ let s:ars = [
|
||||
\ 's:glob',
|
||||
\ ]
|
||||
|
||||
let s:dir_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
||||
\ 'accept': 'ctrlp#dir#accept',
|
||||
\ 'lname': 'dirs',
|
||||
\ 'sname': 'dir',
|
||||
\ 'type': 'path',
|
||||
\ 'specinput': 1,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:dir_var) : [s:dir_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
@ -51,8 +48,8 @@ fu! ctrlp#dir#init(...)
|
||||
for each in range(len(s:ars))
|
||||
exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1)))
|
||||
endfo
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var['sname']
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var['sname'])
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
|
||||
if g:ctrlp_newdir || !filereadable(cafile)
|
||||
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
|
||||
cal s:globdirs(s:cwd, 0)
|
||||
|
@ -10,40 +10,37 @@ if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||
en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
let s:line_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#line#init()',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
\ 'type': 'tabe',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if ctrlp#nosy() | retu | en
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#line#init()
|
||||
let [bufs, lines] = [filter(ctrlp#buffers(), 'filereadable(v:val)'), []]
|
||||
for each in bufs
|
||||
let [fnamet, from_file] = [fnamemodify(each, ':t'), readfile(each)]
|
||||
let [fnamet, ff] = [fnamemodify(each, ':t'), readfile(each)]
|
||||
let bname = fnamemodify(each, ':p')
|
||||
cal map(from_file, 'tr(v:val, '' '', '' '')')
|
||||
let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.bname.'$')]
|
||||
cal map(ff, 'tr(v:val, '' '', '' '')')
|
||||
let [id, len_ff, bufnr] = [1, len(ff), bufnr('^'.bname.'$')]
|
||||
wh id <= len_ff
|
||||
let from_file[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
||||
let ff[id-1] .= ' |'.fnamet.'|'.bufnr.':'.id.'|'
|
||||
let id += 1
|
||||
endw
|
||||
cal filter(from_file, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$''')
|
||||
cal extend(lines, from_file)
|
||||
cal extend(lines, filter(ff, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
||||
endfo
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
|
@ -10,7 +10,7 @@ if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
|
||||
en
|
||||
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
|
||||
|
||||
let s:mixed_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'fil + mru + buf',
|
||||
@ -18,10 +18,7 @@ let s:mixed_var = {
|
||||
\ 'type': 'path',
|
||||
\ 'opmul': 1,
|
||||
\ 'specinput': 1,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:mixed_var) : [s:mixed_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
|
@ -10,17 +10,14 @@ if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
||||
en
|
||||
let g:loaded_ctrlp_quickfix = 1
|
||||
|
||||
let s:var_qf = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#quickfix#init()',
|
||||
\ 'accept': 'ctrlp#quickfix#accept',
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:var_qf) : [s:var_qf]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
|
@ -10,17 +10,14 @@ if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
||||
en
|
||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
||||
|
||||
let s:rtscript_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#rtscript#init()',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'runtime scripts',
|
||||
\ 'sname': 'rts',
|
||||
\ 'type': 'path',
|
||||
\ 'opmul': 1,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:rtscript_var) : [s:rtscript_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Public {{{1
|
||||
|
@ -10,17 +10,14 @@ if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
||||
en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
let s:tag_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#tag#init()',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'enter': 'ctrlp#tag#enter()',
|
||||
\ 'type': 'tabs',
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:tag_var) : [s:tag_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
|
@ -10,7 +10,7 @@ if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||
en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
let s:undo_var = {
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#undo#init()',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
@ -19,10 +19,7 @@ let s:undo_var = {
|
||||
\ 'exit': 'ctrlp#undo#exit()',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ }
|
||||
|
||||
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
||||
\ ? add(g:ctrlp_ext_vars, s:undo_var) : [s:undo_var]
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
|
@ -145,6 +145,10 @@ only need to keep the lines that you’ve changed the values (inside []): >
|
||||
\ 'PrtClear()': ['<c-u>'],
|
||||
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
|
||||
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
|
||||
\ 'PrtSelectMove("t")': ['<Home>', '<kHome>'],
|
||||
\ 'PrtSelectMove("b")': ['<End>', '<kEnd>'],
|
||||
\ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'],
|
||||
\ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'],
|
||||
\ 'PrtHistory(-1)': ['<c-n>'],
|
||||
\ 'PrtHistory(1)': ['<c-p>'],
|
||||
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
|
||||
|
@ -10,9 +10,9 @@ if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
||||
en
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags,
|
||||
\ g:ctrlp_alldirs, g:ctrlp_allmixes, g:ctrlp_buftags,
|
||||
\ g:ctrlp_builtins] = [[], [], [], [], {}, {}, 2]
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
||||
\ = [[], [], [], [], {}, {}, [], 2]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
|
Loading…
Reference in New Issue
Block a user