Comments (9)
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.
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.
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.
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.
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.
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.
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.
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.
Cool. I'll close this issue then.
from the_silver_searcher.
Related Issues (20)
- Anyone want to help with a friendly fork of this project? HOT 6
- --make file type...
- Travis CI badge is broken
- Compilation stoped on qualifier from pointer target type [-Wcast-qual] HOT 1
- "bus error" on Mac OS with specific test file and regex HOT 1
- ag not finding accent letters in case insensitive search explicitly with -i option
- If the file doesn't exist, skip search instead of throwing errors
- wrong output on osx default terminal
- Confused about flag `--print-long-lines`: long lines seem to be printed by default? But can't turn that behavior *off* or modify it? (like `--print-long-lines=false` or `--print-long-lines=200` or something?)
- 2.2.0: test suite uses cram which is no longer maintained
- Add per-directory .gitignore support
- ignore patterns should not directory below their source file
- ag incorrectly parses [.][^.]*$
- feat: include OSC8 escape codes in output
- memory leak in function 'parse_options' HOT 1
- ag does not work on tmpfs/cgroup filesystem
- Entries in .gitignore are applied to the wrong base directory
- Bash completion script is broken with bash-completion v2.12.0 HOT 1
- Missing `S_ISSOCK` for stdin check HOT 1
- Depends on deprecated pcre library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from the_silver_searcher.