ファイルへ移動
Jorge Morante 47d986b8a2 bump version in shard.yml 2024-03-08 13:36:33 +01:00
.github/workflows Rewrite in Crystal 2023-09-27 15:21:48 +02:00
docs adding documentation and preparing release 2023-09-27 15:22:59 +02:00
spec adding jump mode functionality 2023-11-10 15:20:11 +01:00
src properly restore last pane after invoking fingers 2024-03-08 13:31:32 +01:00
.dockerignore Rewrite in Crystal 2023-09-27 15:21:48 +02:00
.editorconfig Rewrite in Crystal 2023-09-27 15:21:48 +02:00
.gitignore Rewrite in Crystal 2023-09-27 15:21:48 +02:00
CHANGELOG.md update CHANGELOG.md 2024-03-08 13:35:57 +01:00
Dockerfile some testing and benchmarking fixes 2023-09-27 15:21:51 +02:00
LICENSE README.md + LICENSE 2016-05-01 19:50:41 +02:00
Makefile recompile after exiting make shell 2023-09-27 15:21:51 +02:00
README.md add @fingers-jump-key to README TOC 2023-11-18 10:31:37 +01:00
benchmark.sh tweak benchmark script 2023-11-10 15:20:11 +01:00
install-wizard.sh add arch check when downloading binary 2024-01-19 11:53:46 +01:00
kill-windows.sh Rewrite in Crystal 2023-09-27 15:21:48 +02:00
logo.svg adding logo 2023-09-27 15:23:00 +02:00
shard.lock bump to crystal 1.11.2 2024-01-19 11:53:13 +01:00
shard.yml bump version in shard.yml 2024-03-08 13:36:33 +01:00
tmux-fingers.tmux remove derp trace 2023-09-28 09:17:28 +02:00

README.md

tmux-fingers

demo

Usage

Press ( prefix + F ) to enter [fingers] mode, it will highlight relevant stuff in the current pane along with letter hints. By pressing those letters, the highlighted match will be copied to the clipboard. Less keystrokes == profit!

Here is a list of the stuff highlighted by default.

  • File paths
  • SHAs
  • numbers ( 4+ digits )
  • hex numbers
  • IP addresses
  • kubernetes resources
  • UUIDs
  • git status/diff output

Key shortcuts

While in [fingers] mode, you can use the following shortcuts:

  • a-z: copies selected match to the clipboard
  • CTRL + a-z: copies selected match to the clipboard and triggers @fingers-ctrl-action. By default it triggers :open: action, which is useful for opening links in the browser for example.
  • SHIFT + a-z: copies selected match to the clipboard and triggers @fingers-shift-action. By default it triggers :paste: action, which automatically pastes selected matches.
  • ALT + a-z: copies selected match to the clipboard and triggers @fingers-alt-action. There is no default, configurable by the user.
  • TAB: toggle multi mode. First press enters multi mode, which allows to select multiple matches. Second press will exit with the selected matches copied to the clipboard.
  • q, ESC or CTRL + c: exit [fingers] mode

Requirements

  • tmux 3.0 or newer

Installation

Using Tmux Plugin Manager

Add the following to your list of TPM plugins in .tmux.conf:

set -g @plugin 'Morantron/tmux-fingers'

Hit prefix + I to fetch and source the plugin. The first time you run it you'll be presented with a wizard to complete the installation.

Manual

Clone the repo:

$ git clone https://github.com/Morantron/tmux-fingers ~/.tmux/plugins/tmux-fingers

Source it in your .tmux.conf:

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

Reload TMUX conf by running:

$ tmux source-file ~/.tmux.conf

The first time you run it you'll be presented with a wizard to complete the installation.

Configuration

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

@fingers-key

default: F

Customize how to enter fingers mode. Always preceded by prefix: prefix + @fingers-key.

For example:

set -g @fingers-key F

@fingers-jump-key

default: J

Customize how to enter fingers jump mode. Always preceded by prefix: prefix + @fingers-jump-key.

