7 ms·
Grc - it's like stylesheets for your terminal
- bitwize 14y agoMeh. Because I'm a Real Man with Real Big Balls I still think terminal text should come in one of three colors: green, amber, and page white. And you choose the color when you buy the terminal. Kidding aside, I do do all my coding in an xterm that's had the font set to Glass Tty VT220 and the color set to one of those. Text decoration for highlighting purposes is done with our old friends bold, underline, and reverse video. But I'm retro like that.
- aMoniker 14y agoYou are so cool. How can I be cool like you are cool?
- unimpressive 14y agoecho -e '\033[0;32m' EDIT: Of course, real hackers use a rainbow shell prompt. (http://www.termsys.demon.co.uk/vtansi.htm http://www.termsys.demon.co.uk/vtansi.htm) Building one of these is left as an exercise for the reader.
- liyanchang 14y agoEssentially running a regex and applying colors. Very cool for simple applications. Given how difficult regexs are to write properly, this probably doesn't scale well. Sadly, there isn't a DOM for terminal applications.
- kibwen 14y agoSolarized provides a great mapping table between terminal color names and various color spaces. Have to disagree slightly with this. Solarized is a great starting point, but, last time I checked, using the provided mapping table leads bold green, bold blue, and (most importantly) nonbold white to all become nearly-indistinguishable shades of grey. This alone damages the utility of the normally-colorized output of `ls`, as well as any tools that expect bold and nonbold versions of the same color to be roughly the same hue. If you can stand losing Solarized's ability to swap back and forth between light and dark modes, I highly recommend tweaking it to your needs rather then relying on the default.
- zdw 14y agoSimilar problem here - I tried Solarized for a while and found that it was too low contrast for my tastes. I switched to Tim Pope's vividchalk.vim and have been quite happy ever since: https://github.com/tpope/vim-vividchalk https://github.com/tpope/vim-vividchalk
- petercooper 14y agoI'm sure someone here will know the answer for this off the top of their head so.. how does this work under the hood? How does it get to act as a sort of 'filter' for stdout? I've recently seen a system that can 'record' your terminal session for replay on the Web - http://ascii.io/ http://ascii.io/ - whose 'recorder' forks off a psuedo terminal for this (https://github.com/sickill/ascii.io-cli/blob/master/bin/asciiio.py https://github.com/sickill/ascii.io-cli/blob/master/bin/asci...). Would something like Grc use a similar approach or is there another way?
- moonboots 14y agoThis script inserts terminal escape sequences into text. These sequences are just text that the terminal interpret as color transitions. Ascii.io transforms these terminal escape sequences into html/css, so Grc should work fine with it.
- petercooper 14y agoThis script inserts terminal escape sequences into text. I understand that part. But there's a screenshot where a "ping" is being done at a normal looking terminal and it just works without being explicitly piped through a program that does the above. What's the mechanism for piping all the terminal output through another process?
- netherland 14y agoThose are supplied if you source the aliases that ship with the Homebrew formula: https://github.com/mxcl/homebrew/blob/7bbe7e9311ce95a141bf5f77ca7fa02d43387748/Library/Formula/grc.rb#L25 https://github.com/mxcl/homebrew/blob/7bbe7e9311ce95a141bf5f...
- moonboots 14y agoThe initial grc command aliases commands like 'ping' to a modified command that processes the output[1]. [1] https://github.com/mxcl/homebrew/blob/7bbe7e9311ce95a141bf5f77ca7fa02d43387748/Library/Formula/grc.rb#L25 https://github.com/mxcl/homebrew/blob/7bbe7e9311ce95a141bf5f...
- iopuy 14y agoOver the years this has been a hobby of mine to colorize the shell on Linux or at least make it easier on my eyes. The best results I've had relied on the following features: 1. Screen. Screen allowed me to colorize the hardstatusline at the bottom of the page. You can also set the hardstatus line so it updates to show the open application. Watch the video at the bottom of the screen and when I open Vim and how it updates the tab name on the hardstatus line. 2. Using zsh. Zsh allows you to set the right hand prompt and its color. 3. Using Xterm. Xterm allow me to launch it with any parameters controlling font, background color, foreground color, font size etc. The font I found that work the best was "Liberation Mono". 4. Colorize the prompt. Pretty standard. HEre is a video making use of all these features except for zsh. This was back when I used bash. http://www.youtube.com/watch?v=u5_44vs1WvY http://www.youtube.com/watch?v=u5_44vs1WvY
- Nick_C 14y agoThanks. Actually, that video is about cut-n-paste. The michaelkelleher.info site mentioned in the video no longer works. Do you have an updated one?
- olalonde 14y agoI misread the title "it's like cheatsheets for your terminal" and now I can't help wondering if such thing exists. I know there is man but it doesn't exactly have a cheatsheet format. Anyone?
- matthewsnyder 14y agoYou're probably looking for cheat. http://cheat.errtheblog.com/ http://cheat.errtheblog.com/
- deleted 14y ago[deleted]
- pmr_ 14y agoI use different .Xdefaults for my shell "styling" and are incredibly happy with it. Changing to another theme is just one xrdb -merge away.
- gcb 14y agothis goes a little further i guess. you can add color to regexp matches for command outputs.
- pmr_ 14y agoApparently. Judging from what it does the implementation could be a nice example of layering shell tools on top of each other to get new functionality. Probably it has some uses for people that work entirely with the shell.
- swah 14y agoWe start by assuming everyone uses OSX.
- netherland 14y ago> Install via your favorite package manager. I'm on OS X so I use Homebrew:
- rurounijones 14y agoIn fairness I just installed grc on ubuntu and it is nothing like demonstrated on the blog because the homebrew version has extra stuff in it. So "Start by assuming OSX" isn't THAT much of a smarmy reply.
- lloeki 14y ago> because the homebrew version has extra stuff in it. Lies! brew edit grc shows that it's just plain grc 1.4.
- zellux 14y agoAt least the installation script adds some aliases to .bashrc. https://github.com/mxcl/homebrew/blob/master/Library/Formula/grc.rb https://github.com/mxcl/homebrew/blob/master/Library/Formula...
- lloeki 14y agoIt suggests to, via you voluntarily typing echo 'source "`brew --prefix grc`/etc/grc.bashrc"' >> ~/.bashrc
- zobzu 14y agoI don't give a rat ass for over coloring stuff in the terminal. I like when only what helps readability is colored. But then again I do like some fancy stuff. And I noticed the author uses a unicode char in his prompt. While it breaks the \$ functionality ($|#) it looks neat, and I didn't think of that. pretty cool export PS1="\u@\h \w ʎ"
- zobzu 14y agofor the record he uses \u26A1 aka high voltage sign ;-)
- mise 14y agoDoes anyone have trouble with tmux displaying colours? I tried a custom git log query that coloured the custom ordered responses. Rather than showing the text in colour, there were inline codes being displayed.
- dmit 14y agoDoes it work ok without tmux? If not, does git print directly to the terminal, or does it pipe to another program (like a pager)? Most programs make an isatty check in this case, but if you force printing of escape codes and pipe the output to less for example, you'll see the codes in the output instead of their effects.
- mise 14y agoActually, I think you're right, I probably was piping to less at the time (which tmux makes me do more of than usual).
- robbles 14y agoThis is interesting - I actually wrote a tool very similar to Grc a while back: http://pypi.python.org/pypi/rad http://pypi.python.org/pypi/rad It uses the same idea of config files specifying what regexes to look for and how to color them. This tools looks a little more full-featured and tested though. Also, I only thought of applying it to highlighting log files. I didn't think of using aliases to improve the appearance of regular terminal commands.
- pstadler 14y agoIf you're using Terminal.app, the first thing you should do is installing an eye-friendly color theme. Check out Optometrist: https://github.com/pstadler/optometrist https://github.com/pstadler/optometrist
- xs 14y agoNetherland - I installed this and gave it a try. I'm running into one major issue. I can't see my prompt (or the last line in whatever I'm doing). I don't mess around and invoke grc by doing 'grc bash'. This now listens for every command that's in the config file. Well the command I want to work most of all is ssh. When I ssh into another system I don't see my prompt. Any ideas what I can do to fix this?
- sepposade 14y agoNote that if you're an Emacs user and you execute commands from inside Emacs, there is already a framework for colorization in the fontify-* or highlight-* functions.