A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator
Go to file
2019-05-01 20:36:40 +00:00
samples Long line sample 2019-03-12 22:21:42 +00:00
src Register matched pattern 2019-05-01 20:36:40 +00:00
.gitignore First version 2019-02-21 10:20:06 +00:00
.rustfmt.toml Format rules with rustfmt 2019-03-17 20:16:55 +00:00
.travis.yml Format rules with rustfmt 2019-03-17 20:16:55 +00:00
Cargo.lock lock message 2019-03-28 12:48:43 +00:00
Cargo.toml Bump version 0.2.3 2019-03-27 23:47:14 +00:00
LICENSE Initial commit 2019-02-04 20:56:14 +01:00
README.md Update README 2019-03-27 23:54:55 +00:00
tmux-thumbs.sh Fix multi regexp 2019-03-28 13:02:15 +00:00
tmux-thumbs.tmux Fix paths 2019-03-06 17:04:05 +00:00

tmux-thumbs

A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints.

Usage

Press ( prefix + Space ) to highlist in you current tmux visible pane all text that match specific pattern. Then press the highlighted letter hint to yank the text in your tmux buffer.

Matched patterns

  • File paths
  • File in diff
  • Git SHAs
  • Colors in hex
  • Numbers ( 4+ digits )
  • Hex numbers
  • IP4 addresses
  • kubernetes resources
  • UUIDs

These are the list of mattched patterns that will be highlighted by default. If you want to highlight a pattern that is not in this list you can add one or more with --regexp parameter.

Demo

demo

Tmux integration

Clone the repo:

git clone https://github.com/fcsonline/tmux-thumbs ~/.tmux/plugins/tmux-thumbs

Compile it with cargo:

cd ~/.tmux/plugins/tmux-thumbs
cargo build --release

Source it in your .tmux.conf:

run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux

Reload TMUX conf by running:

tmux source-file ~/.tmux.conf

Configuration

If you want to customize how is shown your tmux-thumbs hints those all available parameters to set your perfect profile.

NOTE: for changes to take effect, you'll need to source again your .tmux.conf file.

@thumbs-alphabet

default: qwerty

Choose which set of characters is used to build hints. Review all available alphabets

For example:

set -g @thumbs-alphabet dvorak-homerow

@thumbs-reverse

default: disabled

Choose in which direction you want to assign hints. Useful to get shorter hints closer to the cursor.

For example:

set -g @thumbs-reverse

@thumbs-unique

default: disabled

Choose if you want to assign the same hint for the same matched strings.

For example:

set -g @thumbs-unique

@thumbs-position

default: left

Choose where do you want to show the hint in the matched string. Options (left, right).

For example:

set -g @thumbs-position right

@thumbs-regexp-N

Add extra patterns to match. This paramenter can have multiple instances.

For example:

set @thumbs-regexp-1 '[a-z]+@[a-z]+.com' # Match emails
set @thumbs-regexp-2 '[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:' # Match MAC addresses

@thumbs-command

default: 'tmux set-buffer {}'

Choose which command execute when you press a hint.

For example:

set -g @thumbs-command 'pbcopy'

@thumbs-upcase-command

default: 'tmux paste-buffer'

Choose which command execute when you press a upcase hint

For example:

set -g @thumbs-upcase-command 'pbcopy'

@thumbs-bg-color

default: black

Sets the background color for matches

For example:

set -g @thumbs-bg-color blue

@thumbs-fg-color

default: green

Sets the foregroud color for matches

For example:

set -g @thumbs-fg-color green

@thumbs-hint-bg-color

default: black

Sets the background color for hints

For example:

set -g @thumbs-hint-bg-color blue

@thumbs-hint-fg-color

default: yellow

Sets the foregroud color for hints

For example:

set -g @thumbs-hint-fg-color green

@thumbs-select-fg-color

default: blue

Sets the foregroud color for selection

For example:

set -g @thumbs-select-fg-color red

Colors

This is the list of available colors:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • default

Alphabets

This is the list of available alphabets:

  • numeric: 1234567890
  • abcd: abcd
  • qwerty: asdfqwerzxcvjklmiuopghtybn
  • qwerty-homerow: asdfjklgh
  • qwerty-left-hand: asdfqwerzcxv
  • qwerty-right-hand: jkluiopmyhn
  • azerty: qsdfazerwxcvjklmuiopghtybn
  • azerty-homerow: qsdfjkmgh
  • azerty-left-hand: qsdfazerwxcv
  • azerty-right-hand: jklmuiophyn
  • qwertz: asdfqweryxcvjkluiopmghtzbn
  • qwertz-homerow: asdfghjkl
  • qwertz-left-hand: asdfqweryxcv
  • qwertz-right-hand: jkluiopmhzn
  • dvorak: aoeuqjkxpyhtnsgcrlmwvzfidb
  • dvorak-homerow: aoeuhtnsid
  • dvorak-left-hand: aoeupqjkyix
  • dvorak-right-hand: htnsgcrlmwvz
  • colemak: arstqwfpzxcvneioluymdhgjbk
  • colemak-homerow: arstneiodh
  • colemak-left-hand: arstqwfpzxcv
  • colemak-right-hand: neioluymjhk

Extra features

  • Arrow navigation: You can use the arrows to move arround between all matched items.
  • Auto paste: If your last typed hint character is uppercase, you are going to pick and paste the desired hint.

Background

As I said, this project is based in tmux-fingers. Morantron did an extraordinary job, building all necessary pieces in Bash to achieve the text picker behaviour. He only deserves my gratitude for all the time I have been using tmux-fingers.

During a Fosdem conf, we had the idea to rewrite it to another language. He had these thoughts many times ago but it was hard to start from scratch. So, we decided to start playing with Node.js and react-blessed, but we detected some unacceptable latency when the program booted. We didn't investigate much about this latency.

During those days another alternative appeared, called tmux-picker, implemented in python and reusing many parts from tmux-fingers. It was nice, because it was fast and added original terminal color support.

I was curious to know if this was possible to be written in Rust, and soon I realized that was something doable. The ability to implement tests for all critic parts of the application give you a great confidence about it. On the other hand, Rust has an awesome community that lets you achieve this kind of project in a short period of time.

Contribute

This project started as a side project to learn Rust, so I'm sure that is full of mistakes and areas to be improve. If you think you can tweak the code to make it better, I'll really appreaciate a pull request. ;)

License

MIT