Giter Site home page Giter Site logo

Comments (7)

bronson avatar bronson commented on May 16, 2024 76

If anyone is coming here looking for the difference between --hidden and -u, this might be what you want:

put /.git/ in your ~/.agignore file.

Now, ag -u will search every file including git directories, and ag --hidden will search hidden files, but still stay out of .git directories and everything mentioned in .gitignore.

This had me stumped to for a good 20 minutes. Thanks for a great utility!

from the_silver_searcher.

HelloGrayson avatar HelloGrayson commented on May 16, 2024 36

FWIW, I added this to my profile:

alias ag='ag --hidden'

I couldn't think of a situation when I didn't want to search hidden files (assuming .agignore was respected).

from the_silver_searcher.

luochen1990 avatar luochen1990 commented on May 16, 2024 8

@breerly I also think that search hidden files should be the default behavior, if somebody want to change this behavior, he just need to add .* into .agignore

from the_silver_searcher.

ggreer avatar ggreer commented on May 16, 2024 3

I don't know about making it the default, but I agree with you. Ag should definitely have this feature. I just merged #25, which allows you to specify searching multiple paths. So you can run ag blah .* . to search all hidden files/directories and the current directory. It's less than ideal, but it works for now.

A command-line option to have this behavior might not be a bad idea.

from the_silver_searcher.

stherold avatar stherold commented on May 16, 2024 1

I put this alias in my .zshrc which is exactly what I want: Searching .env files that are ignored in my .gitignore and exclude uninteresting directories:

alias ag="ag --hidden --skip-vcs-ignores --ignore=\"*Library*\" --ignore=\"*.gem*\" --ignore=\"*.build*\" --ignore=\"*.git*\""

from the_silver_searcher.

vaughnkoch avatar vaughnkoch commented on May 16, 2024

Yeah, maybe the simplest thing would be a command line switch like you suggested - "search hidden files as well" but should be coupled with what's in .hgignore. Thanks for ag again!

from the_silver_searcher.

silverwind avatar silverwind commented on May 16, 2024

I don't think dotfiles should be searched by default because of .git but .ignore should have the ability to accept negated pattern like !.* which would essentially act the same as --hidden but in a portable manner which would allow patterns like

/.git/
!.*

Edit: See #168 regarding negated patterns.

from the_silver_searcher.

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.