From 93414deb65c8aefc2db316598d9d78eb2c3b6cb6 Mon Sep 17 00:00:00 2001 From: Kien N Date: Mon, 16 Apr 2012 11:40:21 +0700 Subject: [PATCH] Use a few curly braces variables --- autoload/ctrlp.vim | 11 ++++++----- autoload/ctrlp/buffertag.vim | 4 ++-- autoload/ctrlp/dir.vim | 2 +- autoload/ctrlp/mrufiles.vim | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 62be447..f4a0357 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -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, "\") >= 0 ) - \ || &term =~? 'xterm\|\','\B ','\C ','\D '] exe s:lcmap.' ['.each endfo diff --git a/autoload/ctrlp/buffertag.vim b/autoload/ctrlp/buffertag.vim index ea07716..f158505 100644 --- a/autoload/ctrlp/buffertag.vim +++ b/autoload/ctrlp/buffertag.vim @@ -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 diff --git a/autoload/ctrlp/dir.vim b/autoload/ctrlp/dir.vim index 3c56533..b775408 100644 --- a/autoload/ctrlp/dir.vim +++ b/autoload/ctrlp/dir.vim @@ -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') diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index 1f2a5f0..33eff1b 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -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