Git Product home page Git Product logo

Comments (9)

ggreer avatar ggreer commented on May 14, 2024 3

Ok take a look at master now. You can configure colors like this:

ag --color-path "1;32" --color-match "30;41" --color-line-number "2;33" blah

from the_silver_searcher.

ggreer avatar ggreer commented on May 14, 2024

I have nothing against this feature, but would this be an environment variable or a command line parameter or config file or what?

from the_silver_searcher.

earwin avatar earwin commented on May 14, 2024

No hard preferences here.
Maybe envars are a teeny little bit worse choice then the other two, as they pollute the shared namespace.
Command-line param seems the easiest way out, since you parse these already and have no configs as of yet?

from the_silver_searcher.

gurgeous avatar gurgeous commented on May 14, 2024

Just started playing with ag after reading about it on HN today. I'd like to customize the color too. Perhaps something simple like:

--colors-path "1;32"
--colors-match "30;43"
--colors-line-number "1;33"

An AG_OPTIONS environment variable (similar to GREP_OPTIONS) would be appreciated too, naturally. I might try to put together a pull request, if I can resuscitate my rusty C skills. :)

Another (minor) suggestion - perhaps you could update the PPA? I was getting ready to file some bugs related to .gitignore, but they seem to be fixed.

Thanks for creating this!

from the_silver_searcher.

ggreer avatar ggreer commented on May 14, 2024

I'm not a fan of AG_OPTIONS. Bash aliases solve the same problem, and they work with any program.

I've deleted my PPA. I'm done dealing with debian/rules, and it's better to have no PPA than an outdated one. If someone wants to maintain their own PPA, I'll link to it in the README.

I'll add support for color customization later today.

from the_silver_searcher.

gurgeous avatar gurgeous commented on May 14, 2024

Now I feel bad! Was maintaining the PPA a burden? I don't know what's involved, really.

As an aside, an environment variable can be advantageous vs. an alias if you end up running searches within tools like emacs. No biggie though. I use a ton of aliases too.

I made this change today to preview ag with spiffy new colors:

const char *colors_path = "\e[0;35m";
const char *colors_match = "\e[1;35m";
const char *colors_line_number = "\e[0;32m";

Can't wait to check out the new flags. Thanks!

from the_silver_searcher.

ggreer avatar ggreer commented on May 14, 2024

Good point about running from emacs. You've convinced me. Now I'm not against an AG_OPTIONS.

I tried writing the feature a while ago, but gave up. It looked simple initially, but I couldn't find a simple way to parse a string into a format read by getopt_long.

As long as the implementation isn't a crazy huge/complicated pull request, I'm fine with merging it. I doubt I'll ever write it myself.

from the_silver_searcher.

gurgeous avatar gurgeous commented on May 14, 2024

This is great, works perfectly! Here's what I'm using for my solarized shell:

alias ag="ag --color-path 35 --color-match '1;35' --color-line-number 32"

I think the trick with getopt_long would be to parse the env variable into an array, then prepend to argc/argv. I'll try to take a crack at it if I get a chance. Maybe I can dust off valgrind too. I don't trust myself.

Thanks for making the change!

from the_silver_searcher.

ggreer avatar ggreer commented on May 14, 2024

Cool. I'll close this issue then.

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.