A simple script to extract content of a tmux pane, filter them through fzf
,
and piping the result to various CLI utilties, like open
, pbcopy
, or just
return the result into the bash prompt of the current pane.
Clone this repository locally:
git clone https://github.com/pbnj/tmux-extractor </clone/path/to/tmux-extractor>
Then add the following to your .tmux.conf
:
if-shell " [ -d </clone/path/to/tmux-extractor> ] " run-shell "</clone/path/to/tmux-extractor>/tmux_extractor.tmux"
Reload tmux:
tmux source-file ~/.tmux.conf
To extract text & insert into current tmux pane:
$ alias extractor="</clone/path/to/tmux-extractor/extractor.sh>"
# Now, you can invoke "extractor" whenever needed:
$ vim $(extractor)
# Or place a similar function in your .bashrc/.bash_profile/.zshrc/etc:
vix() {
file="$(extractor)"
[ -n "$file" ] && vim "$file"
}
To open using the default program:
<prefix> + C-o
# fzf selection is opened in the default program
To copy into the system clipboard:
<prefix> + C-c
# fzf selection is copied into system clipboard
You may configure options following the tmux syntax:
set -g <key> <value>
The available options and their default values are:
@tmux-extractor-copy-bind
=C-c
@tmux-extractor-copy-command
=pbcopy
@tmux-extractor-open-bind
=C-o
@tmux-extractor-open-command
=open
- extrakto for the inspiration.
- junegunn/fzf for the command-line fuzzy finder utility.