Use a few curly braces variables

This commit is contained in:
Kien N 2012-04-16 11:40:21 +07:00
parent 863996ce26
commit 93414deb65
4 changed files with 10 additions and 9 deletions

View File

@ -43,16 +43,17 @@ fu! s:opts()
\ 'working_path_mode': ['s:pathmode', 2], \ 'working_path_mode': ['s:pathmode', 2],
\ }] \ }]
for [ke, va] in items(opts) for [ke, va] in items(opts)
exe 'let' va[0] '=' string(exists(pref.ke) ? eval(pref.ke) : va[1]) let {va[0]} = exists(pref.ke) ? {pref.ke} : va[1]
endfo endfo
unl va
let new_opts = { let new_opts = {
\ 'open_multiple_files': 's:opmul', \ 'open_multiple_files': 's:opmul',
\ 'regexp': 's:regexp', \ 'regexp': 's:regexp',
\ 'reuse_window': 's:nosplit', \ 'reuse_window': 's:nosplit',
\ 'switch_buffer': 's:jmptobuf', \ 'switch_buffer': 's:jmptobuf',
\ } \ }
for [key, val] in items(new_opts) for [ke, va] in items(new_opts)
exe 'let' val '=' string(eval(exists(pref.key) ? pref.key : val)) let {va} = {exists(pref.ke) ? pref.ke : va}
endfo endfo
if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en
let s:maxdepth = min([s:maxdepth, 100]) let s:maxdepth = min([s:maxdepth, 100])
@ -214,7 +215,7 @@ fu! s:Close()
endf endf
" * Clear caches {{{1 " * Clear caches {{{1
fu! ctrlp#clr(...) fu! ctrlp#clr(...)
exe 'let g:ctrlp_new'.( a:0 ? a:1 : 'cache' ).' = 1' let g:ctrlp_new{ a:0 ? a:1 : 'cache' } = 1
endf endf
fu! ctrlp#clra() fu! ctrlp#clra()
@ -674,7 +675,7 @@ endf
fu! s:MapSpecs(...) fu! s:MapSpecs(...)
" Correct arrow keys in terminal " Correct arrow keys in terminal
if ( has('termresponse') && match(v:termresponse, "\<ESC>") >= 0 ) if ( has('termresponse') && match(v:termresponse, "\<ESC>") >= 0 )
\ || &term =~? 'xterm\|\<k\?vt\|gnome\|screen\|linux' \ || &term =~? '\vxterm|<k?vt|gnome|screen|linux'
for each in ['\A <up>','\B <down>','\C <right>','\D <left>'] for each in ['\A <up>','\B <down>','\C <right>','\D <left>']
exe s:lcmap.' <esc>['.each exe s:lcmap.' <esc>['.each
endfo endfo

View File

@ -32,7 +32,7 @@ fu! ctrlp#buffertag#opts()
\ 'types': ['s:usr_types', ''], \ 'types': ['s:usr_types', ''],
\ }] \ }]
for [ke, va] in items(opts) for [ke, va] in items(opts)
exe 'let' va[0] '=' string(exists(pref.ke) ? eval(pref.ke) : va[1]) let {va[0]} = exists(pref.ke) ? {pref.ke} : va[1]
endfo endfo
endf endf
cal ctrlp#buffertag#opts() cal ctrlp#buffertag#opts()
@ -190,7 +190,7 @@ endf
fu! s:parseline(line) fu! s:parseline(line)
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)' let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
let vals = matchlist(a:line, eval) let vals = matchlist(a:line, eval)
if empty(vals) | retu '' | en if vals == [] | retu '' | en
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')] let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
endf endf

View File

@ -46,7 +46,7 @@ endf
fu! ctrlp#dir#init(...) fu! ctrlp#dir#init(...)
let s:cwd = getcwd() let s:cwd = getcwd()
for each in range(len(s:ars)) for each in range(len(s:ars))
exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1))) let {s:ars[each]} = a:{each + 1}
endfo endfo
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir' let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir') let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')

View File

@ -14,7 +14,7 @@ fu! ctrlp#mrufiles#opts()
\ 'relative': ['s:re', 0], \ 'relative': ['s:re', 0],
\ }] \ }]
for [ke, va] in items(opts) for [ke, va] in items(opts)
exe 'let' va[0] '=' string(exists(pref.ke) ? eval(pref.ke) : va[1]) let {va[0]} = exists(pref.ke) ? {pref.ke} : va[1]
endfo endfo
let [s:csen, s:mrbs, s:mrufs] = [s:cseno ? '#' : '?', [], []] let [s:csen, s:mrbs, s:mrufs] = [s:cseno ? '#' : '?', [], []]
if exists('s:locked') | cal ctrlp#mrufiles#init() | en if exists('s:locked') | cal ctrlp#mrufiles#init() | en