2012-07-23 04:25:24 -04:00
|
|
|
# cat << ►_◄ > /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
# -- general -------------------------------------------------------------------
|
|
|
|
|
|
|
|
set -g default-terminal "screen-256color" # colors!
|
|
|
|
setw -g xterm-keys on
|
|
|
|
set -s escape-time 0 # fastest command sequences
|
2014-02-28 05:41:39 -05:00
|
|
|
set -sg repeat-time 600 # increase repeat timeout
|
2012-07-23 04:25:24 -04:00
|
|
|
set -s quiet on # disable various messages
|
|
|
|
|
|
|
|
set -g prefix2 C-a # GNU-Screen compatible prefix
|
|
|
|
bind C-a send-prefix -2
|
|
|
|
|
|
|
|
set -g status-utf8 on # expect UTF-8
|
|
|
|
setw -g utf8 on
|
|
|
|
|
2014-02-28 05:41:39 -05:00
|
|
|
set -g history-limit 5000 # boost history
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
# edit configuration
|
2015-10-11 11:54:46 -04:00
|
|
|
bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
# reload configuration
|
|
|
|
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
|
|
|
|
|
2013-07-15 05:04:39 -04:00
|
|
|
# see https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
|
2015-08-06 06:28:53 -04:00
|
|
|
if 'which -s reattach-to-user-namespace' 'set -g default-command "exec initializing... 2> /dev/null & reattach-to-user-namespace $SHELL -l"'
|
2013-07-15 05:04:39 -04:00
|
|
|
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
# -- display -------------------------------------------------------------------
|
|
|
|
|
|
|
|
set -g base-index 1 # start windows numbering at 1
|
|
|
|
setw -g pane-base-index 1 # make pane numbering consistent with windows
|
|
|
|
|
|
|
|
setw -g automatic-rename on # rename window to reflect current program
|
2014-08-21 05:15:05 -04:00
|
|
|
# renumber windows when a window is closed
|
|
|
|
set -g renumber-windows on
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
set -g set-titles on # set terminal title
|
|
|
|
set -g set-titles-string '#h ❐ #S ● #I #W'
|
|
|
|
|
|
|
|
set -g display-panes-time 800 # slightly longer pane indicators display time
|
|
|
|
set -g display-time 1000 # slightly longer status messages display time
|
|
|
|
|
|
|
|
set -g status-interval 10 # redraw status line every 10 seconds
|
|
|
|
|
|
|
|
# 24 hour clock
|
|
|
|
setw -g clock-mode-style 24
|
|
|
|
|
|
|
|
# clear both screen and history
|
|
|
|
bind -n C-l send-keys C-l \; run 'tmux clear-history'
|
|
|
|
|
|
|
|
# activity
|
|
|
|
set -g monitor-activity on
|
|
|
|
set -g visual-activity off
|
|
|
|
|
|
|
|
|
|
|
|
# -- navigation ----------------------------------------------------------------
|
|
|
|
|
2012-11-14 15:51:43 -05:00
|
|
|
# find session
|
|
|
|
bind C-f command-prompt -p find-session 'switch-client -t %%'
|
|
|
|
|
2012-07-23 04:25:24 -04:00
|
|
|
# pane navigation
|
|
|
|
bind -r h select-pane -L # move left
|
|
|
|
bind -r j select-pane -D # move down
|
|
|
|
bind -r k select-pane -U # move up
|
|
|
|
bind -r l select-pane -R # move right
|
|
|
|
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'
|
|
|
|
|
|
|
|
# pane resizing
|
|
|
|
bind -r H resize-pane -L 2
|
|
|
|
bind -r J resize-pane -D 2
|
|
|
|
bind -r K resize-pane -U 2
|
|
|
|
bind -r L resize-pane -R 2
|
|
|
|
|
|
|
|
# window navigation
|
2015-10-18 05:57:17 -04:00
|
|
|
unbind n
|
|
|
|
unbind p
|
2012-07-23 04:25:24 -04:00
|
|
|
bind -r C-h previous-window # select previous window
|
|
|
|
bind -r C-l next-window # select next window
|
2015-10-21 15:52:03 -04:00
|
|
|
bind Tab last-window # move to last active window
|
2012-10-05 18:31:08 -04:00
|
|
|
|
|
|
|
# toggle mouse
|
|
|
|
bind m run "cut -c3- ~/.tmux.conf | sh -s toggle_mouse"
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
|
2015-07-24 16:25:37 -04:00
|
|
|
# -- urlview -------------------------------------------------------------------
|
|
|
|
|
2015-10-18 05:42:10 -04:00
|
|
|
bind U run "cut -c3- ~/.tmux.conf | sh -s urlview #{pane_id}"
|
2015-07-24 16:25:37 -04:00
|
|
|
|
|
|
|
|
2015-07-24 16:25:55 -04:00
|
|
|
# -- facebook pathpicker -------------------------------------------------------
|
|
|
|
|
2015-10-18 05:42:10 -04:00
|
|
|
bind F run "cut -c3- ~/.tmux.conf | sh -s fpp #{pane_id}"
|
2015-07-24 16:25:55 -04:00
|
|
|
|
|
|
|
|
2014-11-23 04:53:47 -05:00
|
|
|
# -- list choice ---------------------------------------------------------------
|
|
|
|
|
|
|
|
bind -t vi-choice h tree-collapse
|
|
|
|
bind -t vi-choice l tree-expand
|
2015-11-02 05:04:46 -05:00
|
|
|
run -b 'tmux bind -t vi-choice K start-of-list 2> /dev/null'
|
|
|
|
run -b 'tmux bind -t vi-choice J end-of-list 2> /dev/null'
|
2014-11-23 04:53:47 -05:00
|
|
|
bind -t vi-choice H tree-collapse-all
|
|
|
|
bind -t vi-choice L tree-expand-all
|
|
|
|
bind -t vi-choice Escape cancel
|
|
|
|
|
|
|
|
|
|
|
|
# -- edit mode -----------------------------------------------------------------
|
|
|
|
|
|
|
|
# the following vi-copy bindings match my vim settings
|
|
|
|
# see https://github.com/gpakosz/.vim.git
|
|
|
|
bind -ct vi-edit H start-of-line
|
|
|
|
bind -ct vi-edit L end-of-line
|
|
|
|
bind -ct vi-edit q cancel
|
|
|
|
bind -ct vi-edit Escape cancel
|
|
|
|
|
|
|
|
|
2012-07-23 04:25:24 -04:00
|
|
|
# -- copy mode -----------------------------------------------------------------
|
|
|
|
|
|
|
|
bind Enter copy-mode # enter copy mode
|
|
|
|
bind b list-buffers # list paster buffers
|
|
|
|
bind p paste-buffer # paste from the top pate buffer
|
|
|
|
bind P choose-buffer # choose which buffer to paste from
|
|
|
|
|
|
|
|
# the following vi-copy bindings match my vim settings
|
|
|
|
# see https://github.com/gpakosz/.vim.git
|
|
|
|
bind -t vi-copy v begin-selection
|
|
|
|
bind -t vi-copy C-v rectangle-toggle
|
|
|
|
bind -t vi-copy y copy-selection
|
|
|
|
bind -t vi-copy Escape cancel
|
|
|
|
bind -t vi-copy H start-of-line
|
|
|
|
bind -t vi-copy L end-of-line
|
|
|
|
|
2013-07-22 16:37:59 -04:00
|
|
|
# copy to Mac OSX pasteboard
|
2015-11-02 05:04:46 -05:00
|
|
|
if -b 'which -s reattach-to-user-namespace' 'bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
|
2013-07-22 16:37:59 -04:00
|
|
|
|
2013-07-15 05:04:39 -04:00
|
|
|
|
2012-07-23 04:25:24 -04:00
|
|
|
# -- user defined --------------------------------------------------------------
|
|
|
|
|
2013-08-28 02:58:06 -04:00
|
|
|
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local'
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
# -- 8< ------------------------------------------------------------------------
|
|
|
|
|
2015-11-02 05:04:46 -05:00
|
|
|
run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
|
2012-07-23 04:25:24 -04:00
|
|
|
|
|
|
|
|
|
|
|
# ►_◄
|
2014-11-18 17:08:57 -05:00
|
|
|
#
|
2012-07-23 04:25:24 -04:00
|
|
|
# # exit the script if any statement returns a non-true return value
|
|
|
|
# set -e
|
|
|
|
#
|
|
|
|
# apply_theme() {
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme=${tmux_conf_theme:-default}
|
|
|
|
# case "${tmux_conf_theme}" in
|
|
|
|
# powerline|powerline_patched_font)
|
2014-02-15 11:24:49 -05:00
|
|
|
# left_separator=''
|
|
|
|
# left_separator_black=''
|
|
|
|
# right_separator=''
|
|
|
|
# right_separator_black=''
|
|
|
|
# session_symbol=''
|
2012-07-23 04:25:24 -04:00
|
|
|
# ;;
|
2015-10-22 15:37:44 -04:00
|
|
|
# ""|default)
|
2014-02-15 11:24:49 -05:00
|
|
|
# left_separator='|'
|
2015-10-22 15:37:44 -04:00
|
|
|
# left_separator_black=''
|
2014-02-15 11:24:49 -05:00
|
|
|
# right_separator='|'
|
2015-10-22 15:37:44 -04:00
|
|
|
# right_separator_black=''
|
2012-07-23 04:25:24 -04:00
|
|
|
# ;;
|
|
|
|
# esac
|
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# case "$tmux_conf_theme" in
|
|
|
|
# ""|default|powerline)
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
|
|
|
# # panes
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_pane_border_fg=${tmux_conf_theme_pane_border_fg:-colour238} # light gray
|
|
|
|
# tmux_conf_theme_pane_active_border_fg=${tmux_conf_theme_pane_active_border_fg:-colour39} # light blue
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux set -g pane-border-style fg=$tmux_conf_theme_pane_border_fg \; set -g pane-active-border-style fg=$tmux_conf_theme_pane_active_border_fg
|
2012-07-23 04:25:24 -04:00
|
|
|
# #uncomment for fat borders
|
2015-10-22 15:37:44 -04:00
|
|
|
# #tmux set -ga pane-border-style bg=$tmux_conf_theme_pane_border_fg \; set -ga pane-active-border-style bg=$tmux_conf_theme_pane_active_border_fg
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_display_panes_active_colour=${tmux_conf_theme_display_panes_active_colour:-colour39} # light blue
|
|
|
|
# tmux_conf_theme_display_panes_colour=${tmux_conf_theme_display_panes_colour:-colour39} # light blue
|
|
|
|
# tmux set -g display-panes-active-colour $tmux_conf_theme_display_panes_active_colour \; set -g display-panes-colour $tmux_conf_theme_display_panes_colour
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-12-05 09:36:28 -05:00
|
|
|
# tmux_conf_theme_highlight_focused_pane=${tmux_conf_theme_highlight_focused_pane:-disabled}
|
|
|
|
# tmux_conf_theme_focused_pane_fg=${tmux_conf_theme_focused_pane_fg:-default} # default
|
|
|
|
# tmux_conf_theme_focused_pane_bg=${tmux_conf_theme_focused_pane_bg:-colour23} # dark blue/green
|
|
|
|
# highlight_focused_pane_enabled=$( ([ x"$tmux_conf_theme_highlight_focused_pane" = x"enabled" ] || [ -z "$tmux_conf_theme_highlight_focused_pane" ]) && echo "true" || echo "false" )
|
|
|
|
# if [ x"$highlight_focused_pane_enabled" = x"true" ] ; then
|
|
|
|
# tmux setw -g window-active-style "fg=$tmux_conf_theme_focused_pane_fg,bg=$tmux_conf_theme_focused_pane_bg"
|
|
|
|
# else
|
|
|
|
# tmux setw -g window-active-style default
|
|
|
|
# fi
|
|
|
|
#
|
2012-07-23 04:25:24 -04:00
|
|
|
# # messages
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_message_fg=${tmux_conf_theme_message_fg:-colour16} # black
|
|
|
|
# tmux_conf_theme_message_bg=${tmux_conf_theme_message_bg:-colour226} # yellow
|
|
|
|
# tmux_conf_theme_message_attr=${tmux_conf_theme_message_attr:-bold}
|
|
|
|
# tmux set -g message-style fg=$tmux_conf_theme_message_fg,bg=$tmux_conf_theme_message_bg,$tmux_conf_theme_message_attr
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_message_command_fg=${tmux_conf_theme_message_command_fg:-colour16} # black
|
|
|
|
# tmux_conf_theme_message_command_bg=${tmux_conf_theme_message_command_bg:-colour160} # light yellow
|
|
|
|
# tmux set -g message-command-style fg=$tmux_conf_theme_message_command_fg,bg=$tmux_conf_theme_message_command_bg,$tmux_conf_theme_message_attr
|
2014-11-18 17:08:57 -05:00
|
|
|
#
|
2012-07-23 04:25:24 -04:00
|
|
|
# # windows mode
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_mode_fg=${tmux_conf_theme_mode_fg:-colour16} # black
|
|
|
|
# tmux_conf_theme_mode_bg=${tmux_conf_theme_mode_bg:-colour226} # yellow
|
|
|
|
# tmux_conf_theme_mode_attr=${tmux_conf_theme_mode_attr:-bold}
|
|
|
|
# tmux setw -g mode-style fg=$tmux_conf_theme_mode_fg,bg=$tmux_conf_theme_mode_bg,$tmux_conf_theme_mode_attr
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
|
|
|
# # status line
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_status_fg=${tmux_conf_theme_status_fg:-colour253} # white
|
|
|
|
# tmux_conf_theme_status_bg=${tmux_conf_theme_status_bg:-colour232} # dark gray
|
|
|
|
# tmux set -g status-style fg=$tmux_conf_theme_status_fg,bg=$tmux_conf_theme_status_bg
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_session_fg=${tmux_conf_theme_session_fg:-colour16} # black
|
|
|
|
# tmux_conf_theme_session_bg=${tmux_conf_theme_session_bg:-colour226} # yellow
|
|
|
|
# status_left="#[fg=$tmux_conf_theme_session_fg,bg=$tmux_conf_theme_session_bg,bold] ❐ #S #[fg=$tmux_conf_theme_session_bg,bg=$tmux_conf_theme_status_bg,nobold]$left_separator_black"
|
2014-12-29 07:51:04 -05:00
|
|
|
# if [ x"`tmux -q -L tmux_theme_status_left_test -f /dev/null new-session -d \; show -g -v status-left \; kill-session`" = x"[#S] " ] ; then
|
|
|
|
# status_left="$status_left "
|
|
|
|
# fi
|
2012-07-23 04:25:24 -04:00
|
|
|
# tmux set -g status-left-length 32 \; set -g status-left "$status_left"
|
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_window_status_fg=${tmux_conf_theme_window_status_fg:-colour245} # light gray
|
|
|
|
# tmux_conf_theme_window_status_bg=${tmux_conf_theme_window_status_bg:-colour232} # dark gray
|
2012-07-23 04:25:24 -04:00
|
|
|
# window_status_format="#I #W"
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux setw -g window-status-style fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg \; setw -g window-status-format "$window_status_format"
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_window_status_current_fg=${tmux_conf_theme_window_status_current_fg:-colour16} # black
|
|
|
|
# tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-colour39} # light blue
|
|
|
|
# window_status_current_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_window_status_current_bg]$left_separator_black#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,bold] #I $left_separator #W #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,nobold]$left_separator_black"
|
2012-07-23 04:25:24 -04:00
|
|
|
# tmux setw -g window-status-current-format "$window_status_current_format"
|
|
|
|
# tmux set -g status-justify left
|
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# 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}
|
|
|
|
# tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore}
|
|
|
|
# tmux setw -g window-status-activity-style fg=$tmux_conf_theme_window_status_activity_fg,bg=$tmux_conf_theme_window_status_activity_bg,$tmux_conf_theme_window_status_activity_attr
|
2012-07-23 04:25:24 -04:00
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-colour226} # yellow
|
|
|
|
# tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default}
|
|
|
|
# tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold}
|
|
|
|
# tmux setw -g window-status-bell-style fg=$tmux_conf_theme_window_status_bell_fg,bg=$tmux_conf_theme_window_status_bell_bg,$tmux_conf_theme_window_status_bell_attr
|
2014-11-18 17:08:57 -05:00
|
|
|
#
|
|
|
|
# window_status_last_fg=colour39 # light blue
|
|
|
|
# window_status_last_attr=default
|
|
|
|
# tmux setw -g window-status-last-style $window_status_last_attr,fg=$window_status_last_fg
|
|
|
|
#
|
2015-10-28 05:55:32 -04:00
|
|
|
# tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-disabled}
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_battery=${tmux_conf_theme_battery:-enabled}
|
|
|
|
# tmux_conf_theme_time=${tmux_conf_theme_time:-enabled}
|
|
|
|
# tmux_conf_theme_date=${tmux_conf_theme_date:-enabled}
|
|
|
|
# tmux_conf_theme_username=${tmux_conf_theme_username:-enabled}
|
|
|
|
# tmux_conf_theme_hostname=${tmux_conf_theme_hostname:-enabled}
|
2015-10-28 05:55:32 -04:00
|
|
|
#
|
|
|
|
# prefix_enabled=$( ([ x"$tmux_conf_theme_prefix" = x"enabled" ] || [ -z "$tmux_conf_theme_prefix" ]) && echo "true" || echo "false" )
|
2015-10-22 15:37:44 -04:00
|
|
|
# battery_enabled=$( ([ x"$tmux_conf_theme_battery" = x"enabled" ] || [ -z "$tmux_conf_theme_battery" ]) && echo "true" || echo "false" )
|
|
|
|
# time_enabled=$( ([ x"$tmux_conf_theme_time" = x"enabled" ] || [ -z "$tmux_conf_theme_time" ]) && echo "true" || echo "false" )
|
|
|
|
# date_enabled=$( ([ x"$tmux_conf_theme_date" = x"enabled" ] || [ -z "$tmux_conf_theme_date" ]) && echo "true" || echo "false" )
|
|
|
|
# username_enabled=$( ([ x"$tmux_conf_theme_username" = x"enabled" ] || [ -z "$tmux_conf_theme_username" ] || ([ x"$tmux_conf_theme_username" = x"ssh" ] && ([ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] || [ -n "$SSH_TTY" ]))) && echo "true" || echo "false" )
|
|
|
|
# hostname_enabled=$( ([ x"$tmux_conf_theme_hostname" = x"enabled" ] || [ -z "$tmux_conf_theme_hostname" ] || ([ x"$tmux_conf_theme_hostname" = x"ssh" ] && ([ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ] || [ -n "$SSH_TTY" ]))) && echo "true" || echo "false" )
|
|
|
|
#
|
2015-10-28 05:55:32 -04:00
|
|
|
# tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-colour253} # white
|
|
|
|
# tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-colour16} # black
|
|
|
|
# tmux_conf_theme_time_date_fg=${tmux_conf_theme_time_date_fg:-colour247} # light gray
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_theme_time_date_bg=${tmux_conf_theme_time_date_bg:-colour232} # dark gray
|
|
|
|
# tmux_conf_theme_username_fg=colour254 # white
|
|
|
|
# tmux_conf_theme_username_bg=colour160 # red
|
|
|
|
# tmux_conf_theme_hostname_fg=colour16 # black
|
|
|
|
# tmux_conf_theme_hostname_bg=colour254 # white
|
|
|
|
#
|
2015-10-28 05:55:32 -04:00
|
|
|
# if [ x"$prefix_enabled" = x"true" ] ; then
|
|
|
|
# status_right_prefix="#{?client_prefix,#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[bold]⌨ #[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_status_bg]#[nobold],}"
|
|
|
|
# fi
|
2015-10-22 15:37:44 -04:00
|
|
|
# if [ x"$battery_enabled" = x"true" ] ; then
|
|
|
|
# status_right_battery="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto} \"${tmux_conf_battery_palette:-colour160,colour254,colour16}\" ${tmux_conf_battery_status:-enabled})} "
|
|
|
|
# has_battery=$(eval echo \$${status_right_battery#\#})
|
|
|
|
# if [ -n "$has_battery" ] && ([ x"$time_enabled" = x"true" ] || [ x"$date_enabled" = x"true" ]) ; then
|
|
|
|
# status_right_battery="${status_right_battery}#[fg=$tmux_conf_theme_time_date_fg,nobold]$right_separator"
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
# if [ x"$time_enabled" = x"true" ] ; then
|
|
|
|
# status_right_time="#[fg=$tmux_conf_theme_time_date_fg,nobold]${status_right_time} %R "
|
|
|
|
# if [ x"$date_enabled" = x"true" ] ; then
|
|
|
|
# status_right_time="${status_right_time}#[fg=$tmux_conf_theme_time_date_fg,nobold]$right_separator"
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
# if [ x"$date_enabled" = x"true" ] ; then
|
|
|
|
# status_right_date="#[fg=$tmux_conf_theme_time_date_fg,nobold] %d %b "
|
|
|
|
# fi
|
|
|
|
# if [ x"$username_enabled" = x"true" ] ; then
|
|
|
|
# status_right_username="#[fg=$tmux_conf_theme_username_bg,bg=$tmux_conf_theme_time_date_bg,nobold]$right_separator_black#[fg=$tmux_conf_theme_username_fg,bg=$tmux_conf_theme_username_bg,nobold] #(whoami) "
|
|
|
|
# fi
|
|
|
|
# if [ x"$hostname_enabled" = x"true" ] ; then
|
|
|
|
# if [ x"$username_enabled" = x"true" ] ; then
|
|
|
|
# status_right_hostname="#[bg=$tmux_conf_theme_username_bg]"
|
|
|
|
# else
|
|
|
|
# status_right_hostname="#[bg=$tmux_conf_theme_time-data_bg]"
|
|
|
|
# fi
|
|
|
|
# status_right_hostname="#[fg=$tmux_conf_theme_hostname_bg,nobold]${status_right_hostname}$right_separator_black#[fg=$tmux_conf_theme_hostname_fg,bg=$tmux_conf_theme_hostname_bg,bold] #h "
|
|
|
|
# fi
|
2015-10-28 05:55:32 -04:00
|
|
|
#
|
|
|
|
# status_right="${status_right_prefix}${status_right_battery}${status_right_time}${status_right_date}${status_right_username}${status_right_hostname}"
|
2012-07-23 04:25:24 -04:00
|
|
|
# tmux set -g status-right-length 64 \; set -g status-right "$status_right"
|
|
|
|
#
|
|
|
|
# # clock
|
|
|
|
# clock_mode_colour=colour39 # light blue
|
|
|
|
# tmux setw -g clock-mode-colour $clock_mode_colour
|
|
|
|
# ;;
|
|
|
|
# esac
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# circled_digit() {
|
|
|
|
# circled_digits='⓪①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳'
|
|
|
|
# if [ $1 -lt 20 ] 2>/dev/null ; then
|
|
|
|
# echo ${circled_digits:$1:1}
|
|
|
|
# else
|
|
|
|
# echo $1
|
|
|
|
# fi
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# maximize_pane() {
|
2014-08-21 05:16:08 -04:00
|
|
|
# tmux -q -L swap-pane-test -f /dev/null new-session -d \; new-window \; new-window \; swap-pane -t :1 \; kill-session || { tmux display 'your tmux version has a buggy swap-pane command - see ticket #108, fixed in upstream commit 78e783e'; exit; }
|
2014-02-28 05:41:39 -05:00
|
|
|
# __current_pane=$(tmux display -p '#{pane_id}')
|
2014-08-21 05:16:08 -04:00
|
|
|
#
|
2015-04-23 15:55:03 -04:00
|
|
|
# __dead_panes=$(tmux list-panes -s -F '#{pane_dead} #{pane_id} #{pane_start_command}' | grep -o '^1 %.\+maximized.\+$' || true)
|
|
|
|
# __restore=$(echo "${__dead_panes}" | sed -n -E -e "s/^1 ${__current_pane} .+maximized.+(%[0-9]+)$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t ${__current_pane}/p" -e "s/^1 (%[0-9]+) .+maximized.+${__current_pane}$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t \1/p" )
|
2014-08-21 05:16:08 -04:00
|
|
|
#
|
2012-07-23 04:25:24 -04:00
|
|
|
# if [ x"${__restore}" = x ] ; then
|
|
|
|
# [ x"$(tmux list-panes | wc -l | sed 's/^ *//g')" = x1 ] && tmux display "Can't maximize with only one pane" && return
|
2015-08-06 06:28:53 -04:00
|
|
|
# __window=$(tmux new-window -P "exec maximized...& tmux setw remain-on-exit on; clear; tmux clear-history; printf 'Pane has been maximized, press <prefix>+ to restore. %s' \\${__current_pane};")
|
2013-04-15 17:49:56 -04:00
|
|
|
# __window=${__window%.*}
|
2014-08-21 05:16:08 -04:00
|
|
|
#
|
2015-04-23 15:55:03 -04:00
|
|
|
# __guard=50
|
|
|
|
# while ( [ x"$(tmux list-panes -t ${__window} -F '#{session_name}:#{window_index} #{pane_dead}')" != x"${__window} "1 ] && [ x"${__guard}" != x0 ] ) ; do sleep 0.01 ; __guard=$((__guard - 1)); done
|
2013-04-15 17:49:56 -04:00
|
|
|
# if [ x"${__guard}" = 0 ] ; then
|
|
|
|
# exit 1
|
|
|
|
# fi
|
2014-08-21 05:16:08 -04:00
|
|
|
#
|
2014-02-28 05:41:39 -05:00
|
|
|
# __new_pane=$(tmux display -p '#{pane_id}')
|
2013-04-15 17:49:56 -04:00
|
|
|
# tmux setw remain-on-exit off \; swap-pane -s "${__current_pane}" -t "${__new_pane}"
|
2012-07-23 04:25:24 -04:00
|
|
|
# else
|
2014-12-12 06:01:52 -05:00
|
|
|
# ${__restore} || tmux kill-pane
|
2012-07-23 04:25:24 -04:00
|
|
|
# fi
|
|
|
|
# }
|
|
|
|
#
|
2012-10-05 18:31:08 -04:00
|
|
|
# toggle_mouse() {
|
2015-09-17 16:16:29 -04:00
|
|
|
# if (tmux show -g -w |grep -q mode-mouse); then
|
|
|
|
# old=$(tmux show -g -w | grep mode-mouse | cut -d' ' -f2)
|
|
|
|
# new=""
|
2012-10-05 18:31:08 -04:00
|
|
|
#
|
2015-09-17 16:16:29 -04:00
|
|
|
# if [ "$old" = "on" ] ; then
|
|
|
|
# new="off"
|
|
|
|
# else
|
|
|
|
# new="on"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# tmux set -g mode-mouse $new \;\
|
|
|
|
# set -g mouse-resize-pane $new \;\
|
|
|
|
# set -g mouse-select-pane $new \;\
|
|
|
|
# set -g mouse-select-window $new \;\
|
|
|
|
# display "mouse: $new"
|
2012-10-05 18:31:08 -04:00
|
|
|
# else
|
2015-09-17 16:16:29 -04:00
|
|
|
# old=$(tmux show -g | grep mouse | head -n 1 | cut -d' ' -f2)
|
|
|
|
# new=""
|
2012-10-05 18:31:08 -04:00
|
|
|
#
|
2015-09-17 16:16:29 -04:00
|
|
|
# if [ "$old" = "on" ] ; then
|
|
|
|
# new="off"
|
|
|
|
# else
|
|
|
|
# new="on"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# tmux set -g mouse $new \;\
|
|
|
|
# display "mouse: $new"
|
|
|
|
# fi
|
2012-10-05 18:31:08 -04:00
|
|
|
# }
|
|
|
|
#
|
2014-02-15 12:39:11 -05:00
|
|
|
# battery() {
|
|
|
|
# uname_s=$(uname -s)
|
2015-04-27 11:53:14 -04:00
|
|
|
# if [ x"$uname_s" = x"Darwin" ]; then
|
2014-02-15 12:39:11 -05:00
|
|
|
# batt=$(pmset -g batt)
|
|
|
|
# percentage=$(echo $batt |egrep -o [0-9]+%) || return
|
2015-04-27 11:53:14 -04:00
|
|
|
# discharging=$(echo $batt | grep -qi "discharging" && echo "true" || echo "false")
|
2014-02-15 12:39:11 -05:00
|
|
|
# charge="${percentage%%%} / 100"
|
2015-04-27 11:53:14 -04:00
|
|
|
# elif [ x"$uname_s" = x"Linux" ]; then
|
2014-02-15 12:39:11 -05:00
|
|
|
# batpath=/sys/class/power_supply/BAT0
|
|
|
|
# if [ ! -d $batpath ]; then
|
|
|
|
# batpath=/sys/class/power_supply/BAT1
|
|
|
|
# fi
|
|
|
|
# batfull=$batpath/energy_full
|
|
|
|
# batnow=$batpath/energy_now
|
|
|
|
# if [ ! -r $batfull -o ! -r $batnow ]; then
|
|
|
|
# return
|
|
|
|
# fi
|
2015-04-27 11:53:14 -04:00
|
|
|
# discharging=$(grep -qi "discharging" $batpath/status && echo "true" || echo "false")
|
2014-02-15 12:39:11 -05:00
|
|
|
# charge="$(cat $batnow) / $(cat $batfull)" || return
|
2015-10-28 13:45:32 -04:00
|
|
|
# elif [ x"${uname_s:0:6}" = x"CYGWIN" ]; then
|
|
|
|
# wmic path Win32_Battery 2>&1 | grep -q 'No Instance' && return
|
|
|
|
# discharging=$(wmic path Win32_Battery Get BatteryStatus 2>/dev/null | grep -q 1 && echo "true" || echo "false")
|
|
|
|
# percentage=$(wmic path Win32_Battery Get EstimatedChargeRemaining /format:list 2>/dev/null | grep '[^[:blank:]]' | cut -d= -f2)
|
|
|
|
# charge="${percentage} / 100"
|
|
|
|
# else
|
|
|
|
# return
|
2014-02-15 12:39:11 -05:00
|
|
|
# fi
|
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# battery_symbol=$1
|
|
|
|
# battery_symbol_count=$2
|
|
|
|
# battery_palette=$3
|
|
|
|
# battery_status=$4
|
|
|
|
# if [ x"$battery_symbol_count" = x"auto" ]; then
|
|
|
|
# columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)
|
|
|
|
# if [ $columns -ge 80 ]; then
|
|
|
|
# battery_symbol_count=10
|
|
|
|
# else
|
|
|
|
# battery_symbol_count=5
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
# battery_symbol_heart_full=♥
|
|
|
|
# battery_symbol_heart_empty=♥
|
|
|
|
# battery_symbol_block_full=◼
|
|
|
|
# battery_symbol_block_empty=◻
|
|
|
|
# eval battery_symbol_full='$battery_symbol_'"$battery_symbol"'_full'
|
|
|
|
# eval battery_symbol_empty='$battery_symbol_'"$battery_symbol"'_empty'
|
|
|
|
#
|
|
|
|
# if [ x"$battery_status" = x"1"] || [ x"$battery_status" = x"true" ] || [ x"$battery_status" = x"enabled" ] ; then
|
2015-04-27 11:53:14 -04:00
|
|
|
# if [ x"$discharging" = x"true" ]; then
|
2015-10-28 13:45:32 -04:00
|
|
|
# [ x"${uname_s:0:6}" != x"CYGWIN" ] && printf "%s " 🔋
|
2015-04-27 11:53:14 -04:00
|
|
|
# else
|
|
|
|
# printf "%s " ⚡
|
|
|
|
# fi
|
|
|
|
# fi
|
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# if echo $battery_palette | grep -q -E '^heat|gradient(,[a-z0-9]{7,9})?$'; then
|
2015-09-14 15:17:06 -04:00
|
|
|
# battery_style=$(echo $battery_palette | cut -d, -f1)
|
2015-03-28 05:17:43 -04:00
|
|
|
# battery_bg=$(echo $battery_palette | cut -s -d, -f2)
|
|
|
|
# battery_bg=${battery_bg:-colour16}
|
2015-09-14 15:17:06 -04:00
|
|
|
# gradient="196 202 208 214 220 226 190 154 118 82 46"
|
2015-03-28 05:17:43 -04:00
|
|
|
# heat="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
|
2015-09-14 15:17:06 -04:00
|
|
|
# eval palette=$(echo \$$battery_style)
|
|
|
|
# count=$(echo $(echo $palette | wc -w))
|
2015-03-28 05:17:43 -04:00
|
|
|
#
|
2015-09-14 15:17:06 -04:00
|
|
|
# eval set -- "$palette"
|
|
|
|
# palette=$(eval echo $(eval echo $(printf "\\$\{\$(expr %s \* $count / $battery_symbol_count)\} " $(seq 1 $battery_symbol_count))))
|
2015-03-28 05:17:43 -04:00
|
|
|
#
|
2015-10-11 11:53:19 -04:00
|
|
|
# full=$(printf %.0f $(awk "BEGIN{print $charge * $battery_symbol_count}"))
|
2015-03-28 05:17:43 -04:00
|
|
|
# printf '#[bg=%s]' $battery_bg
|
|
|
|
# [ $full -gt 0 ] && \
|
2015-09-14 15:17:06 -04:00
|
|
|
# printf "#[fg=colour%s]$battery_symbol_full" $(echo $palette | cut -d' ' -f1-$full)
|
2015-03-28 05:17:43 -04:00
|
|
|
# empty=$(($battery_symbol_count - $full))
|
|
|
|
# if [ x"$battery_symbol" = x"heart" ]; then
|
|
|
|
# [ $empty -gt 0 ] && \
|
|
|
|
# printf '#[fg=%s]' $battery_bg && \
|
|
|
|
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
|
|
|
|
# else
|
|
|
|
# [ $empty -gt 0 ] && \
|
2015-09-14 15:17:06 -04:00
|
|
|
# printf "#[fg=colour%s]$battery_symbol_empty" $(echo $palette | cut -d' ' -f$((full+1))-$(($full + $empty)))
|
2015-03-28 05:17:43 -04:00
|
|
|
# fi
|
2015-10-22 15:37:44 -04:00
|
|
|
# elif echo $battery_palette | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then
|
|
|
|
# battery_full_fg=$(echo $battery_palette | cut -d, -f1)
|
|
|
|
# battery_empty_fg=$(echo $battery_palette | cut -d, -f2)
|
|
|
|
# battery_bg=$(echo $battery_palette | cut -d, -f3)
|
|
|
|
#
|
|
|
|
# full=$(printf %.0f $(awk "BEGIN{print $charge * $battery_symbol_count}"))
|
|
|
|
# [ $full -gt 0 ] && \
|
|
|
|
# printf '#[fg=%s,bg=%s]' $battery_full_fg $battery_bg && \
|
|
|
|
# printf "%0.s$battery_symbol_full" $(seq 1 $full)
|
|
|
|
# empty=$(($battery_symbol_count - $full))
|
|
|
|
# [ $empty -gt 0 ] && \
|
|
|
|
# printf '#[fg=%s,bg=%s]' $battery_empty_fg $battery_bg && \
|
|
|
|
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
|
2015-03-28 05:17:43 -04:00
|
|
|
# fi
|
2014-02-15 12:39:11 -05:00
|
|
|
# }
|
|
|
|
#
|
2014-12-13 07:09:21 -05:00
|
|
|
# apply_configurable_bindings() {
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_new_windows_retain_current_path=${tmux_conf_new_windows_retain_current_path:-false}
|
|
|
|
# if [ x"$tmux_conf_new_windows_retain_current_path" = x"true" ] || [ x"$tmux_conf_new_windows_retain_current_path" = x"1" ] ; then
|
2014-12-13 07:09:21 -05:00
|
|
|
# tmux bind c new-window -c '#{pane_current_path}'
|
|
|
|
# else
|
|
|
|
# tmux bind c new-window
|
|
|
|
# fi
|
|
|
|
#
|
2015-10-22 15:37:44 -04:00
|
|
|
# tmux_conf_new_panes_retain_current_path=${tmux_conf_new_panes_retain_current_path:-true}
|
|
|
|
# if [ x"$tmux_conf_new_panes_retain_current_path" = x"true" ] || [ x"$tmux_conf_new_panes_retain_current_path" = x"1" ] ; then
|
2015-10-13 05:29:05 -04:00
|
|
|
# tmux bind '"' split-window -v -c "#{pane_current_path}" \;\
|
|
|
|
# bind % split-window -h -c "#{pane_current_path}" \;\
|
|
|
|
# bind - split-window -v -c "#{pane_current_path}" \;\
|
|
|
|
# bind _ split-window -h -c "#{pane_current_path}"
|
2014-12-13 07:09:21 -05:00
|
|
|
# else
|
2015-10-13 05:29:05 -04:00
|
|
|
# tmux bind '"' split-window -v \;\
|
|
|
|
# bind % split-window -h \;\
|
|
|
|
# bind - split-window -v \;\
|
|
|
|
# bind _ split-window -h
|
2014-12-13 07:09:21 -05:00
|
|
|
# fi
|
2015-10-23 16:15:43 -04:00
|
|
|
#
|
|
|
|
# tmux_conf_new_session_prompt=${tmux_conf_new_session_prompt:-false}
|
|
|
|
# if [ x"$tmux_conf_new_session_prompt" = x"true" ] || [ x"$tmux_conf_new_session_prompt" = x"1" ] ; then
|
|
|
|
# tmux bind C-c command-prompt -p new-session 'new-session -s %%'
|
|
|
|
# else
|
|
|
|
# tmux bind C-c new-session
|
|
|
|
# fi
|
2014-12-13 07:09:21 -05:00
|
|
|
# }
|
|
|
|
#
|
2015-11-02 05:04:46 -05:00
|
|
|
# apply_configuration() {
|
|
|
|
# apply_theme
|
|
|
|
# apply_configurable_bindings
|
|
|
|
# for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $name; done;
|
|
|
|
# }
|
|
|
|
#
|
2015-07-24 16:25:37 -04:00
|
|
|
# urlview() {
|
|
|
|
# tmux capture-pane -J -S - -E - -b urlview-$1 -t $1
|
|
|
|
# tmux split-window "(tmux show-buffer -b urlview-$1 | urlview || true); tmux delete-buffer -b urlview-$1"
|
|
|
|
# }
|
|
|
|
#
|
2015-07-24 16:25:55 -04:00
|
|
|
# fpp() {
|
|
|
|
# tmux capture-pane -J -S - -E - -b fpp-$1 -t $1
|
|
|
|
# tmux split-window "(tmux show-buffer -b fpp-$1 | fpp || true); tmux delete-buffer -b fpp-$1"
|
|
|
|
# }
|
2015-11-02 05:04:46 -05:00
|
|
|
#
|
2012-07-23 04:25:24 -04:00
|
|
|
# $@
|