I tried today to perform a search on every files of a project. I use Ctrl-P and search on lines like so :


But the result of the search is only on the previously opened file. Here I open only main.php.

Do you know a way to search on all files without having to open them one by one ?

  • 1
    This is something I want as well. If you're using ack or ag, performance shouldn't be an issue. Plus if you're using neovim, it should be async, so there shouldn't be any block either. Jun 12, 2015 at 3:42
  • Finally I use ag as ctrlp command :)
    – nobe4
    Jun 12, 2015 at 4:51

2 Answers 2


:CtrlPLine is actually supposed to work on listed buffers.

If you absolutely want to use that feature on every file in your project, you could add them to the argument list (and thus the buffer list) with something like:

:argadd **/*.php

but that doesn't sound like a very good idea for performance reasons.

Using :vimgrep or :grep sounds a lot better to me:

:vim foo **/*.php

You lose the "fuzziness" of CtrlP, obviously, but you get reliability and flexibility in return.


:help :argadd
:help :vimgrep
:help :grep
:help :cwindow
:help quickfix
  • A key difference between CtrlP and vim-grep, is CtrlP is interactive.
    – ideasman42
    Feb 7, 2017 at 0:00

You should use thoses plugins Sidesearch or fzf

Both allow to search in recursive directories using silversearch-ag

fzf allow to search on the listed files which include your string.

  • 1
    Hi @MisterBanal, welcome on our site! You should precise in your answer if these plugins can be interfaced with CtrlP as OP asked. If they can be interfaced you should explain how and if they can't you should at least give a basic example of how to use them otherwise your answer doesn't really answer the question. (You can change your answer with the "edit" button under the text).
    – statox
    Feb 6, 2017 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.