0

I built a cpp environment with YCM, EasyGrep and some other plugins.

With YCM, I can jump to declaration/definition, with EasyGrep, I can grep a keyword easily.

But I found something weird:

Saying that I'm coding a c++ project, I put the cursor under #include <iostream> and then type YCMCompleter GoToDefinitionElseDeclaration to jump to the file iostream. After that, I type <C-o> to jump back.

Now, if I use EasyGrep to grep some keyword, such as cout, the searching path will include the file iostream. Obviously it is because I just jumped to that file.

As my understanding, vim buffers all of files that are opened by me so that the searching path of EasyGrep now includes the file iostream.

Is there some way, such as reloading the buffer of vim, to limit the searching path?

  • 1
    What do you mean... Do you not want EasyGrep to search for cout in the iostream file? Do you want it to search the current buffer only? There's :bd that you can use to delete a buffer (have Vim "forget" about a file)... Is that what you're looking for? – filbranden Apr 1 at 11:18
  • 1
    @filbranden or dont use a plugin that searches all buffers :) – D. Ben Knoble Apr 1 at 13:11
  • @D.BenKnoble So do we have another way? In fact I use Nerdtree to load my project, and I want to make sure that grep only happens in the zone of my project. – Yves Apr 1 at 19:45
  • If you :cd to the root of your project, :grep will only search the current directory (your project). Not sure what nerdtree has to do with it – D. Ben Knoble Apr 1 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.