0

I have silver searcher set up in vim and would like to search from the root of a project directory without having to explicitly passing in the file path.

For example, let's say I'm at /project_root/lvl1/lvl2.

I want to search for a word starting from /project without having to type :Ag word ../...

Is there a way to do so?

doctopus
  • 5,349
  • 8
  • 53
  • 105

1 Answers1

0

Note that the original Ag (rking/ag.vim) is deprecated. The owner recommended moving back to Ack, but there is an active development in an Ag fork at albfan/ag.vim. Using this version of Ag, you can enable project discovery by the following setting (:help g:ag.working_path_mode):

let g:ag.working_path_mode='r'

You may need to prepend let g:ag={}. Also, note that running :Ag with this option will silently :cd you to the project directory.

Amadan
  • 191,408
  • 23
  • 240
  • 301