Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
/ tmux-extractor Public archive

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.

License

Notifications You must be signed in to change notification settings

pbnj/tmux-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tmux-extractor

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.

Dependencies

Install

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

Usage

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

Configuration

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

Credits

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages