tmux-fingers/README.md

169 lines
4.1 KiB
Markdown
Raw Normal View History

2016-05-01 19:50:41 +02:00
# tmux-fingers
2016-07-14 22:48:01 +02:00
[![CircleCI](https://circleci.com/gh/Morantron/tmux-fingers.svg?style=svg)](https://circleci.com/gh/Morantron/tmux-fingers)
2016-05-01 19:50:41 +02:00
**tmux-fingers**: copy pasting with vimium/vimperator like hints.
2016-05-14 10:04:21 +02:00
![yay](http://i.imgur.com/5bSrBew.gif)
2016-05-02 23:07:23 +02:00
2016-05-01 19:50:41 +02:00
# Usage
2016-10-17 21:44:28 +02:00
Press ( `prefix + F` ) to enter **[fingers]** mode, it will highlight relevant stuff in the current
2016-05-01 19:50:41 +02:00
pane along with letter hints. By pressing those letters, the highlighted match
will be yanked. Less keystrokes == profit!
Relevant stuff:
* File paths
* git SHAs
2016-05-01 19:54:20 +02:00
* numbers ( 4+ digits )
* urls
* ip addresses
2016-05-01 19:50:41 +02:00
It also works on copy mode, but requires *tmux 2.2* or newer to properly take
the scroll position into account.
2016-05-14 09:45:43 +02:00
Additionally, you can install
[tmux-yank](https://github.com/tmux-plugins/tmux-yank) for system clipboard
integration.
2016-10-17 21:44:28 +02:00
## Key shortcuts
2016-10-17 23:51:50 +02:00
While in **[fingers]** mode, you can use the following shortcuts:
2016-10-17 21:44:28 +02:00
* `a-z`: yank a highlighted hint.
* `<space>`: toggle compact hints ( see [@fingers-compact-hints](#fingers-compact-hints) ).
* `<Ctrl-C>`: exit **[fingers]** mode
2016-10-17 23:43:52 +02:00
* `<esc>`: exit help or **[fingers]** mode
2016-10-17 21:44:28 +02:00
* `?`: show help.
2016-05-02 23:00:28 +02:00
# Requirements
* tmux 2.1+ ( 2.2 recommended )
2017-04-02 17:55:39 +02:00
* bash 4+
* gawk
2016-05-02 23:00:28 +02:00
2016-05-01 19:50:41 +02:00
# Installation
## Using [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm)
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:
```
➜ git clone https://github.com/Morantron/tmux-fingers ~/clone/path
```
Source it in your `.tmux.conf`:
```
run-shell ~/clone/path/tmux-fingers.tmux
```
Reload TMUX conf by running:
```
2016-05-01 19:57:07 +02:00
➜ tmux source-file ~/.tmux.conf
2016-05-01 19:50:41 +02:00
```
2016-05-01 19:57:07 +02:00
# Configuration
2016-05-01 19:50:41 +02:00
You can change the key that invokes **tmux-fingers**:
2016-05-14 09:45:43 +02:00
## @fingers-key
2016-10-17 21:44:28 +02:00
`default: F`
Customize how to enter copy mode. Always preceded by prefix: `prefix + @fingers-key`
2016-05-14 09:45:43 +02:00
2016-05-01 19:50:41 +02:00
```
set -g @fingers-key F
```
2016-05-14 09:45:43 +02:00
## @fingers-patterns-N
2016-05-01 19:50:41 +02:00
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'
.
.
.
2016-05-01 19:54:20 +02:00
set -g @fingers-pattern-50 'whatever'
2016-05-01 19:50:41 +02:00
```
2016-08-19 08:00:19 +02:00
Patterns are case insensitive, and grep's extended syntax ( ERE ) should be used.
2016-05-01 19:50:41 +02:00
`man grep` for more info.
If the introduced regexp contains an error, an error will be shown when
invoking the plugin.
2016-08-19 08:00:19 +02:00
It's recommended to install `gawk` for better support of custom
patterns: some things like interval expressions do not work in built-in `awk`
in OSX/BSD systems.
2016-05-14 09:45:43 +02:00
## @fingers-copy-command
By default **tmux-fingers** will just yank matches using tmux clipboard ( or
[tmux-yank](https://github.com/tmux-plugins/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'
```
2016-10-17 21:44:28 +02:00
## @fingers-compact-hints
`default: 1`
By default **tmux-fingers** will show hints in a compact format. For example:
2016-10-17 21:44:28 +02:00
<pre>
/path/to/foo/bar/lol
<i>with <bold>@fingers-compact-hints</bold> set to <bold>1</bold>:</i>
<strong>aw</strong>ath/to/foo/bar/lol
<i>with <bold>@fingers-compact-hints</bold> set to <bold>0</bold>:</i>
/path/to/foo/bar/lol <strong>[aw]</strong>
</pre>
( _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>`.
2016-05-01 19:50:41 +02:00
# Acknowledgements and inspiration
This plugin is heavily inspired by
[tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) ( **tmux-fingers**
predefined search are *copycatted* :trollface: from
[tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) ).
Kudos to [bruno-](https://github.com/bruno-) for paving the way to tmux
plugins! :clap: :clap:
# License
2016-05-01 19:57:07 +02:00
[MIT](https://github.com/Morantron/tmux-fingers/blob/master/LICENSE)