updating README.md
This commit is contained in:
parent
d257428cea
commit
c5353288f1
44
README.md
44
README.md
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
When called ( `prefix + F` ), it will highlight relevant stuff in the current
|
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
|
pane along with letter hints. By pressing those letters, the highlighted match
|
||||||
will be yanked. Less keystrokes == profit!
|
will be yanked. Less keystrokes == profit!
|
||||||
|
|
||||||
|
@ -27,6 +27,15 @@ Additionally, you can install
|
||||||
[tmux-yank](https://github.com/tmux-plugins/tmux-yank) for system clipboard
|
[tmux-yank](https://github.com/tmux-plugins/tmux-yank) for system clipboard
|
||||||
integration.
|
integration.
|
||||||
|
|
||||||
|
## Key shortcuts
|
||||||
|
|
||||||
|
While the in **[fingers]** mode, you can use the following shortcuts:
|
||||||
|
|
||||||
|
* `a-z`: yank a highlighted hint.
|
||||||
|
* `<space>`: toggle compact hints ( see [@fingers-compact-hints](#fingers-compact-hints) ).
|
||||||
|
* `<Ctrl-C>`: exit **[fingers]** mode
|
||||||
|
* `?`: show help.
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
* bash 4+
|
* bash 4+
|
||||||
|
@ -72,7 +81,9 @@ You can change the key that invokes **tmux-fingers**:
|
||||||
|
|
||||||
## @fingers-key
|
## @fingers-key
|
||||||
|
|
||||||
F is the default key, but you can set another one.
|
`default: F`
|
||||||
|
|
||||||
|
Customize how to enter copy mode. Always preceded by prefix: `prefix + @fingers-key`
|
||||||
|
|
||||||
```
|
```
|
||||||
set -g @fingers-key F
|
set -g @fingers-key F
|
||||||
|
@ -112,6 +123,35 @@ If you still want to set your own custom command you can do so like this:
|
||||||
set -g @fingers-copy-command 'xclip -selection clipboard'
|
set -g @fingers-copy-command 'xclip -selection clipboard'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## @fingers-compact-hints
|
||||||
|
|
||||||
|
`default: 1`
|
||||||
|
|
||||||
|
By default **tmux-fingers** will show hints a compact format. For example:
|
||||||
|
|
||||||
|
<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>`.
|
||||||
|
|
||||||
# Acknowledgements and inspiration
|
# Acknowledgements and inspiration
|
||||||
|
|
||||||
This plugin is heavily inspired by
|
This plugin is heavily inspired by
|
||||||
|
|
|
@ -83,13 +83,13 @@ show_hints_and_swap $current_pane_id $fingers_pane_id
|
||||||
|
|
||||||
hide_cursor
|
hide_cursor
|
||||||
input=''
|
input=''
|
||||||
collapsed_state=1
|
compact_state=1
|
||||||
|
|
||||||
function toggle_collapsed_state() {
|
function toggle_compact_state() {
|
||||||
if [[ $collapsed_state == "0" ]]; then
|
if [[ $compact_state == "0" ]]; then
|
||||||
collapsed_state=1
|
compact_state=1
|
||||||
else
|
else
|
||||||
collapsed_state=0
|
compact_state=0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,13 +109,12 @@ while read -rsn1 char; do
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ $char == "$BACKSPACE" ]]; then
|
if [[ $char == "$BACKSPACE" ]]; then
|
||||||
input=""
|
input=""
|
||||||
continue
|
continue
|
||||||
elif [[ $char == "" ]]; then
|
elif [[ $char == "" ]]; then
|
||||||
toggle_collapsed_state
|
toggle_compact_state
|
||||||
show_hints "$fingers_pane_id" $collapsed_state
|
show_hints "$fingers_pane_id" $compact_state
|
||||||
else
|
else
|
||||||
input="$input$char"
|
input="$input$char"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,7 +2,7 @@ BEGIN {
|
||||||
n_matches = 0;
|
n_matches = 0;
|
||||||
line_pos = 0;
|
line_pos = 0;
|
||||||
col_pos = 0;
|
col_pos = 0;
|
||||||
COLLAPSE_HINTS = ENVIRON["COLLAPSED_HINTS"];
|
COMPACT_HINTS = ENVIRON["COMPACT_HINTS"];
|
||||||
|
|
||||||
HINTS[0] = "p"
|
HINTS[0] = "p"
|
||||||
HINTS[1] = "o"
|
HINTS[1] = "o"
|
||||||
|
@ -107,7 +107,7 @@ BEGIN {
|
||||||
|
|
||||||
finger_patterns = ENVIRON["FINGER_PATTERNS"];
|
finger_patterns = ENVIRON["FINGER_PATTERNS"];
|
||||||
|
|
||||||
if (COLLAPSE_HINTS) {
|
if (COMPACT_HINTS) {
|
||||||
hint_format = "\033[30;1;43m%s\033[0m"
|
hint_format = "\033[30;1;43m%s\033[0m"
|
||||||
highlight_format = "\033[1;33m%s\033[0m"
|
highlight_format = "\033[1;33m%s\033[0m"
|
||||||
compound_format = hint_format highlight_format
|
compound_format = hint_format highlight_format
|
||||||
|
@ -139,7 +139,7 @@ BEGIN {
|
||||||
line_match = substr(line, RSTART, RLENGTH);
|
line_match = substr(line, RSTART, RLENGTH);
|
||||||
full_line_match = line_match
|
full_line_match = line_match
|
||||||
|
|
||||||
if (COLLAPSE_HINTS) {
|
if (COMPACT_HINTS) {
|
||||||
hint_len = length(hint)
|
hint_len = length(hint)
|
||||||
line_match = substr(line_match, hint_len + 1, length(line_match) - hint_len);
|
line_match = substr(line_match, hint_len + 1, length(line_match) - hint_len);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ BEGIN {
|
||||||
|
|
||||||
pre_match = substr(output_line, 0, col_pos - 1);
|
pre_match = substr(output_line, 0, col_pos - 1);
|
||||||
|
|
||||||
if (COLLAPSE_HINTS) {
|
if (COMPACT_HINTS) {
|
||||||
hint_match = sprintf(compound_format, hint, line_match);
|
hint_match = sprintf(compound_format, hint, line_match);
|
||||||
} else {
|
} else {
|
||||||
hint_match = sprintf(compound_format, line_match, hint);
|
hint_match = sprintf(compound_format, line_match, hint);
|
||||||
|
|
|
@ -30,10 +30,10 @@ function get_stdin() {
|
||||||
|
|
||||||
function show_hints() {
|
function show_hints() {
|
||||||
local fingers_pane_id=$1
|
local fingers_pane_id=$1
|
||||||
local collapsed_hints=$2
|
local compact_hints=$2
|
||||||
|
|
||||||
clear_screen "$fingers_pane_id"
|
clear_screen "$fingers_pane_id"
|
||||||
get_stdin | COLLAPSED_HINTS=$collapsed_hints FINGER_PATTERNS=$PATTERNS __awk__ -f $CURRENT_DIR/hinter.awk 3> $match_lookup_table
|
get_stdin | COMPACT_HINTS=$compact_hints FINGER_PATTERNS=$PATTERNS __awk__ -f $CURRENT_DIR/hinter.awk 3> $match_lookup_table
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_hints_and_swap() {
|
function show_hints_and_swap() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
source $CURRENT_DIR/utils.sh
|
source $CURRENT_DIR/utils.sh
|
||||||
|
|
||||||
function init_fingers_pane() {
|
function init_fingers_pane() {
|
||||||
local pane_id=$(tmux new-window -F "#{pane_id}" -P -d -n "!fingers")
|
local pane_id=$(tmux new-window -F "#{pane_id}" -P -d -n "[fingers]")
|
||||||
echo $pane_id
|
echo $pane_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue