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],
\ }]
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
unl va
let new_opts = {
\ 'open_multiple_files': 's:opmul',
\ 'regexp': 's:regexp',
\ 'reuse_window': 's:nosplit',
\ 'switch_buffer': 's:jmptobuf',
\ }
for [key, val] in items(new_opts)
exe 'let' val '=' string(eval(exists(pref.key) ? pref.key : val))
for [ke, va] in items(new_opts)
let {va} = {exists(pref.ke) ? pref.ke : va}
endfo
if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en
let s:maxdepth = min([s:maxdepth, 100])
@ -214,7 +215,7 @@ fu! s:Close()
endf
" * Clear caches {{{1
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
fu! ctrlp#clra()
@ -674,7 +675,7 @@ endf
fu! s:MapSpecs(...)
" Correct arrow keys in terminal
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>']
exe s:lcmap.' <esc>['.each
endfo

View File

@ -32,7 +32,7 @@ fu! ctrlp#buffertag#opts()
\ 'types': ['s:usr_types', ''],
\ }]
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
endf
cal ctrlp#buffertag#opts()
@ -190,7 +190,7 @@ endf
fu! s:parseline(line)
let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)'
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')]
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
endf

View File

@ -46,7 +46,7 @@ endf
fu! ctrlp#dir#init(...)
let s:cwd = getcwd()
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
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'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],
\ }]
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
let [s:csen, s:mrbs, s:mrufs] = [s:cseno ? '#' : '?', [], []]
if exists('s:locked') | cal ctrlp#mrufiles#init() | en