I switched to iTerm2 recently from a lifetime of Terminal.app, and I am not missing the old Terminal one bit.

Ever double-clicked a token in your terminal to select it, and wished that Terminal.app knew what you actually meant to select? iTerm2 lets you define what text a quadruple-click will select, by matching the surrounding context against a regex.

Here are some additional Smart Selection rules I’ve found very useful:

  • Capturing the value of key=value: (?<==)[A-Za-z0-9-]+, precision high
  • Hex strings (hashes): [A-Fa-f0-9]+, precision normal
  • Path without initial [ab]/: (?<=\b[ab]/)([[:letter:][:number:]._-]+/+)+[[:letter:][:number:]._-]+/?, precision high

The last one is to get paths from git diff without the initial a/ or b/.