add @fingers-hint-position option
This commit is contained in:
parent
acf4fd23ff
commit
975247c0eb
|
@ -82,6 +82,7 @@ fingers_defaults=( \
|
||||||
[fingers-patterns]="$PATTERNS" \
|
[fingers-patterns]="$PATTERNS" \
|
||||||
[fingers-compact-hints]=1 \
|
[fingers-compact-hints]=1 \
|
||||||
[fingers-copy-command]="" \
|
[fingers-copy-command]="" \
|
||||||
|
[fingers-hint-position]="left" \
|
||||||
[fingers-hint-format]="#[fg=yellow,bold,reverse]%s" \
|
[fingers-hint-format]="#[fg=yellow,bold,reverse]%s" \
|
||||||
[fingers-highlight-format]="#[fg=yellow,bold]%s" \
|
[fingers-highlight-format]="#[fg=yellow,bold]%s" \
|
||||||
[fingers-hint-format-secondary]="#[fg=yellow,bold] [%s]" \
|
[fingers-hint-format-secondary]="#[fg=yellow,bold] [%s]" \
|
||||||
|
@ -91,6 +92,7 @@ fingers_defaults=( \
|
||||||
set_tmux_env 'fingers-patterns'
|
set_tmux_env 'fingers-patterns'
|
||||||
set_tmux_env 'fingers-compact-hints'
|
set_tmux_env 'fingers-compact-hints'
|
||||||
set_tmux_env 'fingers-copy-command'
|
set_tmux_env 'fingers-copy-command'
|
||||||
|
set_tmux_env 'fingers-hint-position'
|
||||||
set_tmux_env 'fingers-hint-format' process_format
|
set_tmux_env 'fingers-hint-format' process_format
|
||||||
set_tmux_env 'fingers-highlight-format' process_format
|
set_tmux_env 'fingers-highlight-format' process_format
|
||||||
set_tmux_env 'fingers-hint-format-secondary' process_format
|
set_tmux_env 'fingers-hint-format-secondary' process_format
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
BEGIN {
|
BEGIN {
|
||||||
n_matches = 0;
|
n_matches = 0;
|
||||||
COMPACT_HINTS = ENVIRON["FINGERS_COMPACT_HINTS"];
|
|
||||||
|
|
||||||
HINTS[0] = "p"
|
HINTS[0] = "p"
|
||||||
HINTS[1] = "o"
|
HINTS[1] = "o"
|
||||||
|
@ -104,21 +103,26 @@ BEGIN {
|
||||||
HINTS[99] = "aa"
|
HINTS[99] = "aa"
|
||||||
|
|
||||||
finger_patterns = ENVIRON["FINGERS_PATTERNS"];
|
finger_patterns = ENVIRON["FINGERS_PATTERNS"];
|
||||||
|
fingers_hint_position = ENVIRON["FINGERS_HINT_POSITION"];
|
||||||
|
fingers_compact_hints = ENVIRON["FINGERS_COMPACT_HINTS"];
|
||||||
|
|
||||||
if (COMPACT_HINTS) {
|
if (fingers_compact_hints) {
|
||||||
hint_format = ENVIRON["FINGERS_HINT_FORMAT"]
|
hint_format = ENVIRON["FINGERS_HINT_FORMAT"]
|
||||||
hint_format_nocolor = ENVIRON["FINGERS_HINT_FORMAT_NOCOLOR"]
|
hint_format_nocolor = ENVIRON["FINGERS_HINT_FORMAT_NOCOLOR"]
|
||||||
highlight_format = ENVIRON["FINGERS_HIGHLIGHT_FORMAT"]
|
highlight_format = ENVIRON["FINGERS_HIGHLIGHT_FORMAT"]
|
||||||
highlight_format_nocolor = ENVIRON["FINGERS_HIGHLIGHT_FORMAT_NOCOLOR"]
|
highlight_format_nocolor = ENVIRON["FINGERS_HIGHLIGHT_FORMAT_NOCOLOR"]
|
||||||
compound_format = hint_format highlight_format
|
|
||||||
} else {
|
} else {
|
||||||
hint_format = ENVIRON["FINGERS_HINT_FORMAT_SECONDARY"]
|
hint_format = ENVIRON["FINGERS_HINT_FORMAT_SECONDARY"]
|
||||||
highlight_format = ENVIRON["FINGERS_HIGHLIGHT_FORMAT_SECONDARY"]
|
highlight_format = ENVIRON["FINGERS_HIGHLIGHT_FORMAT_SECONDARY"]
|
||||||
hint_format_nocolor = ENVIRON["FINGERS_HINT_FORMAT_SECONDARY_NOCOLOR"]
|
hint_format_nocolor = ENVIRON["FINGERS_HINT_FORMAT_SECONDARY_NOCOLOR"]
|
||||||
highlight_format_nocolor = ENVIRON["FINGERS_HIGHLIGHT_FORMAT_SECONDARY_NOCOLOR"]
|
highlight_format_nocolor = ENVIRON["FINGERS_HIGHLIGHT_FORMAT_SECONDARY_NOCOLOR"]
|
||||||
compound_format = highlight_format hint_format
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fingers_hint_position == "left")
|
||||||
|
compound_format = hint_format highlight_format
|
||||||
|
else
|
||||||
|
compound_format = highlight_format hint_format
|
||||||
|
|
||||||
hint_lookup = ""
|
hint_lookup = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,13 +146,20 @@ BEGIN {
|
||||||
}
|
}
|
||||||
hint_lookup = hint_lookup hint ":" line_match "\n"
|
hint_lookup = hint_lookup hint ":" line_match "\n"
|
||||||
|
|
||||||
if (COMPACT_HINTS) {
|
if (fingers_compact_hints) {
|
||||||
hint_len = length(sprintf(hint_format_nocolor, hint))
|
hint_len = length(sprintf(hint_format_nocolor, hint))
|
||||||
line_match = substr(line_match, hint_len + 1, length(line_match) - hint_len);
|
|
||||||
hint_match = sprintf(compound_format, hint, line_match);
|
if (fingers_hint_position == "left")
|
||||||
} else {
|
line_match = substr(line_match, hint_len + 1, length(line_match) - hint_len);
|
||||||
hint_match = sprintf(compound_format, line_match, hint);
|
else
|
||||||
|
line_match = substr(line_match, 1, length(line_match) - hint_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fingers_hint_position == "left")
|
||||||
|
hint_match = sprintf(compound_format, hint, line_match);
|
||||||
|
else
|
||||||
|
hint_match = sprintf(compound_format, line_match, hint);
|
||||||
|
|
||||||
output_line = pre_match hint_match post_match;
|
output_line = pre_match hint_match post_match;
|
||||||
|
|
||||||
col_pos_correction += length(sprintf(highlight_format, line_match)) + length(sprintf(hint_format, hint)) - 1;
|
col_pos_correction += length(sprintf(highlight_format, line_match)) + length(sprintf(hint_format, hint)) - 1;
|
||||||
|
|
Loading…
Reference in New Issue