From 76c252caa972c62ff70d1a32d8d04b45b70b486b Mon Sep 17 00:00:00 2001 From: Denis-Florin Rendler Date: Sat, 17 Nov 2018 10:21:59 +0200 Subject: [PATCH] Add variables for config path --- .tmux.conf | 85 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index b650e6f..77f034f 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -6,6 +6,9 @@ # /!\ do not edit this file # instead, override settings in ~/.tmux.conf.local, see README.md +# -- config consts ------------------------------------------------------------ +# TMUX_CONF_PATH=${TMUX_CONF_PATH:-'~/.tmux.conf} +# TMUX_LOCAL_CONF_PATH=${TMUX_LOCAL_CONF_PATH:-'~/.tmux.conf.local'} # -- general ------------------------------------------------------------------- @@ -24,10 +27,10 @@ setw -q -g utf8 on set -g history-limit 5000 # boost history # edit configuration -bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'" +bind e new-window -n '$TMUX_LOCAL_CONF_PATH' "sh -c '\${EDITOR:-vim} $TMUX_LOCAL_CONF_PATH && tmux source $TMUX_CONF_PATH && tmux display \"$TMUX_CONF_PATH sourced\"'" # reload configuration -bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' +bind r source-file "$TMUX_CONF_PATH" \; display '#{TMUX_CONF_PATH} sourced' # -- display ------------------------------------------------------------------- @@ -75,7 +78,7 @@ bind > swap-pane -D # swap current pane with the next one bind < swap-pane -U # swap current pane with the previous one # maximize current pane -bind + run 'cut -c3- ~/.tmux.conf | sh -s _maximize_pane "#{session_name}" #D' +bind + run 'cut -c3- $TMUX_CONF_PATH | sh -s _maximize_pane "#{session_name}" #D' # pane resizing bind -r H resize-pane -L 2 @@ -91,17 +94,17 @@ bind -r C-l next-window # select next window bind Tab last-window # move to last active window # toggle mouse -bind m run "cut -c3- ~/.tmux.conf | sh -s _toggle_mouse" +bind m run "cut -c3- $TMUX_CONF_PATH | sh -s _toggle_mouse" # -- urlview ------------------------------------------------------------------- -bind U run "cut -c3- ~/.tmux.conf | sh -s _urlview #{pane_id}" +bind U run "cut -c3- $TMUX_CONF_PATH | sh -s _urlview #{pane_id}" # -- facebook pathpicker ------------------------------------------------------- -bind F run "cut -c3- ~/.tmux.conf | sh -s _fpp #{pane_id}" +bind F run "cut -c3- $TMUX_CONF_PATH | sh -s _fpp #{pane_id}" # -- list choice (tmux < 2.4) -------------------------------------------------- @@ -161,12 +164,12 @@ bind P choose-buffer # choose which buffer to paste from # -- user defined overrides ---------------------------------------------------- -if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' +if '[ -f $TMUX_LOCAL_CONF_PATH ]' 'source $TMUX_LOCAL_CONF_PATH' # -- 8< ------------------------------------------------------------------------ -run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' +run 'cut -c3- $TMUX_CONF_PATH | sh -s _apply_configuration' # EOF @@ -777,12 +780,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # tmux_conf_theme_terminal_title=${tmux_conf_theme_terminal_title:-'#h ❐ #S ● #I #W'} # # tmux_conf_theme_terminal_title=$(echo "$tmux_conf_theme_terminal_title" | sed \ -# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \ -# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -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') +# -e 's%#{circled_window_index}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #I)%g' \ +# -e 's%#{circled_session_name}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #S)%g' \ +# -e 's%#{username}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} false #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} true #D)%g') # tmux set -g set-titles-string "$tmux_conf_theme_terminal_title" # # tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-'#8a8a8a'} # white @@ -801,19 +804,19 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # fi # # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ -# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \ -# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -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') +# -e 's%#{circled_window_index}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #I)%g' \ +# -e 's%#{circled_session_name}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #S)%g' \ +# -e 's%#{username}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} false #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} true #D)%g') # tmux_conf_theme_window_status_current_format=$(echo "$tmux_conf_theme_window_status_current_format" | sed \ -# -e 's%#{circled_window_index}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #I)%g' \ -# -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g' \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -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') +# -e 's%#{circled_window_index}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #I)%g' \ +# -e 's%#{circled_session_name}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #S)%g' \ +# -e 's%#{username}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} false #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- $TMUX_CONF_PATH | 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" \;\ @@ -871,7 +874,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix,}/g") # # tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- $TMUX_CONF_PATH | sh -s _root #{pane_tty} #D)#[inherit]%g") # # tmux_conf_theme_status_left=$(echo "$tmux_conf_theme_status_left" | sed \ # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g") @@ -958,7 +961,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix,}/g") # # tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- ~/.tmux.conf | sh -s _root #{pane_tty} #D)#[inherit]%g") +# -e "s%#{root}%#[fg=$tmux_conf_theme_root_fg]#[bg=$tmux_conf_theme_root_bg]#[$tmux_conf_theme_root_attr]#(cut -c3- $TMUX_CONF_PATH | sh -s _root #{pane_tty} #D)#[inherit]%g") # # tmux_conf_theme_status_right=$(echo "$tmux_conf_theme_status_right" | sed \ # -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g") @@ -1059,22 +1062,22 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # 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" -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _battery)$status_right" +# status_right="#(cut -c3- $TMUX_CONF_PATH | sh -s _battery)$status_right" # ;; # esac # # case "$status_left $status_right" in # *'#{username}'*|*'#{hostname}'*|*'#{username_ssh}'*|*'#{hostname_ssh}'*) # status_left=$(echo "$status_left" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -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') +# -e 's%#{username}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} false #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} true #D)%g') # status_right=$(echo "$status_right" | sed \ -# -e 's%#{username}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} false #D)%g' \ -# -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') +# -e 's%#{username}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} false #D)%g' \ +# -e 's%#{hostname}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} false #D)%g' \ +# -e 's%#{username_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _username #{pane_tty} true #D)%g' \ +# -e 's%#{hostname_ssh}%#(cut -c3- $TMUX_CONF_PATH | sh -s _hostname #{pane_tty} true #D)%g') # ;; # esac # @@ -1090,7 +1093,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e 's/#\{(\?)?uptime_h/#\{\1@uptime_h/g' \ # -e 's/#\{(\?)?uptime_m/#\{\1@uptime_m/g' \ # -e 's/#\{(\?)?uptime_s/#\{\1@uptime_s/g') -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _uptime)$status_right" +# status_right="#(cut -c3- $TMUX_CONF_PATH | sh -s _uptime)$status_right" # ;; # esac # @@ -1100,12 +1103,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') # status_right=$(echo "$status_right" | sed -E \ # -e 's/#\{(\?)?loadavg/#\{\1@loadavg/g') -# status_right="#(cut -c3- ~/.tmux.conf | sh -s _loadavg)$status_right" +# status_right="#(cut -c3- $TMUX_CONF_PATH | sh -s _loadavg)$status_right" # ;; # esac # -# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g') -# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled_digit #S)%g') +# status_left=$(echo "$status_left" | sed 's%#{circled_session_name}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #S)%g') +# status_right=$(echo "$status_right" | sed 's%#{circled_session_name}%#(cut -c3- $TMUX_CONF_PATH | sh -s _circled_digit #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"