Closed airblade closed 8 years ago
You can use :Ag search-for app/assets/stylesheets/ lib/assets/stylesheets/ vendor/assets/stylesheets/
or (if you want spaces in your search query) :Ag "search for" app/assets/stylesheets/ lib/assets/stylesheets/ vendor/assets/stylesheets/
.
This is a pretty thin wrapper around ag, so you even do things like pass in command line options (e.g. :Ag "search for" --literal dir/
).
Thanks – however I was after a way to pass all the directories automatically. For example:
:CustomAgCommand search for
– which would then do the equivalent of:
:Ag "search for" app/assets/stylesheets lib/assets/stylesheets vendor/assets/stylesheets
Never mind, this does what I want:
command -nargs=1 Ags Ag <args> app/assets/stylesheets lib/assets/stylesheets vendor/assets/stylesheets
command -nargs=1 Agj Ag <args> app/assets/javascripts lib/assets/javascripts vendor/assets/javascripts
I have this bash function to search all the stylesheets in a Rails app:
I'd like to replicate that in Vim, i.e. be able to type
:Ags TEXT
and have the plugin search the three stylesheets directories.What's the best way to achieve this? With a new command, or a map, or something else?