tmux-thumbs
tmux-thumbs copied to clipboard
Regexes in Tmux config
I'm having some issues getting regexes to match in thumbs - it seems like the issue is that tmux is escaping parts of the regex, which breaks the match.
For instance, if I try to add
set -g @thumbs-regexp-1 '\["[[:alnum:]]+"\]'
(this is a sub-RE if what I actually want - Terraform module names...) that doesn't work.
tmux show -g indicates displays:
@thumbs-regexp-1 '\\["[[:alnum:]]+"\\]'
In other words, it looks like the \ gets itself escaped, which blocks the match.
@fcsonline Are you still interested in maintaining this repo? I notice that PRs are growing and last commit is > 2 years ago.
Found the cause: https://github.com/fcsonline/tmux-thumbs/blob/ae91d5f7c0d989933e86409833c46a1eca521b6a/src/swapper.rs#L158
The options regexp matches [^"]+ for values, so no regular expression with a '"' will match.
https://xkcd.com/234/
The workaround for now is to use \x22 instead of ", but a more robust solution would be appreciated I think.