Skip to content

Instantly share code, notes, and snippets.

@daGrevis
Created July 1, 2019 09:39
Show Gist options
  • Save daGrevis/4f9ed8efbe175bd551df90e5ec7c223d to your computer and use it in GitHub Desktop.
Save daGrevis/4f9ed8efbe175bd551df90e5ec7c223d to your computer and use it in GitHub Desktop.
" Don't change working directory.
let g:ctrlp_working_path_mode = ''
" How CtrlP finds files. For now it uses git/hg when possible, but fallbacks to find.
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files -oc --exclude-standard'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': 'find %s -type f -o -type l'
\ }
" CtrlP height.
let g:ctrlp_match_window = 'max:20'
" Custom status.
function! CtrlPStatusFuncMain(focus, byfname, regex, prev, item, next, marked)
return getcwd()
endfunction
let g:ctrlp_status_func = {
\ 'main': 'CtrlPStatusFuncMain',
\ }
let g:ctrlp_map = ''
function! CtrlP()
if (getcwd() == $HOME)
echo "Won't run in ~"
return
endif
if (getcwd() == '/')
echo "Won't run in /"
return
endif
CtrlP
endfunction
nnoremap <C-p> :call CtrlP()<CR>
" Clears cache and then runs CtrlP.
nnoremap <Leader>p :CtrlPClearAllCaches \| CtrlP<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment