Giter VIP home page Giter VIP logo

Comments (10)

wincent avatar wincent commented on July 18, 2024

Yes, depending on whether you are using ack, ag, rg etc, you can use various options, listed here:

let s:options = {
\ 'ack': [
\ '--ignore-ack-defaults',
\ '--ignore-case',
\ '--ignore-dir',
\ '--ignore-directory',
\ '--invert-match',
\ '--known-types',
\ '--literal',
\ '--no-recurse',
\ '--recurse',
\ '--sort-files',
\ '--type',
\ '--word-regexp',
\ '-1',
\ '-Q',
\ '-R',
\ '-i',
\ '-k',
\ '-r',
\ '-v',
\ '-w',
\ ],
\ 'ag': [
\ '--all-types',
\ '--all-text',
\ '--case-sensitive',
\ '--depth',
\ '--follow',
\ '--ignore',
\ '--ignore-case',
\ '--ignore-dir',
\ '--invert-match',
\ '--literal',
\ '--max-count',
\ '--skip-vcs-ignores',
\ '--unrestricted',
\ '--word-regexp',
\ '-Q',
\ '-U',
\ '-a',
\ '-i',
\ '-m',
\ '-s',
\ '-t',
\ '-u',
\ '-v',
\ '-w'
\ ],
\ 'rg': [
\ '--case-sensitive',
\ '--files-with-matches',
\ '--follow',
\ '--glob',
\ '--hidden',
\ '--ignore-case',
\ '--invert-match',
\ '--max-count',
\ '--maxdepth',
\ '--mmap',
\ '--no-ignore',
\ '--no-ignore-parent',
\ '--no-ignore-vcs',
\ '--no-mmap',
\ '--regexp',
\ '--smart-case',
\ '--text',
\ '--threads',
\ '--type',
\ '--type-not',
\ '--unrestricted',
\ '--word-regexp',
\ '-F',
\ '-L',
\ '-R',
\ '-T',
\ '-a',
\ '-e',
\ '-g',
\ '-i',
\ '-j',
\ '-m',
\ '-s',
\ '-t',
\ '-u',
\ '-v',
\ '-w'
\ ]
\ }

For example, --ignore-dir for ack, --ignore for ag etc.

Autocompletion is available for these when using :Ack and the other commands.

from ferret.

Mte90 avatar Mte90 commented on July 18, 2024

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.

from ferret.

wincent avatar wincent commented on July 18, 2024

@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.

from ferret.

kinowarrior avatar kinowarrior commented on July 18, 2024

@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:

with_tags

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.

from ferret.

kinowarrior avatar kinowarrior commented on July 18, 2024

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.

from ferret.

kinowarrior avatar kinowarrior commented on July 18, 2024

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.

from ferret.

kinowarrior avatar kinowarrior commented on July 18, 2024

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!

from ferret.

kinowarrior avatar kinowarrior commented on July 18, 2024

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.

from ferret.

wincent avatar wincent commented on July 18, 2024

@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.

from ferret.

NICHTJ3 avatar NICHTJ3 commented on July 18, 2024

If anyone else is wondering why they can't ignore files when using ag it appears to be caused by this

from ferret.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.