You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
559 B
21 lines
559 B
7 months ago
|
#!/usr/bin/env zsh
|
||
|
|
||
|
set -euo pipefail
|
||
|
|
||
|
TMPFILE=$(mktemp)
|
||
|
RG_OPTS="--word-regexp"
|
||
|
PATTERNS=(
|
||
|
"[a-f0-9]{5,}" # hex, assuming only want to copy 5+ characters
|
||
|
"[^\\s]+"
|
||
|
)
|
||
|
PATTERN=${(j[|])PATTERNS}
|
||
|
|
||
|
tmux capture-pane -p -S -2 > "$TMPFILE"
|
||
|
|
||
|
rg "$RG_OPTS" --ignore-case --only-matching "$PATTERN" "$TMPFILE" |
|
||
|
ruby -e 'ARGF.readlines(chomp: true).uniq.each { puts _1 }' |
|
||
|
fzf-tmux -p 80%,60% --layout=reverse \
|
||
|
--print0 \
|
||
|
--preview "rg $RG_OPTS --color=always --context=3 {} $TMPFILE" \
|
||
|
--bind "enter:execute-silent(pbcopy <<< {})+abort" || true
|