From bcb2f7752fb255b14854a3f8bcc7748420526beb Mon Sep 17 00:00:00 2001 From: Scott Carroll Date: Thu, 7 Aug 2025 14:55:35 +0100 Subject: [PATCH] switch to tmux-thumbs --- .gitattributes | 2 + base/.tmux.conf | 2 +- .../.tmux/plugins/tmux-thumbs/.rustfmt.toml | 2 + tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.lock | 200 +++++++ tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.toml | 25 + tmux-arm/.tmux/plugins/tmux-thumbs/LICENSE | 21 + tmux-arm/.tmux/plugins/tmux-thumbs/README.md | 537 ++++++++++++++++++ .../tmux-thumbs/target/.rustc_info.json | 1 + .../plugins/tmux-thumbs/target/CACHEDIR.TAG | 3 + .../tmux-thumbs/target/release/.cargo-lock | 0 .../plugins/tmux-thumbs/target/release/thumbs | 3 + .../tmux-thumbs/target/release/tmux-thumbs | 3 + .../tmux-thumbs/tmux-thumbs-install.sh | 118 ++++ .../.tmux/plugins/tmux-thumbs/tmux-thumbs.sh | 53 ++ .../plugins/tmux-thumbs/tmux-thumbs.tmux | 11 + 15 files changed, 980 insertions(+), 1 deletion(-) create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/.rustfmt.toml create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.lock create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.toml create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/LICENSE create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/README.md create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/target/.rustc_info.json create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/target/CACHEDIR.TAG create mode 100644 tmux-arm/.tmux/plugins/tmux-thumbs/target/release/.cargo-lock create mode 100755 tmux-arm/.tmux/plugins/tmux-thumbs/target/release/thumbs create mode 100755 tmux-arm/.tmux/plugins/tmux-thumbs/target/release/tmux-thumbs create mode 100755 tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs-install.sh create mode 100755 tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.sh create mode 100755 tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux diff --git a/.gitattributes b/.gitattributes index cc2d1fb..47cafae 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,5 @@ nvim-linux-arm64.tar.gz filter=lfs diff=lfs merge=lfs -text starship-x86_64 filter=lfs diff=lfs merge=lfs -text starship-aarch64 filter=lfs diff=lfs merge=lfs -text base/.tmux/plugins/tmux-fingers/bin/tmux-fingers filter=lfs diff=lfs merge=lfs -text +tmux-arm/.tmux/plugins/tmux-thumbs/target/release/thumbs filter=lfs diff=lfs merge=lfs -text +tmux-arm/.tmux/plugins/tmux-thumbs/target/release/tmux-thumbs filter=lfs diff=lfs merge=lfs -text diff --git a/base/.tmux.conf b/base/.tmux.conf index 3139671..3f8a47f 100644 --- a/base/.tmux.conf +++ b/base/.tmux.conf @@ -1,4 +1,4 @@ -run-shell ~/.tmux/plugins/tmux-fingers/tmux-fingers.tmux +run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux set -g mode-keys vi diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/.rustfmt.toml b/tmux-arm/.tmux/plugins/tmux-thumbs/.rustfmt.toml new file mode 100644 index 0000000..44f8e3a --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/.rustfmt.toml @@ -0,0 +1,2 @@ +tab_spaces = 2 +max_width = 120 diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.lock b/tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.lock new file mode 100644 index 0000000..9349c19 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.lock @@ -0,0 +1,200 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_termios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +dependencies = [ + "redox_syscall", +] + +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "termion" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +dependencies = [ + "libc", + "numtoa", + "redox_syscall", + "redox_termios", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thumbs" +version = "0.8.0" +dependencies = [ + "base64", + "clap", + "lazy_static", + "regex", + "termion", + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.toml b/tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.toml new file mode 100644 index 0000000..582943a --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "thumbs" +version = "0.8.0" +authors = ["Ferran Basora "] +edition = "2018" +description = "A lightning fast version copy/pasting like vimium/vimperator" +repository = "https://github.com/fcsonline/tmux-thumbs" +keywords = ["rust", "tmux", "tmux-plugin", "vimium", "vimperator"] +license = "MIT" + +[dependencies] +termion = "1.5.6" +regex = "1.7.1" +clap = "2.34.0" +base64 = "0.13.1" +unicode-width = "0.1.10" +lazy_static = "1.4.0" + +[[bin]] +name = "thumbs" +path = "src/main.rs" + +[[bin]] +name = "tmux-thumbs" +path = "src/swapper.rs" diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/LICENSE b/tmux-arm/.tmux/plugins/tmux-thumbs/LICENSE new file mode 100644 index 0000000..2e531c4 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Ferran Basora + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/README.md b/tmux-arm/.tmux/plugins/tmux-thumbs/README.md new file mode 100644 index 0000000..dfc5af1 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/README.md @@ -0,0 +1,537 @@ +# tmux-thumbs + +[![Build Status](https://github.com/fcsonline/tmux-thumbs/workflows/Rust/badge.svg)](https://github.com/fcsonline/tmux-thumbs/actions) +[![dependency status](https://deps.rs/repo/github/fcsonline/tmux-thumbs/status.svg)](https://deps.rs/repo/github/fcsonline/tmux-thumbs) +[![Coverage Status](https://coveralls.io/repos/github/fcsonline/tmux-thumbs/badge.svg?branch=master)](https://coveralls.io/github/fcsonline/tmux-thumbs?branch=master) +[![Maintenance](https://img.shields.io/badge/maintenance-actively%20maintained-brightgreen.svg)](https://deps.rs/repo/github/fcsonline/tmux-thumbs) +[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) + +A lightning fast version of [tmux-fingers](https://github.com/Morantron/tmux-fingers) written in [Rust](https://www.rust-lang.org/) for copy pasting with vimium/vimperator like hints. + +## Usage + +Press ( prefix + Space ) to highlight in you current tmux +visible pane all text that match specific patterns. Then press the highlighted +letter hint to yank the text in your tmux buffer. + +### Matched patterns + +- File paths +- File in diff +- Git SHAs +- IPFS CID's +- Colors in hex +- Numbers ( 4+ digits ) +- Hex numbers +- Markdown urls +- IPv4, IPv6 addresses +- Docker images +- kubernetes resources +- UUIDs + +These are the list of matched 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](https://asciinema.org/a/232775.png?ts=1)](https://asciinema.org/a/232775?autoplay=1) + +## Using Tmux Plugin Manager + +You can add this line to your list of [TPM](https://github.com/tmux-plugins/tpm) plugins in `.tmux.conf`: + +``` +set -g @plugin 'fcsonline/tmux-thumbs' + +run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux +``` + +To be able to install the plugin just hit prefix + I. You should now be able to use +the plugin! + +## Installation checking out the source code + +`tmux-thumbs` is written in Rust. You will need `rustc` version 1.35.0 or higher. The +recommended way to install Rust is from the official [download page](https://rustup.rs/). + +Clone the repo: + +``` +git clone https://github.com/fcsonline/tmux-thumbs ~/.tmux/plugins/tmux-thumbs +``` + +Compile it with [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html): + +``` +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-key](#thumbs-key) +* [@thumbs-alphabet](#thumbs-alphabet) +* [@thumbs-reverse](#thumbs-reverse) +* [@thumbs-unique](#thumbs-unique) +* [@thumbs-position](#thumbs-position) +* [@thumbs-regexp-N](#thumbs-regexp-N) +* [@thumbs-command](#thumbs-command) +* [@thumbs-upcase-command](#thumbs-upcase-command) +* [@thumbs-multi-command](#thumbs-multi-command) +* [@thumbs-bg-color](#thumbs-bg-color) +* [@thumbs-fg-color](#thumbs-fg-color) +* [@thumbs-hint-bg-color](#thumbs-hint-bg-color) +* [@thumbs-hint-fg-color](#thumbs-hint-fg-color) +* [@thumbs-select-fg-color](#thumbs-select-fg-color) +* [@thumbs-select-bg-color](#thumbs-select-bg-color) +* [@thumbs-multi-fg-color](#thumbs-multi-fg-color) +* [@thumbs-multi-bg-color](#thumbs-multi-bg-color) +* [@thumbs-contrast](#thumbs-contrast) +* [@thumbs-osc52](#thumbs-osc52) + +### @thumbs-key + +`default: space` + +Choose which key is used to enter in thumbs mode. + +For example: + +``` +set -g @thumbs-key F +``` + +If you want to customize the way how `tmux-thumbs` is triggered, you can always +bind whatever key to `thumbs-pick` command. For example: + +``` +bind-key \; thumbs-pick +``` + +### @thumbs-alphabet + +`default: qwerty` + +Choose which set of characters is used to build hints. Review all [available alphabets](#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 enabled +``` + +### @thumbs-unique + +`default: disabled` + +Choose if you want to assign the same hint for the same matched strings. + +For example: + +``` +set -g @thumbs-unique enabled +``` + +### @thumbs-position + +`default: left` + +Choose where do you want to show the hint in the matched string. Options (left, right, off_left, off_right). + +For example: + +``` +set -g @thumbs-position right +``` + +### @thumbs-regexp-N + +Add extra patterns to match. This parameter can have multiple instances. + +For example: + +``` +set -g @thumbs-regexp-1 '[\w-\.]+@([\w-]+\.)+[\w-]{2,4}' # Match emails +set -g @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 +set -g @thumbs-regexp-3 'Vlan\d+' # match Vlan interface on network devices +set -g @thumbs-regexp-4 "Vlan\\d+" # alternative method of defining regexp +set -g @thumbs-regexp-5 Vlan\\d+ # alternative method of defining regexp +``` + +### @thumbs-command + +`default: 'tmux set-buffer -- {} && tmux display-message \"Copied {}\"'` + +Choose which command execute when you press a hint. `tmux-thumbs` will replace `{}` with the picked hint. + +For example: + +``` +set -g @thumbs-command 'echo -n {} | pbcopy' +``` + +### @thumbs-upcase-command + +`default: 'tmux set-buffer -- {} && tmux paste-buffer && tmux display-message \"Copied {}\"'` + +Choose which command execute when you press a upcase hint. `tmux-thumbs` will replace `{}` with the picked hint. + +For example: + +``` +set -g @thumbs-upcase-command 'echo -n {} | pbcopy' +``` + +### @thumbs-multi-command + +`default: 'tmux set-buffer -- {} && tmux paste-buffer && tmux send-keys ' ' && tmux display-message \"Copied multiple items!\"'` + +Choose which command execute when you select multiple items. `tmux-thumbs` will replace `{}` with the picked hint for each one. + +For example: + +``` +set -g @thumbs-multi-command 'echo -n {}' +``` + +### @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 foreground 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 foreground color for hints + +For example: + +``` +set -g @thumbs-hint-fg-color green +``` + +### @thumbs-select-fg-color + +`default: blue` + +Sets the foreground color for selection + +For example: + +``` +set -g @thumbs-select-fg-color red +``` + +### @thumbs-select-bg-color + +`default: black` + +Sets the background color for selection + +For example: + +``` +set -g @thumbs-select-bg-color red +``` + +### @thumbs-multi-fg-color + +`default: yellow` + +Sets the foreground color for multi selected item + +For example: + +``` +set -g @thumbs-multi-fg-color green +``` + +### @thumbs-multi-bg-color + +`default: black` + +Sets the background color for multi selected item + +For example: + +``` +set -g @thumbs-multi-bg-color red +``` + +### @thumbs-contrast + +`default: 0` + +Displays hint character in square brackets for extra visibility. + +For example: + +``` +set -g @thumbs-contrast 1 +``` + +### @thumbs-osc52 + +`default: 0` + +If this is set to `1`, `tmux-thumbs` will print a OSC52 copy escape sequence when you select a match, in addition to running the pick command. This sequence, in terminals that support it (e.g. iTerm), allows the content to be copied into the system clipboard in addition to the tmux copy buffer. + +For example: + +``` +set -g @thumbs-osc52 1 +``` + +#### Colors + +This is the list of predefined colors: + +- black +- red +- green +- yellow +- blue +- magenta +- cyan +- white +- default + +There is also support for using hex colors in the form of `#RRGGBB`. + +#### 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 around between all matched items. +- **Auto paste:** If your last typed hint character is uppercase, you are going to pick and paste the desired hint. + +### Multi selection + +If you want to enable the capability to choose multiple matches, you have to +press Space. Then, choose the matches with highlighted hints or +Enter (moving with cursors) and then Space again to +output all of them. + +If you run standalone `thumbs` with multi selection mode (-m) you will be able to choose multiple hints pressing the desired letter and Space to finalize the selection. + +## Tmux compatibility + +This is the known list of versions of `tmux` compatible with `tmux-thumbs`: + +| Version | Compatible | +|:-------:|:----------:| +| 3.0a | ✅ | +| 2.9a | ✅ | +| 2.8 | ❓ | +| 2.7 | ❓ | +| 2.6 | ✅ | +| 2.5 | ❓ | +| 2.4 | ❓ | +| 2.3 | ❓ | +| 1.8 | ❓ | +| 1.7 | ❓ | + +If you can check hat `tmux-thumbs` is or is not compatible with some specific version of `tmux`, let me know. + +## Standalone `thumbs` + +This project started as a `tmux` plugin but after reviewing it with some +friends we decided to explore all the possibilities of decoupling thumbs from +`tmux`. You can install it with a simple command: + +``` +cargo install thumbs +``` + +And those are all available options: + +``` +thumbs 0.7.1 +A lightning fast version copy/pasting like vimium/vimperator + +USAGE: + thumbs [FLAGS] [OPTIONS] + +FLAGS: + -c, --contrast Put square brackets around hint for visibility + -h, --help Prints help information + -m, --multi Enable multi-selection + -r, --reverse Reverse the order for assigned hints + -u, --unique Don't show duplicated hints for the same match + -V, --version Prints version information + +OPTIONS: + -a, --alphabet Sets the alphabet [default: qwerty] + --bg-color Sets the background color for matches [default: black] + --fg-color Sets the foregroud color for matches [default: green] + -f, --format + Specifies the out format for the picked hint. (%U: Upcase, %H: Hint) [default: %H] + + --hint-bg-color Sets the background color for hints [default: black] + --hint-fg-color Sets the foregroud color for hints [default: yellow] + -p, --position Hint position [default: left] + -x, --regexp ... Use this regexp as extra pattern to match + --select-bg-color Sets the background color for selection [default: black] + --select-fg-color Sets the foreground color for selection [default: blue] + --multi-bg-color Sets the background color for a multi selected item [default: black] + --multi-fg-color Sets the foreground color for a multi selected item [default: cyan] + -t, --target Stores the hint in the specified path +``` + + +If you want to enjoy terminal hints, you can do things like this without `tmux`: + +``` +> alias pick='thumbs -u -r | xsel --clipboard -i' +> git log | pick +``` + +Or multi selection: + +``` +> git log | thumbs -m +1df9fa69c8831ac042c6466af81e65402ee2a007 +4897dc4ecbd2ac90b17de95e00e9e75bb540e37f +``` + +Standalone `thumbs` has some similarities to [FZF](https://github.com/junegunn/fzf). + +## Background + +As I said, this project is based in [tmux-fingers](https://github.com/Morantron/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](https://github.com/Morantron/tmux-fingers). + +During a [Fosdem](https://fosdem.org/) 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](https://github.com/Yomguithereal/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](https://github.com/RTBHOUSE/tmux-picker), implemented in python and reusing many parts from [tmux-fingers](https://github.com/Morantron/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](https://www.rust-lang.org/), 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. + +## Roadmap + +- [X] Support multi selection +- [X] Decouple `tmux-thumbs` from `tmux` +- [ ] Code [Kitty](https://github.com/kovidgoyal/kitty) plugin, now that `thumbs` can run standalone + +## Troubleshooting + +`tmux-thumbs` must work lighting fast. If you are facing a slow performance capturing the screen hints try to configure Tmux with these settings: + +``` +set -g visual-activity off +set -g visual-bell off +set -g visual-silence on +``` + +You can read a bit more about this issue here: https://github.com/fcsonline/tmux-thumbs/issues/88 + +Every time I use `tmux-thumbs`, dead panes are created. Just review if you have +this setting on: + +``` +set -g remain-on-exit on +``` + +You can read a bit more about this issue here: https://github.com/fcsonline/tmux-thumbs/issues/84 + +## Donations + +If you appreciate all the job done in this project, a small donation is always welcome: + +[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/fcsonline) + +## 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 appreciate a pull request. ;) + +# License + +[MIT](https://github.com/fcsonline/tmux-thumbs/blob/master/LICENSE) diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/target/.rustc_info.json b/tmux-arm/.tmux/plugins/tmux-thumbs/target/.rustc_info.json new file mode 100644 index 0000000..cf86c59 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":537842707314038760,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.63.0\nbinary: rustc\ncommit-hash: unknown\ncommit-date: unknown\nhost: aarch64-unknown-linux-gnu\nrelease: 1.63.0\nLLVM version: 14.0.6\n","stderr":""},"15697416045686424142":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"10376369925670944939":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/usr\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"neon\"\ntarget_feature=\"pmuv3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/target/CACHEDIR.TAG b/tmux-arm/.tmux/plugins/tmux-thumbs/target/CACHEDIR.TAG new file mode 100644 index 0000000..20d7c31 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/.cargo-lock b/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/.cargo-lock new file mode 100644 index 0000000..e69de29 diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/thumbs b/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/thumbs new file mode 100755 index 0000000..cc219f2 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/thumbs @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6537283e957fe37f25f705eedc5a1cee198d2bc0b3b45f4303d9f8eb69f238c6 +size 1902872 diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/tmux-thumbs b/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/tmux-thumbs new file mode 100755 index 0000000..a16907c --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/target/release/tmux-thumbs @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d708bbd0d92c89f4a3beb49275355d955d7106fa65748c45459d33197396dcb0 +size 1771784 diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs-install.sh b/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs-install.sh new file mode 100755 index 0000000..eb32308 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs-install.sh @@ -0,0 +1,118 @@ +#!/usr/bin/env bash +set -Eeu -o pipefail + +# Removing the binary to make this script idempotent +rm -rf target/release/thumbs + +clear + +cat << EOF + + █████ █████ █████ █████ + ░░███ ░░███ ░░███ ░░███ + ███████ █████████████ █████ ████ █████ █████ ███████ ░███████ █████ ████ █████████████ ░███████ █████ +░░░███░ ░░███░░███░░███ ░░███ ░███ ░░███ ░░███ ██████████░░░███░ ░███░░███ ░░███ ░███ ░░███░░███░░███ ░███░░███ ███░░ + ░███ ░███ ░███ ░███ ░███ ░███ ░░░█████░ ░░░░░░░░░░ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███░░█████ + ░███ ███ ░███ ░███ ░███ ░███ ░███ ███░░░███ ░███ ███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░░░░███ + ░░█████ █████░███ █████ ░░████████ █████ █████ ░░█████ ████ █████ ░░████████ █████░███ █████ ████████ ██████ + ░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░░ ░░░░░░ + +EOF + + +if [ "${1:-install}" == "update" ]; then + +cat << EOF + ⚠️ UPDATE! ⚠️ + + It looks like you got a new version of tmux-thumbs repository but + the binary version is not in sync. + + We are going to proceed with the new installation. + + Do you want to continue? + + Press any key to continue... +EOF + +else + +cat << EOF + It looks like this is the first time you are executing tmux-thumbs + because the binary is not present. We are going to proceed with the + installation. + + Do you want to continue? + + Press any key to continue... +EOF + +fi + +read -rs -n 1 + +cat << EOF + + Which format do you prefer for installation? + + 1) Compile: will use cargo to compile tmux-thumbs. It requires Rust. + 2) Download: will download a precompiled binary for your system. + +EOF + +select opt in "Compile" "Download"; do + case $opt in + Compile|1) + + if ! [ -x "$(command -v cargo)" ]; then + echo '❌ Rust is not installed!' + exit 1 + fi + + echo ' Compiling tmux-thumbs, be patient:' + cargo build --release --target-dir=target + + break;; + Download|2) + platform="$(uname -s)_$(uname -m)" + + echo " Downloading ${platform} binary..." + + sources=$(curl -s "https://api.github.com/repos/fcsonline/tmux-thumbs/releases/latest" | grep browser_download_url) + + case $platform in + Darwin_x86_64) + url=$(echo "${sources}" | grep -o 'https://.*darwin.zip' | uniq) + curl -sL "${url}" | bsdtar -xf - thumbs tmux-thumbs + + ;; + Linux_x86_64) + url=$(echo "${sources}" | grep -o 'https://.*linux-musl.tar.gz' | uniq) + curl -sL "${url}" | tar -zxf - thumbs tmux-thumbs + + ;; + *) + echo "❌ Unknown platform: ${platform}" + read -rs -n 1 + echo " Press any key to close this pane..." + exit 1 + ;; + esac + + chmod +x thumbs tmux-thumbs + mkdir -p target/release + mv thumbs tmux-thumbs target/release + + break;; + *) + echo "❌ Ouh? Choose an available option." + esac +done + +cat << EOF + Installation complete! 💯 + + Press any key to close this pane... +EOF + +read -rs -n 1 diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.sh b/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.sh new file mode 100755 index 0000000..7e060e8 --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +set -Eeu -o pipefail + +# Setup env variables to be compatible with compiled and bundled installations +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +RELEASE_DIR="${CURRENT_DIR}/target/release" + +THUMBS_BINARY="${RELEASE_DIR}/thumbs" +TMUX_THUMBS_BINARY="${RELEASE_DIR}/tmux-thumbs" +VERSION=$(grep 'version =' "${CURRENT_DIR}/Cargo.toml" | grep -o "\".*\"" | sed 's/"//g') + +if [ ! -f "$THUMBS_BINARY" ]; then + tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh" + exit +elif [[ $(${THUMBS_BINARY} --version) != "thumbs ${VERSION}" ]]; then + tmux split-window "cd ${CURRENT_DIR} && bash ./tmux-thumbs-install.sh update" + exit +fi + +function get-opt-value() { + tmux show -vg "@thumbs-${1}" 2> /dev/null +} + +function get-opt-arg() { + local opt type value + opt="${1}"; type="${2}" + value="$(get-opt-value "${opt}")" || true + + if [ "${type}" = string ]; then + [ -n "${value}" ] && echo "--${opt}=${value}" + elif [ "${type}" = boolean ]; then + [ "${value}" = 1 ] && echo "--${opt}" + else + return 1 + fi +} + +PARAMS=(--dir "${CURRENT_DIR}") + +function add-param() { + local type opt arg + opt="${1}"; type="${2}" + if arg="$(get-opt-arg "${opt}" "${type}")"; then + PARAMS+=("${arg}") + fi +} + +add-param command string +add-param upcase-command string +add-param multi-command string +add-param osc52 boolean + +"${TMUX_THUMBS_BINARY}" "${PARAMS[@]}" || true diff --git a/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux b/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux new file mode 100755 index 0000000..949527d --- /dev/null +++ b/tmux-arm/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +DEFAULT_THUMBS_KEY=space + +THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)" +THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY} + +tmux set-option -ag command-alias "thumbs-pick=run-shell -b ${CURRENT_DIR}/tmux-thumbs.sh" +tmux bind-key "${THUMBS_KEY}" thumbs-pick