VIM ctrlp.vim plugin: how to rescan files?

ID : 25815

viewed : 89

Tags : vimpluginsvim

Top 5 Answer for VIM ctrlp.vim plugin: how to rescan files?

vote vote


From the documentation:

<F5>   - Refresh the match window and purge the cache for the current directory.   - Remove deleted files from MRU list. 

This assumes you're in ctrl-p mode already. Note that you can hit F5 in the middle of a query, i.e., you can type a few characters, find it's not matching a recently updated file, and hit F5 to refresh right then. It will automatically show you the match if the file was just added to the ctrl-p cache.

vote vote


As Jeet says you can press F5 but if that doesn't work you can always run :CtrlPClearCache which is what F5 is supposed to run.

From the documentation

Flush the cache for the current working directory. The same as pressing <F5> inside CtrlP.
To enable or disable caching, use the |g:ctrlp_use_caching| option.

vote vote


I added this to .vimrc which turns off ctrlp caching

g:ctrlp_use_caching = 0

vote vote


If you want, you can automatically bust the cache when a save happens, so it will be forced to refresh on next use.

Put this in your vimrc (credit docwhat):

" CtrlP auto cache clearing. " ---------------------------------------------------------------------------- function! SetupCtrlP()   if exists("g:loaded_ctrlp") && g:loaded_ctrlp     augroup CtrlPExtension       autocmd!       autocmd FocusGained  * CtrlPClearCache       autocmd BufWritePost * CtrlPClearCache     augroup END   endif endfunction if has("autocmd")   autocmd VimEnter * :call SetupCtrlP() endif 

Unfortunately there's no way to automatically keep the cache fresh in the background.

vote vote


I know this is a old question, but it's so simple that I have to comment. Put this in your .vimrc

:nnoremap <c-p> :CtrlPClearCache<bar>CtrlP<cr> 

This will refresh the cache and then call CtrlP. No more missing files.

Top 3 video Explaining VIM ctrlp.vim plugin: how to rescan files?