Exclude folders
Mte90 opened this issue · 10 comments
There is a way to exclude folders where ferret search?
Yes, depending on whether you are using ack
, ag
, rg
etc, you can use various options, listed here:
ferret/autoload/ferret/private.vim
Lines 403 to 491 in b1ef0cf
For example, --ignore-dir
for ack
, --ignore
for ag
etc.
Autocompletion is available for these when using :Ack
and the other commands.
Cool, I searched for the term exclude instead ignore and missed that.
In the doc as I can see is not explained to configure them as global.
As example I want that hide stuff in the vendor
folder but I don't want to write always the parameter.
@Mte90: since 09290a2 there is a way to configure default options to be passed to the search executable. For the time being, you can set the options once, globally, at start-up time. If you had a need to set it on a per-directory or per-project basis (for example, via an autocmd), we would need to make some changes to make that possible.
@wincent - I am using Ack, and wish to exclude the tags
file in the base of all of my projects.
Currently when I search I get:
My vimrc
is basically:
" search inside files using ripgrep. This plugin provides an Ack command.
Plug 'wincent/ferret'
let g:FerretHlsearch=0
" search with ack for word under cursor
nmap <leader>A <Plug>(FerretAckWord)
" search & replace word based on previous search term with Ack
nmap <leader>p <Plug>(FerretAcks)
I am unclear how to exclude by filename as per your helpful suggestions above. Would you please mind adding a one liner comment with a snippet that illustrates the solution. Thanks for this awesome plugin.
I tried:
let g:FerretExecutableArguments = {
\ 'ack': '--ignore-file=tags'
\ }
But unfortunately it didn't work, the tags results were still present in the quickfix window.
Ok, I solved this ON THE COMMAND LINE by creating a ~/.ackrc
file, and adding:
--ignore-file=is:tags
In case anyone interested, I used this SOF answer and this template ackrc file.
The commit highlighted above by wincent was also helpful in case just wishing to do this locally.
Spoke too soon. This only works off the command line with ack
. Inside VIM using this plugin, the tags file is still being searched. Also:
let g:FerretExecutableArguments = {
\ 'ack': '--ignore-file=is:tags'
\ }
Does NOT work. Please help!
Final comment. My apologies on this one. Am using ag
(silver searcher) under the covers despite the :Ack
command (as per the README). If I simply create a .ignore
file, or else append tags
to an existing .gitignore
file then it suppresses the tags from appearing in search results.
This one was down to enduser error. Out.
@kinowarrior: yeah, adding it to the .gitignore
is probably the easiest. I am not sure what the current status is with .ignore
vs .agignore
— it might be version and platform dependent, by the looks of issues like this one.