Skip to content

Commit 15acc61

Browse files
author
Henry Catalini Smith
authored
Revert options_scope feature for now (d9e4e60) (tmux-plugins#33)
1 parent d9e4e60 commit 15acc61

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ set -g @prefix_highlight_output_prefix '< '
116116
set -g @prefix_highlight_output_suffix ' >'
117117
```
118118

119-
#### Change option scope (default g - global)
120-
121-
Follows same rules as `set-option`
122-
123-
**Special case**: To set scope to session use `'-'`, because by default session scope used when no param is provided.
124-
125-
```tmux.conf
126-
set -g @prefix_highlight_option_scope '-'
127-
```
128-
129119
### License
130120

131121
[MIT](LICENSE)

prefix_highlight.tmux

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set -e
66
place_holder="\#{prefix_highlight}"
77

88
# Possible configurations
9-
option_scope_config='@prefix_highlight_option_scope'
109
fg_color_config='@prefix_highlight_fg'
1110
bg_color_config='@prefix_highlight_bg'
1211
output_prefix='@prefix_highlight_output_prefix'
@@ -23,7 +22,7 @@ empty_attr_config='@prefix_highlight_empty_attr'
2322
empty_has_affixes='@prefix_highlight_empty_has_affixes'
2423

2524
tmux_option() {
26-
local -r value=$(tmux show-option -Aqv "$1")
25+
local -r value=$(tmux show-option -gqv "$1")
2726
local -r default="$2"
2827

2928
if [ -n "$value" ]; then
@@ -37,14 +36,6 @@ format_style() {
3736
echo "#[${1}]" | sed -e 's/,/]#[/g'
3837
}
3938

40-
interpolate() {
41-
local -r option=$1
42-
local -r replacement=$2
43-
local -r option_scope=${3#-}
44-
local -r option_value=$(tmux_option "$option")
45-
tmux set-option -"$option_scope"q "$option" "${option_value/$place_holder/$replacement}"
46-
}
47-
4839
# Defaults
4940
default_fg='colour231'
5041
default_bg='colour04'
@@ -58,7 +49,6 @@ default_empty_prompt=''
5849

5950
main() {
6051
local -r \
61-
option_scope=$(tmux_option "$option_scope_config" "g") \
6252
fg_color=$(tmux_option "$fg_color_config" "$default_fg") \
6353
bg_color=$(tmux_option "$bg_color_config" "$default_bg") \
6454
show_copy_mode=$(tmux_option "$show_copy_config" "off") \
@@ -104,9 +94,11 @@ main() {
10494

10595
local -r highlight="#{?client_prefix,$prefix_mode,$fallback}#[default]"
10696

107-
interpolate "status-left" "$highlight" "$option_scope"
97+
local -r status_left_value="$(tmux_option "status-left")"
98+
tmux set-option -gq "status-left" "${status_left_value/$place_holder/$highlight}"
10899

109-
interpolate "status-right" "$highlight" "$option_scope"
100+
local -r status_right_value="$(tmux_option "status-right")"
101+
tmux set-option -gq "status-right" "${status_right_value/$place_holder/$highlight}"
110102
}
111103

112104
main

0 commit comments

Comments
 (0)