VIM ctrlp.vim插件:如何重新扫描文件?

我遇到了令人敬畏的ctrlp.vim插件。 这是我以前用过的Command-T插件的一个很好的选择。 我不喜欢Command-T的是,启动vim后第一次调用文件时需要大约20-30秒才能重新扫描文件。

CtrlP工作得更快,但它似乎不会自动重新扫描新创建的文件。 我应该如何手动触发重新扫描?

谢谢!


从文档:

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

这假定你已经处于ctrl-p模式。 请注意,您可以在查询中键入F5,即可以键入几个字符,发现它与最近更新的文件不匹配,然后点击F5进行刷新。 如果该文件刚刚添加到ctrl-p缓存中,它会自动向您显示匹配。


正如Jeet所说,你可以按F5,但如果这样做不起作用,你总是可以运行:CtrlPClearCache ,这是F5应该运行的。

从文档中

:CtrlPClearCache
刷新当前工作目录的缓存。 与按CtrlP内部一样。
要启用或禁用缓存,请使用| g:ctrlp_use_caching | 选项。


如果你愿意的话,你可以在保存发生时自动缓存缓存,所以它会在下次使用时被刷新。

把它放在你的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

不幸的是,无法自动将缓存保留在后台。

链接地址: http://www.djcxy.com/p/49467.html

上一篇: VIM ctrlp.vim plugin: how to rescan files?

下一篇: What does ^M character mean in Vim?