diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index eb5c45d..98542e3 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -42,6 +42,14 @@ fu! s:opts() for [ke, va] in items(opts) exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1]) endfo + let new_opts = { + \ 'g:ctrlp_reuse_window': 's:nosplit', + \ 'g:ctrlp_regexp': 's:regexp', + \ 'g:ctrlp_switch_buffer': 's:jmptobuf', + \ } + for [key, val] in items(new_opts) + exe 'let' val '=' string(eval(exists(key) ? key : val)) + endfo if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en let s:maxdepth = min([s:maxdepth, 100]) let s:mxheight = max([s:mxheight, 1]) @@ -138,6 +146,8 @@ let s:prtunmaps = [ \ 'PrtInsert("v")', \ 'PrtInsert("+")', \ ] + +" Keypad let s:kprange = { \ 'Plus': '+', \ 'Minus': '-', @@ -395,7 +405,7 @@ fu! s:Render(lines, pat, ipt) en " Highlighting if s:dohighlight() - cal s:highlight(a:pat, s:mathi[1] == '' ? 'CtrlPMatch' : s:mathi[1], a:ipt) + cal s:highlight(a:pat, s:mathi[1], a:ipt) en endf @@ -708,7 +718,7 @@ fu! s:SetWD(...) "{{{1 cal ctrlp#setdir(s:crfpath) en if pathmode == 1 | retu | en - let markers = ['root.dir','.git/','.hg/','_darcs/','.bzr/'] + let markers = ['root.dir', '.git/', '.hg/', '.svn/', '_darcs/', '.bzr/'] if type(s:rmarkers) == 3 && !empty(s:rmarkers) cal extend(markers, s:rmarkers, 0) en @@ -1184,7 +1194,7 @@ fu! s:highlight(pat, grp, ipt) endf fu! s:dohighlight() - retu len(s:mathi) > 1 && s:mathi[0] && exists('*clearmatches') + retu s:mathi[0] && exists('*clearmatches') endf " Prompt history {{{2 fu! s:gethistloc() diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index 9a31ff4..0e8eb1e 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -51,14 +51,16 @@ Use this to disable the plugin completely: > < *'g:ctrlp_by_filename'* -Set this to 1 to set search by filename (not full path) as the default: > +Set this to 1 to set searching by filename (not full path) as the default: > let g:ctrlp_by_filename = 0 < +Can be toggled on/off by pressing inside the prompt. - *'g:ctrlp_regexp_search'* + *'g:ctrlp_regexp'* Set this to 1 to set |regexp| search as the default: > - let g:ctrlp_regexp_search = 0 + let g:ctrlp_regexp = 0 < +Can be toggled on/off by pressing inside the prompt. *'g:ctrlp_match_window_bottom'* Set this to 0 to show the match window at the top of the screen: > @@ -66,8 +68,8 @@ Set this to 0 to show the match window at the top of the screen: > < *'g:ctrlp_match_window_reversed'* -Change the listing order of the matched files in the match window. The default -setting (1) is from bottom to top: > +Change the listing order of the files in the match window. The default setting +(1) is from bottom to top: > let g:ctrlp_match_window_reversed = 1 < @@ -76,13 +78,13 @@ Set the maximum height of the match window: > let g:ctrlp_max_height = 10 < - *'g:ctrlp_jump_to_buffer'* -When opening a file with or , if the file's already opened somewhere + *'g:ctrlp_switch_buffer'* +When opening a file with or , if the file’s already opened somewhere |CtrlP| will try to jump to it instead of opening a new instance: > - let g:ctrlp_jump_to_buffer = 2 + let g:ctrlp_switch_buffer = 2 < 1 - only jump to the buffer if it’s opened in the current tab. - 2 - jump tab as well if the buffer's opened in another tab. + 2 - jump tab as well if the buffer’s opened in another tab. 0 - disable this feature. *'g:ctrlp_working_path_mode'* @@ -91,13 +93,11 @@ variable: > let g:ctrlp_working_path_mode = 2 < 1 - the parent directory of the current file. - 2 - the nearest ancestor that contains one of these directories/files: - .git/ - .hg/ - .bzr/ - _darcs/ + 2 - the nearest ancestor that contains one of these directories or files: + .git/ .hg/ .bzr/ _darcs/ .svn/ 0 - don’t manage working directory. -Use b:ctrlp_working_path_mode (a |b:var|) to set this option for each buffer. +Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a +per buffer basis. *'g:ctrlp_root_markers'* Use this to set your own root markers in addition to the default ones. Your @@ -168,7 +168,7 @@ Note: In some terminals, it’s not possible to remap without also changin deleting a char for you, add this to your |vimrc| to disable the default mapping: > let g:ctrlp_prompt_mappings = { - \ 'PrtCurLeft()': ['', ''], + \ 'PrtCurLeft()': ['', ''] \ } < @@ -242,12 +242,6 @@ Examples: > \ } < - *'g:ctrlp_highlight_match'* -Use this to enable/disable highlighting of the matched patterns and to specify -the highlight group that’ll be used: > - let g:ctrlp_highlight_match = [1, 'Identifier'] -< - *'g:ctrlp_max_files'* The maximum number of files to scan, set to 0 for no limit: > let g:ctrlp_max_files = 10000 @@ -350,14 +344,15 @@ Pressing or will then prompt for a keypress. The key can be: Any other key - use the behavior specified with |g:ctrlp_open_new_file| and |g:ctrlp_open_multi|. - *'g:ctrlp_dont_split'* + *'g:ctrlp_reuse_window'* When opening a file with , |CtrlP| avoids opening it in windows created by plugins, help and quickfix. Use this to setup some exceptions: > - let g:ctrlp_dont_split = 'netrw' + let g:ctrlp_reuse_window = 'netrw' < Acceptable values are partial names or filetypes of the special buffers. Use -|regexp| to specify the pattern. Example: > - let g:ctrlp_dont_split = 'netrw\|help\|quickfix' +|regexp| to specify the pattern. +Example: > + let g:ctrlp_reuse_window = 'netrw\|help\|quickfix' < *'g:ctrlp_follow_symlinks'* @@ -721,7 +716,7 @@ Statuslines:~ For rebuilding the statuslines, see |g:ctrlp_status_func|. =============================================================================== -CUSTOM-CONFIGS *ctrlp-custom-configs* +MISCELLANEOUS-CONFIGS *ctrlp-miscellaneous-configs* * Use |wildignore| for |g:ctrlp_user_command|: > @@ -745,8 +740,8 @@ CUSTOM-CONFIGS *ctrlp-custom-configs* < (submitted by Rich Alesi ) -* Set the working directory to the project’s root, or to the parent directory - of the current file if a root can’t be found: +* A standalone function to set the working directory to the project’s root, or + to the parent directory of the current file if a root can’t be found: > function! s:setcwd() let cph = expand('%:p:h', 1)