diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index 9243031..9a31ff4 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -720,6 +720,48 @@ Statuslines:~ For rebuilding the statuslines, see |g:ctrlp_status_func|. +=============================================================================== +CUSTOM-CONFIGS *ctrlp-custom-configs* + +* Use |wildignore| for |g:ctrlp_user_command|: +> + function! s:wig2cmd() + " Change wildignore into space or | separated groups + " e.g. .aux .out .toc .jpg .bmp .gif + " or .aux$\|.out$\|.toc$\|.jpg$\|.bmp$\|.gif$ + let pats = ['[*\/]*\([?_.0-9A-Za-z]\+\)\([*\/]*\)\(\\\@) + +* 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) + if match(cph, '\v^<.+>://') >= 0 | retu | en + for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects'] + let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';']) + if wd != '' | let &acd = 0 | brea | en + endfo + exe 'lc!' fnameescape(wd == '' ? cph : substitute(wd, mkr.'$', '.', '')) + endfunction + + autocmd BufEnter * call s:setcwd() +< +(requires Vim 7.1.299+) + =============================================================================== CREDITS *ctrlp-credits*