coloful tabs

This commit is contained in:
Uwe Werler 2020-07-21 09:03:45 +00:00
parent 5718f09924
commit 0f1a93bad9
3 changed files with 61 additions and 10 deletions

View File

@ -2,30 +2,43 @@ set -g prefix C-g
# needed for e.g. mutt # needed for e.g. mutt
bind C-g send-prefix bind C-g send-prefix
set -g set-titles on #set -g set-titles on
set -g status-position top set -g status-position top
set -g status-keys vi set -g status-keys vi
set -g mode-keys vi set -g mode-keys vi
set -g base-index 1 set -g base-index 1
set -g pane-base-index 1 set -g pane-base-index 1
set -g focus-events on set -g focus-events on
#set -g allow-rename off
#set-option -g allow-rename off
setw -g automatic-rename off
set -g automatic-rename off
setw -g allow-rename off
set -g allow-rename off
set history-file ~/.tmux_SSH_history set history-file ~/.tmux_SSH_history
set focus-events on
set -g history-limit 100000 set -g history-limit 100000
set -s set-clipboard on set -s set-clipboard on
set -g display-time 3000 set -g display-time 3000
set -g display-panes-time 3000 set -g display-panes-time 3000
set -g pane-border-status top #set -g pane-border-status top
setw -g window-status-current-style bg=colour240,fg=colour250 setw -g window-status-current-style bg=colour240,fg=colour250
setw -g window-status-separator "|" setw -g window-status-separator "|"
set -g status-bg colour235 set -g status-bg colour235
set -g status-fg colour245 set -g status-fg colour245
set -g window-status-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }" set -g window-status-format " #I #{p15:pane_title} #{p2:window_flags}"
set -g window-status-current-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }" setw -g automatic-rename-format " #I #{p15:pane_title} #{p2:window_flags}"
set -g window-status-current-format " #I #{p15:pane_title} #{p2:window_flags}"
#set -g window-status-format " #I #{p15:pane_title} #{p2:?window_flags, #{window_flags}, }"
#setw -g automatic-rename-format " #I #{p15:pane_title} #{p2:?window_flags, #{window_flags}, }"
#set -g window-status-current-format " #I #{p15:pane_title} #{p2:?window_flags, #{window_flags}, }"
#set -g window-status-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }"
#setw -g automatic-rename-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }"
#set -g window-status-current-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }"
set -g pane-border-format " #P: #{s/ //:pane_title} " set -g pane-border-format " #P: #{s/ //:pane_title} "
set -g renumber-windows on set -g renumber-windows on
@ -39,7 +52,7 @@ set -g status-left-length 0
set -g status-left "" set -g status-left ""
# some settings for "navigation" # some settings for "navigation"
bind -n C-PageUp copy-mode -u bind -n C-PageUp copy-mode
unbind -n C-Left unbind -n C-Left
unbind -n C-Right unbind -n C-Right
bind -n C-Left select-window -t :- bind -n C-Left select-window -t :-
@ -56,3 +69,16 @@ bind F6 join-pane -s 6.\; select-layout tiled
bind F7 join-pane -s 7.\; select-layout tiled bind F7 join-pane -s 7.\; select-layout tiled
bind F8 join-pane -s 8.\; select-layout tiled bind F8 join-pane -s 8.\; select-layout tiled
bind F9 join-pane -s 9.\; select-layout tiled bind F9 join-pane -s 9.\; select-layout tiled
bind -n S-Down select-pane -D
bind -n S-Up select-pane -U
bind -n S-Left select-pane -L
bind -n S-Right select-pane -R
bind-key -n C-S-Left "swap-window -t -1; select-window -t 1"
bind-key -n C-S-Right "swap-window -t +1; select-window -t +1"
bind p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
bind -n C-v run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'

View File

@ -3,6 +3,9 @@
fw* fg=green #comment fw* fg=green #comment
*dev* fg=cyan *dev* fg=cyan
*prod* fg=red *prod* fg=red
*dmz* fg=red,bg=blue
*backup* fg=blue *backup* fg=blue
*admin* fg=magenta *admin* fg=magenta
*auth* fg=red
*work* fg=red
#* fg=white #* fg=white