In jump mode, the cursor will be placed in the position of the match after the hint is selected.

@fingers-patterns-N

You can also add additional patterns if you want more stuff to be highlighted:

# You can define custom patterns like this
set -g @fingers-pattern-0 'git rebase --(abort|continue)'

# Increment the number and define more patterns
set -g @fingers-pattern-1 'some other pattern'

# You can use a named capture group like this (?<match>YOUR-REGEX-HERE)
# to only highlight and copy part of the match.
set -g @fingers-pattern-2 'capture (?<match>only this)'

# Watch out for backslashes! For example the regex \d{50} matches 50 digits.
set -g @fingers-pattern-3 '\d{50}'  # No need to escape if you use single quotes
set -g @fingers-pattern-4 "\\d{50}" # If you use double quotes, you'll need to escape backslashes for special characters to work
set -g @fingers-pattern-5 \\d{50} # Escaping also needed if you don't use any quotes

Patterns use PCRE pattern syntax.

If the introduced regex contains an error, an error will be shown when invoking the plugin.

@fingers-main-action

default: :copy:

By default tmux-fingers will copy matches in tmux and system clipboard.

If you still want to set your own custom command you can do so like this:

set -g @fingers-main-action '<your command here>'

This command will also receive the following:

  • MODIFIER: environment variable set to ctrl, alt, or shift specififying which modifier was used when selecting the match.
  • HINT: environment variable the selected letter hint itself ( ex: q, as, etc... ).
  • stdin: copied text will be piped to @fingers-copy-command.

You can also use the following special values:

  • :paste: Copy the the match and paste it automatically.
  • :copy: Uses built-in system clipboard integration to copy the match.
  • :open: Uses built-in open file integration to open the file ( opens URLs in default browser, files in OS file navigator, etc ).

@fingers-ctrl-action

default: :open:

Same as @fingers-main-action but only called when match is selected by holding ctrl

@fingers-alt-action

Same as @fingers-main-action but only called when match is selected by holding alt

@fingers-shift-action

default: :paste:

Same as @fingers-main-action but only called when match is selected by holding shift

@fingers-hint-style

default: "fg=green,bold

With this option you can define the styles for the letter hints.

You can customize the styles using the same syntax used in .tmux.conf for styling the status bar.

More info in the STYLES section of man tmux.

Supported styles are: bright, bold, dim, underscore, italics.

@fingers-highlight-style

default: "fg=yellow"

Custom styles for the highlighted match. See @fingers-hint-format for more details.

@fingers-backdrop-style

default: ""

Custom styles for all the text that is not matched. See @fingers-hint-format for more details.

@fingers-selected-hint-style

default: "fg=blue,bold"

Format for hints in selected matches in multimode.

@fingers-selected-highlight-style

default: "fg=blue"

Format for selected matches in multimode.

@fingers-hint-position

default: "left"

Control the position where the hint is rendered. Possible values are "left" and "right".

@fingers-keyboard-layout

default: "qwerty"

Hints are generated taking optimal finger movement into account. You can choose between the following:

  • qwerty: the default, use all letters
  • qwerty-left-hand: only use letters easily reachable with left hand
  • qwerty-right-hand: only use letters easily reachable with right hand
  • qwerty-homerow: only use letters in the homerow
  • qwertz
  • qwertz-left-hand
  • qwertz-right-hand
  • qwertz-homerow
  • azerty
  • azerty-left-hand
  • azerty-right-hand
  • azerty-homerow
  • colemak
  • colemak-left-hand
  • colemak-right-hand
  • colemak-homerow
  • dvorak
  • dvorak-left-hand
  • dvorak-right-hand
  • dvorak-homerow

@fingers-show-copied-notification

default: 0

Show a message using tmux display-message notifying about the copied result.

Acknowledgements and inspiration

This plugin is heavily inspired by tmux-copycat ( tmux-fingers predefined search are copycatted :trollface: from tmux-copycat ).

Kudos to bruno- for paving the way to tmux plugins! 👏 👏

License

MIT