/tmux-copy

Another hint-based copying plugin for tmux

Primary LanguageRustMIT LicenseMIT

tmux-copy

A highly opinionated copying plugin inspired by several predecessors:

Written primarily for personal use. Relies on copypasta-ext for system clipboard support. Currently only used on Linux/Wayland, but in theory it should work on other operating systems.

Installation

Requires Rust to compile the binaries, and tpm to manage the tmux installation.

  • Add set -g @plugin 'nwtnni/tmux-copy' to your .tmux.conf
  • Install with <PREFIX>-I
  • Navigate to your plugin directory (typically ~/.tmux/plugins)
  • Run cargo build --release to compile

Known Issues

  • Not very configurable
  • Requires Rust compiler to build binaries from source
  • Allows overlapping matches

"Configuration"

  • Regular expressions defined in find
  • Matching colors defined in main
  • Hint strings defined in hint
  • Key binding (<PREFIX>-f) defined in tmux-copy.tmux

Performance

  • Uses regex as the underlying search engine
  • Scans each line once with a RegexSet to determine if any specific regular expression matches. Scans again for each regular expression that matches at least once in the line. Assuming matches are sparse, we'll only scan each line a single time independently of how many specific regular expressions there are.
  • Generates hint strings at compile time using a fun macro
  • Minimizes calls to tmux