mirror of
1
0
Fork 0

implemented Unicode 4-digit and 8-digit parsing, resolves #148 and resolves #167

some examples:
- \u23f0 will be converted to the alarm clock symbol 
- \U1f47d will be converted to the alien emoji 👽
This commit is contained in:
Gregory Pakosz 2019-06-09 14:46:16 +02:00
parent 915d4a3960
commit 685c74128e
3 changed files with 40 additions and 21 deletions

View File

@ -204,6 +204,24 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# fi
# }
#
# if command -v perl > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# printf '%s' "$*" | perl -CS -pe 's/(\\u([0-9A-Fa-f]{1,4})|\\U([0-9A-Fa-f]{1,8}))/chr(hex($2.$3))/eg' 2>/dev/null
# }
# elif bash --norc --noprofile -c '[[ ! $BASH_VERSION < 4.2. ]]' > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# bash --norc --noprofile -c "printf '%b' '$*'"
# }
# elif command -v python > /dev/null 2>&1; then
# _decode_unicode_escapes() {
# python -c "import re; import sys; sys.stdout.write(re.sub(r'\\\U([0-9A-Fa-f]{1,8})', lambda match: r'\U%s' % match.group(1).zfill(8), r'$*').encode().decode('unicode-escape', 'ignore'))"
# }
# else
# _decode_unicode_escapes() {
# printf '%b' "$*"
# }
# fi
#
# _maximize_pane() {
# current_session=${1:-$(tmux display -p '#{session_name}')}
# current_pane=${2:-$(tmux display -p '#{pane_id}')}
@ -792,10 +810,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
#
# # -- status line -------------------------------------------------------
#
# tmux_conf_theme_left_separator_main=${tmux_conf_theme_left_separator_main-''}
# tmux_conf_theme_left_separator_sub=${tmux_conf_theme_left_separator_sub-'|'}
# tmux_conf_theme_right_separator_main=${tmux_conf_theme_right_separator_main-''}
# tmux_conf_theme_right_separator_sub=${tmux_conf_theme_right_separator_sub-'|'}
# tmux_conf_theme_left_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_main-''}")
# tmux_conf_theme_left_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_left_separator_sub-'|'}")
# tmux_conf_theme_right_separator_main=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_main-''}")
# tmux_conf_theme_right_separator_sub=$(_decode_unicode_escapes "${tmux_conf_theme_right_separator_sub-'|'}")
#
# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-'#000000'} # black
# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-'#ffff00'} # yellow
@ -828,7 +846,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# -e 's%#{hostname}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} false #D)%g' \
# -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
# tmux set -g set-titles-string "$tmux_conf_theme_terminal_title"
# tmux set -g set-titles-string "$(_decode_unicode_escapes "$tmux_conf_theme_terminal_title")"
#
# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white
# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-'#080808'} # dark gray
@ -861,9 +879,9 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #D)%g')
#
# tmux setw -g window-status-style "fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr" \;\
# setw -g window-status-format "$tmux_conf_theme_window_status_format" \;\
# setw -g window-status-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_format")" \;\
# setw -g window-status-current-style "fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr" \;\
# setw -g window-status-current-format "$tmux_conf_theme_window_status_current_format"
# setw -g window-status-current-format "$(_decode_unicode_escapes "$tmux_conf_theme_window_status_current_format")"
#
# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-'default'}
# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-'default'}
@ -1096,14 +1114,14 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
#
# tmux set -g '@battery_bar_symbol_full' "$tmux_conf_battery_bar_symbol_full" \;\
# set -g '@battery_bar_symbol_empty' "$tmux_conf_battery_bar_symbol_empty" \;\
# tmux set -g '@battery_bar_symbol_full' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_full")" \;\
# set -g '@battery_bar_symbol_empty' "$(_decode_unicode_escapes "$tmux_conf_battery_bar_symbol_empty")" \;\
# set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\
# set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\
# set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\
# set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\
# set -g '@battery_status_charging' "$tmux_conf_battery_status_charging" \;\
# set -g '@battery_status_discharging' "$tmux_conf_battery_status_discharging"
# set -g '@battery_status_charging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_charging")" \;\
# set -g '@battery_status_discharging' "$(_decode_unicode_escapes "$tmux_conf_battery_status_discharging")"
# status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right"
# ;;
# esac
@ -1152,8 +1170,8 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g')
#
# tmux set -g status-left-length 1000 \; set -g status-left "$status_left" \;\
# set -g status-right-length 1000 \; set -g status-right "$status_right"
# tmux set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\
# set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")"
#
# # -- clock -------------------------------------------------------------
#

View File

@ -150,10 +150,10 @@ tmux_conf_theme_left_separator_main=''
tmux_conf_theme_left_separator_sub='|'
tmux_conf_theme_right_separator_main=''
tmux_conf_theme_right_separator_sub='|'
#tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline
#tmux_conf_theme_left_separator_sub='' # you only need fonts patched with
#tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone
#tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font
#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
# status left/right content:
# - separate main sections with '|'

View File

@ -103,6 +103,7 @@ Features
- SSH/Mosh aware split pane (reconnects to remote server)
- copy to OS clipboard (needs [`reattach-to-user-namespace`][reattach-to-user-namespace]
on macOS, `xsel` or `xclip` on Linux)
- support for 4-digit hexadecimal Unicode characters (requires `perl` or Bash >= 4.1.2)
- [Facebook PathPicker][] integration if available
- [Urlview][] integration if available
@ -221,10 +222,10 @@ Then edit the `~/.tmux.conf.local` file (`<prefix> e`) and adjust the following
variables:
```
tmux_conf_theme_left_separator_main=''
tmux_conf_theme_left_separator_sub=''
tmux_conf_theme_right_separator_main=''
tmux_conf_theme_right_separator_sub=''
tmux_conf_theme_left_separator_main='\uE0B0'
tmux_conf_theme_left_separator_sub='\uE0B1'
tmux_conf_theme_right_separator_main='\uE0B2'
tmux_conf_theme_right_separator_sub='\uE0B3'
```
### Configuring the status line