2

Im using ctrlp.vim and I'm trying to use the :CtrlPTag feature. I setup ctags using the instructions from this blog post:

https://blog.sensible.io/2014/05/09/supercharge-your-vim-into-ide-with-ctags.html

I've generated a ctags file for my Rails project and all my bundled gems using:

ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)

The ctags file is about 13 MB.

When I try to run :CtrlPTag and just search for methods the search is very slow. Trying to type and delete the search text almost hangs vim completely.

Does anyone have any suggestions to speed up :CtrlPTag?

Note: I have tried to setup vimgrep to use 'ag' thinking that would be faster, but that hasn't helped. See: https://thoughtbot.com/blog/why-postgres-wont-always-use-an-index (I imagine this only helps with file searches)

Thanks for the help!

Dave Powers
  • 2,051
  • 2
  • 30
  • 34
mawaldne
  • 3,919
  • 6
  • 31
  • 37

2 Answers2

5

I hesitate to put this as an answer since it's sort of a non-answer, but you should consider fzf.vim for searching tags. I had a similar problem with CtrlP, it was painfully slow on large tag files. fzf works pretty much identically to CtrlP for tags, except it can be orders of magnitude faster. Just install it with your package manager of choice and update the mapping you currently have for CtrlPTags with a mapping for :Tags:

" Search tags
nnoremap _ :Tags<CR>
Marcus Buffett
  • 1,289
  • 1
  • 14
  • 32
3

You don't need to switch to fzf.

The default searcher for ctrlp using vimL, so is slow. However, ctrlp can use extensions implemented in C or other low level languages.

Since, ctrlp has been around much longer, it has a lot of extensions and pretty stable

Add this extension:

https://github.com/FelikZ/ctrlp-py-matcher

alpha_989
  • 4,882
  • 2
  • 37
  • 48
  • Wow, this is world's better than the default ctrlp search performance. Thanks! Bonus, in this report, there's a secondary readme on more speed improvements that can be made to ctrlp AND a note on the benefits of using silver searcher. Awesome stuff! – BTRUE Aug 02 '18 at 06:46