Go to file
Jorge Morante e56fcbf20a bump tmux-printer 2018-03-11 12:54:49 +01:00
.git-hooks /usr/bin/env bash all the things 2016-07-15 08:31:45 +02:00
docs update health-check.md 2017-10-08 18:56:17 +02:00
scripts fix match lookup for POSIX sed 2018-03-11 00:22:42 +01:00
test add hack disclaimer 2017-04-23 19:05:47 +02:00
vendor bump tmux-printer 2018-03-11 12:54:49 +01:00
.gitignore gitignore all logs 2016-07-14 22:45:14 +02:00
.gitmodules add tmux-printer as submodule 2017-04-23 19:04:55 +02:00
CHANGELOG.md update docs 2018-02-15 09:33:19 +01:00
LICENSE README.md + LICENSE 2016-05-01 19:50:41 +02:00
README.md update docs 2018-02-15 09:33:19 +01:00
Vagrantfile fix NFS mount in BSD VM 2018-03-11 00:22:42 +01:00
circle.yml improving health cheack and adding at least gawk 4 2017-04-23 19:04:55 +02:00
tmux-fingers.tmux remove unused capture-pane call 2018-02-14 21:24:47 +01:00

README.md

tmux-fingers

CircleCI

tmux-fingers: copy pasting with vimium/vimperator like hints.

yay

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 yanked. Less keystrokes == profit!

Relevant stuff:

  • File paths
  • git SHAs
  • numbers ( 4+ digits )
  • urls
  • ip addresses

It also works on copy mode, but requires tmux 2.2 or newer to properly take the scroll position into account.

Additionally, you can install tmux-yank for system clipboard integration.

Key shortcuts

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

  • a-z: yank a highlighted hint.
  • SPACE: toggle compact hints ( see @fingers-compact-hints ).
  • CTRL + c: exit [fingers] mode
  • ESC: exit help or [fingers] mode
  • ?: show help.

Requirements

  • tmux 2.1+ ( 2.2 recommended )
  • bash 4+
  • gawk

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. You should now be able to use the plugin!

Manual

Clone the repo:

# Use --recursive flag to also fetch submodules
➜ git clone --recursive 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

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-patterns-N

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

set -g @fingers-pattern-0 'git rebase --(abort|continue)'
set -g @fingers-pattern-1 'yolo'
.
.
.
set -g @fingers-pattern-50 'whatever'

Patterns are case insensitive, and grep's extended syntax ( ERE ) should be used. man grep for more info.

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

@fingers-copy-command

default: NONE

By default tmux-fingers will just yank matches using tmux clipboard ( or tmux-yank if present ).

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

set -g @fingers-copy-command 'xclip -selection clipboard'

This command will also receive the following:

  • IS_UPPERCASE: environment variable set to 1 or 0 depending on how the hint was introduced.
  • HINT: environment variable the selected letter hint itself ( ex: q, as, etc... ).
  • stdin: copied text will be piped to @fingers-copy-command.

@fingers-copy-command-uppercase

default: NONE

Same as @fingers-copy-command but it's only triggered when input is introduced in uppercase letters.

For example, this open links in browser when holding SHIFT while selecting the hint:

set -g @fingers-copy-command-uppercase 'xargs xdg-open'

@fingers-compact-hints

default: 1

By default tmux-fingers will show hints in a compact format. For example:

/path/to/foo/bar/lol

with @fingers-compact-hints set to 1:

awath/to/foo/bar/lol

with @fingers-compact-hints set to 0:

/path/to/foo/bar/lol [aw]

( pressing aw would yank /path/to/foo/bar/lol )

While in [fingers] mode you can press SPACE to toggle compact mode on/off.

Compact mode is preferred because it preserves the length of lines and doesn't cause line wraps, making it easier to follow.

However for small hints this can be troublesome: a path as small as /a/b would have half of its original content concealed. If that's the case you can quickly toggle off compact mode by pressing SPACE.

@fingers-hint-position

default: "left"

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

@fingers-hint-position-nocompact

default: "right"

Same as above, used when @fingers-compact-hints is set to 0.

@fingers-hint-format

default: "#[fg=yellow,bold]%s"

You can customize the colors using the same syntax used in .tmux.conf for styling the status bar. You'll need to include the %s placeholder in your custom format, that's where the content will be rendered.

Check all supported features here.

@fingers-hint-format-nocompact

default: "#[fg=yellow,bold][%s]"

Same as above, used when @fingers-compact-hints is set to 0.

@fingers-highlight-format

default: "#[fg=yellow,bold,dim]%s"

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

@fingers-highlight-format-nocompact

default: "#[fg=yellow,bold,dim]%s"

Same as above, used when @fingers-compact-hints is set to 0.

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