diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 5c31a1d..7219efd 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -9,49 +9,49 @@ fu! s:opts() " Options let hst = exists('+hi') ? &hi : 20 - let opts = { - \ 'g:ctrlp_arg_map': ['s:argmap', 0], - \ 'g:ctrlp_by_filename': ['s:byfname', 0], - \ 'g:ctrlp_clear_cache_on_exit': ['s:clrex', 1], - \ 'g:ctrlp_custom_ignore': ['s:usrign', ''], - \ 'g:ctrlp_default_input': ['s:deftxt', 0], - \ 'g:ctrlp_dont_split': ['s:nosplit', 'netrw'], - \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], - \ 'g:ctrlp_extensions': ['s:extensions', []], - \ 'g:ctrlp_follow_symlinks': ['s:folsym', 0], - \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'CtrlPMatch']], - \ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2], - \ 'g:ctrlp_lazy_update': ['s:lazy', 0], - \ 'g:ctrlp_match_func': ['s:matcher', {}], - \ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1], - \ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1], - \ 'g:ctrlp_max_depth': ['s:maxdepth', 40], - \ 'g:ctrlp_max_files': ['s:maxfiles', 10000], - \ 'g:ctrlp_max_height': ['s:mxheight', 10], - \ 'g:ctrlp_max_history': ['s:maxhst', hst], - \ 'g:ctrlp_open_multi': ['s:opmul', '1v'], - \ 'g:ctrlp_open_new_file': ['s:newfop', 'v'], - \ 'g:ctrlp_prompt_mappings': ['s:urprtmaps', 0], - \ 'g:ctrlp_regexp_search': ['s:regexp', 0], - \ 'g:ctrlp_root_markers': ['s:rmarkers', []], - \ 'g:ctrlp_split_window': ['s:splitwin', 0], - \ 'g:ctrlp_status_func': ['s:status', {}], - \ 'g:ctrlp_use_caching': ['s:caching', 1], - \ 'g:ctrlp_use_migemo': ['s:migemo', 0], - \ 'g:ctrlp_user_command': ['s:usrcmd', ''], - \ 'g:ctrlp_working_path_mode': ['s:pathmode', 2], - \ } + let [pref, opts] = ['g:ctrlp_', { + \ 'arg_map': ['s:argmap', 0], + \ 'by_filename': ['s:byfname', 0], + \ 'clear_cache_on_exit': ['s:clrex', 1], + \ 'custom_ignore': ['s:usrign', ''], + \ 'default_input': ['s:deftxt', 0], + \ 'dont_split': ['s:nosplit', 'netrw'], + \ 'dotfiles': ['s:dotfiles', 1], + \ 'extensions': ['s:extensions', []], + \ 'follow_symlinks': ['s:folsym', 0], + \ 'highlight_match': ['s:mathi', [1, 'CtrlPMatch']], + \ 'jump_to_buffer': ['s:jmptobuf', 2], + \ 'lazy_update': ['s:lazy', 0], + \ 'match_func': ['s:matcher', {}], + \ 'match_window_bottom': ['s:mwbottom', 1], + \ 'match_window_reversed': ['s:mwreverse', 1], + \ 'max_depth': ['s:maxdepth', 40], + \ 'max_files': ['s:maxfiles', 10000], + \ 'max_height': ['s:mxheight', 10], + \ 'max_history': ['s:maxhst', hst], + \ 'open_multi': ['s:opmul', '1v'], + \ 'open_new_file': ['s:newfop', 'v'], + \ 'prompt_mappings': ['s:urprtmaps', 0], + \ 'regexp_search': ['s:regexp', 0], + \ 'root_markers': ['s:rmarkers', []], + \ 'split_window': ['s:splitwin', 0], + \ 'status_func': ['s:status', {}], + \ 'use_caching': ['s:caching', 1], + \ 'use_migemo': ['s:migemo', 0], + \ 'user_command': ['s:usrcmd', ''], + \ 'working_path_mode': ['s:pathmode', 2], + \ }] for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) + exe 'let' va[0] '=' string(exists(pref.ke) ? eval(pref.ke) : va[1]) endfo let new_opts = { - \ 'g:ctrlp_open_multiple_files': 's:opmul', - \ 'g:ctrlp_regexp': 's:regexp', - \ 'g:ctrlp_reuse_window': 's:nosplit', - \ 'g:ctrlp_switch_buffer': 's:jmptobuf', + \ '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(key) ? key : val)) + exe 'let' val '=' string(eval(exists(pref.key) ? pref.key : val)) endfo if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en let s:maxdepth = min([s:maxdepth, 100]) diff --git a/autoload/ctrlp/buffertag.vim b/autoload/ctrlp/buffertag.vim index 68c131d..cb2e1e9 100644 --- a/autoload/ctrlp/buffertag.vim +++ b/autoload/ctrlp/buffertag.vim @@ -29,13 +29,13 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) fu! ctrlp#buffertag#opts() - let opts = { - \ 'g:ctrlp_buftag_systemenc': ['s:enc', &enc], - \ 'g:ctrlp_buftag_ctags_bin': ['s:bin', ''], - \ 'g:ctrlp_buftag_types': ['s:usr_types', ''], - \ } + let [pref, opts] = ['g:ctrlp_buftag_', { + \ 'systemenc': ['s:enc', &enc], + \ 'ctags_bin': ['s:bin', ''], + \ 'types': ['s:usr_types', ''], + \ }] for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) + exe 'let' va[0] '=' string(exists(pref.ke) ? eval(pref.ke) : va[1]) endfo endf cal ctrlp#buffertag#opts() diff --git a/autoload/ctrlp/mixed.vim b/autoload/ctrlp/mixed.vim index 20e82b7..f7fdcfa 100644 --- a/autoload/ctrlp/mixed.vim +++ b/autoload/ctrlp/mixed.vim @@ -26,7 +26,7 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Utilities {{{1 fu! s:newcache(cwd) - if !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en + if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en retu g:ctrlp_allmixes['cwd'] != a:cwd \ || g:ctrlp_allmixes['time'] < getftime(ctrlp#utils#cachefile()) \ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#mrufs()) @@ -65,7 +65,7 @@ endf " Public {{{1 fu! ctrlp#mixed#init(clim) let cwd = getcwd() - if g:ctrlp_newmix || s:newcache(cwd) + if s:newcache(cwd) cal s:getnewmix(cwd, a:clim) el let g:ctrlp_lines = g:ctrlp_allmixes['data'] diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index b12761d..81dec24 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -6,15 +6,15 @@ " Static variables {{{1 fu! ctrlp#mrufiles#opts() - let opts = { - \ 'g:ctrlp_mruf_max': ['s:max', 250], - \ 'g:ctrlp_mruf_include': ['s:in', ''], - \ 'g:ctrlp_mruf_exclude': ['s:ex', ''], - \ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1], - \ 'g:ctrlp_mruf_relative': ['s:re', 0], - \ } + let [pref, opts] = ['g:ctrlp_mruf_', { + \ 'max': ['s:max', 250], + \ 'include': ['s:in', ''], + \ 'exclude': ['s:ex', ''], + \ 'case_sensitive': ['s:csen', 1], + \ 'relative': ['s:re', 0], + \ }] for [ke, va] in items(opts) - exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) + exe 'let' va[0] '=' string(exists(pref.ke) ? eval(pref.ke) : va[1]) endfo let [s:csen, s:mrbs, s:mrufs] = [s:csen ? '#' : '?', [], []] if exists('s:locked') | cal ctrlp#mrufiles#init() | en