I want to enable vim-ag to search a word inside specific directory.
Currently I have the following mapping in my vimrc
:
noremap <leader>a :Ag! <C-r>=expand('<cword>')<CR><CR>
which searchs the cword
in the current directory.
I want to expand it a bit so that I would be able to search in another directory as well.
I'm not sure if I can use noremap
to get additional input (the target directory). If this is possible - then that would be best (i.e. press <leader>a
-> add somehow the target directory -> Ag will search the cword
in target directory)
If not - I want to config Ag manually - with another binding, to look in my git repo head directory - something like:
noremap <leader>a :Ag! <C-r>=expand('<cword>') <GIT REPO DIR><CR><CR>
- would that work (I'm not sure if the expand operator breaks things or not
- how do I get the git repo dir?