RSS Amplifier

Mango Umbrella · Jul 30, 2026

Configure iTerm2's Smart Selection for Diff Paths

0
Sign in to vote or save

Mango Umbrella

Published under Mango Snippets, Jul 30, 2026

When working with diffs in the terminal, for example:

--- a/src/pyrefdev/mapping/pylabel.py
+++ b/src/pyrefdev/mapping/pylabel.py

I often need to copy the path of the file. But double-clicking the path selects a/src/pyrefdev/mapping/pylabel.py by default.

Luckily, you can configure iTerm2's Smart Selection with this regex to only select the path part:

(?<=[-+]{3} [ab]/)\S+

Here is a step-by-step guide:

  • Go to Settings > Profiles > Advanced > Smart Selection > Edit.
  • Click the + button.
  • Set Regular expression to (?<=[-+]{3} [ab]/)\S+.
  • Set the precision to Very High so it wins over the built-in path rules.

Now a double-click selects just src/pyrefdev/mapping/pylabel.py.

Read the original on mangoumbrella.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.