30
ssh.sh
View File

@ -111,7 +111,7 @@ _readstyle() {
_setpane(){ _setpane(){
local _paneid=${1} _title=${2} _style local _paneid=${1} _title=${2}
_readstyle _readstyle
@ -119,16 +119,34 @@ _setpane(){
[[ -z ${_title} ]] && _title=$(hostname -s) [[ -z ${_title} ]] && _title=$(hostname -s)
$_tmux select-pane -T "$(printf %-${_tabw}.${_tabw}s ${_title})" -t ${_paneid} # $_tmux select-pane -T "$(printf %-${_tabw}.${_tabw}s ${_title})" -t ${_paneid}
$_tmux select-pane -T "${_title}" -t ${_paneid}
if [[ -n ${_oldstyle} ]]; then if [[ -n ${_oldstyle} ]]; then
$_tmux select-pane -P ${_oldstyle} -t ${_paneid} $_tmux select-pane -P ${_oldstyle} -t ${_paneid}
#$_tmux setw window-status-style ${_oldstyle}
#$_tmux setw window-status-current-style ${_oldstyle}
elif [[ -n ${_style} ]]; then elif [[ -n ${_style} ]]; then
$_tmux select-pane -P $_style -t ${_paneid} $_tmux select-pane -P $_style -t ${_paneid}
#$_tmux setw window-status-style $_style
#$_tmux setw window-status-style $_style
#$_tmux setw window-status-current-style $_style
fi fi
_pstyle=$($_tmux select-pane -g)
_fg=${_pstyle##*fg=}
_fg=${_fg%%,*}
#$_tmux setw window-status-style fg=${_fg},bg=colour235,reverse
#$_tmux setw window-status-style "bg=${_fg},fg=colour255"
#$_tmux setw window-status-current-style "reverse,bold"
$_tmux setw window-status-style "fg=${_fg}"
$_tmux setw window-status-current-style "fg=${_fg},bg=colour240"
} }
_ssh() { _ssh() {
@ -173,15 +191,19 @@ _ssh() {
_paneid=$($_tmux -f $_ssh_config new-session -d -P -F '#D' -s ${_sess} ${_cmd}) || exit _paneid=$($_tmux -f $_ssh_config new-session -d -P -F '#D' -s ${_sess} ${_cmd}) || exit
# add some settings into the session environment # add some settings into the session environment
$_tmux set-environment -g -t ${_sess} CMD "${SHELL} $0 -r \#D \#h \#T" #$_tmux set-environment -g -t ${_sess} CMD "${SHELL} $0 -r \#D \#h \#T"
$_tmux set-environment -g -t ${_sess} CMD "${SHELL} $0 -r \#D \#T"
$_tmux set-hook -g -t ${_sess} after-new-window "run \$CMD" $_tmux set-hook -g -t ${_sess} after-new-window "run \$CMD"
$_tmux set-hook -g -t ${_sess} after-split-window "run \$CMD" $_tmux set-hook -g -t ${_sess} after-split-window "run \$CMD"
$_tmux bind R source-file $_ssh_config \\\; display-message "source-file done" $_tmux set-hook -g -t ${_sess} pane-focus-in "run \$CMD"
$_tmux bind r source-file $_ssh_config \\\; display-message "source-file done"
_setpane ${_paneid} ${_host} _setpane ${_paneid} ${_host}
xterm -title ${_sess} -name ${_sess} -e \ xterm -title ${_sess} -name ${_sess} -e \
$_tmux attach -t ${_sess} 2>/dev/null & $_tmux attach -t ${_sess} 2>/dev/null &
#"xdotool key ctrl+alt+m; $_tmux attach -t ${_sess} 2>/dev/null" &
type xdotool && sleep 0.2 && xdotool key ctrl+alt+m
fi fi
} }