Parameter for Smart Selection Action: Copy

29 views
Skip to first unread message

Robbie Gates

unread,
Apr 30, 2026, 11:51:07 PMApr 30
to iterm2-discuss
Hi George (and thanks as always for an awesome tool).

Is it possible for the Smart Selection Action "Copy" to get a parameter field like "Send Text..." or "Run Command..." have?

My use case is I'd like to set it to `\(matches[1])` so I can copy just part of the Smart Selection. I could do this with `Run Command...` and pbcopy (thanks Gemini for noticing this), regex lookahead isn't ideal because the prefix in my case has a `*` in it (which yes I could bound for practical purposes) - but it feels like Copy being able to take a value is a natural extension?

 - Robbie

George Nachman

unread,
May 4, 2026, 9:47:01 PMMay 4
to iterm2-...@googlegroups.com
Commit 4eea484d8bcbcd6fa474bf5fef914256cb50a256 modifies the Copy Smart Selection action to take a parameter. For backward compatibility, an empty value means “copy the selection according to user prefs”. Otherwise, the unstyled string derived from the parameter is copied. You can verify in tomorrow’s nightly build.

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/iterm2-discuss/c2caff75-571c-461f-850c-afc49943a459n%40googlegroups.com.

Robbie Gates

unread,
May 28, 2026, 6:42:57 PMMay 28
to iterm2-discuss
Sorry for the long delay George - I finally got around to playing with this and it's exactly what I wanted - thank you so much - it's very handy.

Fwiw, my use case is a pattern like `\t[^:]{0,20}:\s*([^\s].*)$` which I use to match `git status` lines like `modified: Some/File/With Spaces/In the Name.png`, and now I can put `"\(matches[1])"` in the field to make a `Copy Target File Quoted` action, which is super useful to populate shell lines. The real value add is the space handling - the repo I work most in currently has art files whose names often have spaces, and I often want to stage specific versions or reset them from the CLI, and this is much easier than fiddling with copying around the spaces (I am a clumsy mouse user at best).

Aside: I'm not sure if there's a standard community forum for sharing configuration tidbits like this - do you know of any? My google search didn't turn up a clear winner for "small standalone bits" (as opposed to "just copy my whole iterm and shell config").

 - Robbie

George Nachman

unread,
Jun 3, 2026, 10:10:09 PM (11 days ago) Jun 3
to iterm2-...@googlegroups.com
That’s a good solution you found. There isn’t really such a community (this mailing list is probably the closest thing). If you’ve got the bandwidth, start one! 😃

Reply all
Reply to author
Forward
0 new messages