Skip to content

Instantly share code, notes, and snippets.

@ja-k-e
Last active September 29, 2016 22:44
Show Gist options
  • Save ja-k-e/2f9a9155f0f27a20cf78c7a39e636f58 to your computer and use it in GitHub Desktop.
Save ja-k-e/2f9a9155f0f27a20cf78c7a39e636f58 to your computer and use it in GitHub Desktop.
iTerm Rails Highlighting

Hey! Lets make our rails server logs nice.

In iTerm, we can color regex matches to make things less gross.

To do so, you should create a new profile explicitly for rails server. Open iTerm prefs and create a new one.

You can map a shortcut to it, and even add an initial command at startup

Then click "Advanced" then "Edit" triggers

You can add regular expressions and then do shit when they occur.

Obviously I already have a few, but heres the few you might want for copy and pasting:

  • json requests: method\=.+ path\=.+
  • the /*STUFF*/ rails info after every line \/\*application:.+\*\/

you can add more, like I have the "HERE" one for everytime i ap "HERE", because i do that all the time to see where or if something is firing.

I also have a red one that I always am changing when im trying to find specific things.

One Gotcha

The way this shit works is it takes the last x lines and does the regex on that. That means if you are trying to match a huge message that starts with whatever, x needs to be high enough to grab the whole message.

That x value is a setting.

I have it set to 15. the default is three which means anything over three lines at the time of rendering wont match.

Have fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment