1
0
mirror of https://github.com/gryf/vmstrap.git synced 2025-12-18 12:00:31 +01:00

Differentiate tmux config between the versions.

This commit is contained in:
2021-01-20 15:47:02 +01:00
parent cc1b336d04
commit e7e25fec8a
2 changed files with 51 additions and 9 deletions

View File

@@ -19,8 +19,6 @@ set -g pane-base-index 1
# don't rename my tabs
set -g allow-rename off
# renumber windows when a window is closed
set -g renumber-windows on
#bind-key r source-file ~/.tmux.conf \; display "Config reloaded!"
@@ -81,5 +79,3 @@ bind-key + resize-pane -U 3
# vi-style controls for copy mode
set-window-option -g mode-keys vi
# v and y like vi in copy-mode

View File

@@ -203,21 +203,67 @@ ubuntu() {
common_conf
}
common_conf() {
cp .bash_prompt ~/
cp .tmux.conf ~/
# v and y like vi in copy-mode
if [[ $DISTRO_ID == 'centos' ]]; then
tmux_conf() {
tmux_ver=$(tmux -V|cut -f 2 -d ' ')
major=${tmux_ver%.*}
minor=${tmux_ver#*.}
# some colors
if [[ $major -lt 3 ]]; then
{
# tmux < 3.x
echo "setw -g window-status-current-bg colour8"
echo "setw -g window-status-current-fg colour15"
echo "setw -g window-status-current-attr bold"
echo "set -g pane-active-border-bg default"
echo "set -g pane-active-border-fg brightyellow"
echo "set -g pane-border-fg green"
echo "set -g message-fg white"
echo "set -g message-bg black"
} >> ~/.tmux.conf
else
{
echo 'setw -g window-status-current-style "bg=colour8'`
`'fg=colour15 bold"'
echo "set -g pane-border-style fg=green"
echo 'set -g pane-active-border-style "bg=default fg=brightyellow"'
echo 'set -g message-style "fg=white bg=black"'
} >> ~/.tmux.conf
fi
if [[ ! ( $major == 1 && $minor -le 6 ) ]]; then
{
echo ""
echo "# renumber windows when a window is closed"
echo "set -g renumber-windows on"
} >> ~/.tmux.conf
fi
# vi-like selection
if [[ $major -eq 1 || $major -eq 2 && $minor -lt 6 ]]; then
{
# tmux ~ 1.6/1.7/1.8/<2.6
echo
echo "# v and y like vi in copy-mode"
echo "bind -t vi-copy 'v' begin-selection"
echo "bind -t vi-copy 'y' copy-selection"
} >> ~/.tmux.conf
else
{
# tmux >= 2.6
echo
echo "# v and y like vi in copy-mode"
echo "bind-key -T copy-mode-vi 'v' send -X begin-selection"
echo "bind-key -T copy-mode-vi 'y' send -X copy-selection"
} >> ~/.tmux.conf
fi
}
common_conf() {
cp .bash_prompt ~/
cp .tmux.conf ~/
tmux_conf
cp .gitconfig ~/
cp cleanup.sh ~/
{