diff --git a/init.vim b/init.vim index b32e686..950edd4 100644 --- a/init.vim +++ b/init.vim @@ -18,4 +18,5 @@ runtime! init/*.vim " This sources a .vim/local.vim file in the current directory, if it exists. " This allows for project-specific settings, such as on-write autocmd's etc. +" The silent! prevents it from showing an error if no local.vim file is found silent! source .vim/local.vim diff --git a/init/ctrlp.vim b/init/ctrlp.vim index 04f9b70..b3d5761 100644 --- a/init/ctrlp.vim +++ b/init/ctrlp.vim @@ -1,8 +1,28 @@ " Remap CtrlP shortcut let g:ctrlp_map = 't' -" Disable caching -let g:ctrlp_use_caching = 0 +" Enable caching +" I think this'll make it run just a bit faster +let g:ctrlp_use_caching = 1 +" Don't clear the cache on exit, so it won't re-index every time we open the +" project +let g:ctrlp_clear_cache_on_exit = 0 +" Cache inside the project's .vim directory to keep things tidy +let g:ctrlp_cache_dir = './.vim/cache/ctrlp' -" Only show files in git repo, ignoring .gitignore content -let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] +" You can define different listing commands for different version controls +" systems etc. +" I currently only have experience with Git, but I've written the config like +" this to allow for easy expansion if needed. +let g:ctrlp_user_command = { + \ 'types': { + \ 1: ['.git', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] + \ }, + \ 'fallback': 'find %s -type f' +\ } + +" Limit max number of files +" This prevents me from indexing my entire HOME by accident +let g:ctrlp_max_files = 10000 +" Also limit recursion depth +let g:ctrlp_max_depth = 40