如何 run/call 第一次在后台使用 CtrlP - VIM

How to run/call CtrlP first time in the background - VIM

第一次调用 CtrlP 时,它会导致构建缓存的相当长的延迟。有没有办法在后台 运行 它以便我可以继续在 vim 中做事?

你不能那样做,事实上,vim isn't multi-threaded

你可以看看NeoVim是多线程的

或者,您可以使用 Unite 插件和 file_rec/async 命令:

Note: with large projects this may cause some performance problems. Normally it is recommended to use |unite-source-file_rec/async| source, which requires |vimproc|.

如果您需要加快CtrlP的索引,您可以使用ag来grep文件,从索引中排除一些文件夹和文件,并设置缓存位置。

为此,将这些行放入您的 .vimrc 中:

let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
  \ --ignore .git
  \ --ignore .svn
  \ --ignore .hg
  \ --ignore .DS_Store
  \ --ignore "**/*.pyc"
  \ -g ""'