Tmux

Published 01-01-0001 00:00:00

Installing Tmux on Gentoo / Calculate

Tmux

**Requirement: powerline**

Unmask the latest version

  • For Gentoo Linux
sudo echo "=app-misc/tmux-2.6 ~amd64" >> /etc/portage/package.accept_keywords
  • For Calculate Linux
sudo echo "=app-misc/tmux-2.6 ~amd64" >> /etc/portage/package.keywords/custom

Install the latest version

sudo emerge -av "=app-misc/tmux-2.6"

Creating folders

mkdir -p ~/.dotfiles/tmux/{plugins,scripts,sessions}

Settings in file ~/.dotfiles/tmux/config.tmux

echo -e "source ~/.dotfiles/tmux/base.tmux \nsource ~/.dotfiles/tmux/binds.tmux \nsource ~/.dotfiles/tmux/plugins.tmux" > ~/.dotfiles/tmux/config.tmux

Settings in file ~/.dotfiles/tmux/base.tmux

set -g default-command /bin/zsh
set -g default-shell /bin/zsh
set -g default-terminal "screen-256color"
set -g bell-action any
set -g bell-on-alert on
set -g history-limit 30000
set -g base-index 1
set -g renumber-windows on
set -g escape-time 0
setw -g pane-base-index 1
setw -g aggressive-resize on
set -g mouse on
set -g set-titles on
set -g set-titles-string 'tmux: #{pane_current_command}'
set -g status-position bottom
set -g visual-activity on
set -g visual-bell off
set -g display-time 4000
set -g allow-rename off
setw -g xterm-keys on
setw -g monitor-activity off
setw -g automatic-rename off
setw -g alternate-screen on
setw -g main-pane-width 100

Settings in file ~/.dotfiles/tmux/binds.tmux

unbind r
bind r source-file ~/.dotfiles/tmux/config.tmux \; display "Configuration reloaded."
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v
unbind -n M-Left
unbind -n M-Right
unbind -n M-Up
unbind -n M-Down
bind -n C-Left select-pane -L
bind -n C-Right select-pane -R
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D
bind-key k confirm kill-window
bind-key K confirm kill-server

Settings in file ~/.dotfiles/tmux/plugins.tmux

set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.dotfiles/tmux/plugins/'

# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'https://git.kronoz.guru/nord-tmux'

if "test ! -d ~/.dotfiles/tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.dotfiles/tmux/plugins/tpm && ~/.dotfiles/tmux/plugins/tpm/bin/install_plugins'"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.dotfiles/tmux/plugins/tpm/tpm'

Uptime’s script ~/.dotfiles/tmux/scripts/uptime.sh

echo -e '#!/bin/sh \nuptime | cut -f 4-5 -d " " | cut -f 1 -d ","' > ~/.dotfiles/tmux/scripts/uptime.sh

Session’s script ~/.dotfiles/tmux/sessions/remote.tmux

#!/bin/bash

CFG="~/.dotfiles/tmux/config.tmux"

SESSION="remote"

cd $HOME

tmux has -t ${SESSION}

if [ $? != 0 ]

then

tmux -f ${CFG} new -s ${SESSION} -n host-machine -d
tmux splitw -h -p 50 -t ${SESSION}:1.1
tmux neww -n database -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:2.1
tmux neww -n web -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:3.1
tmux neww -n dev -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:4.1
tmux neww -n cloud -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:5.1
tmux neww -n im -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:6.1
tmux neww -n proxy -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:7.1
tmux neww -n games -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:8.1
tmux neww -n router -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:9.1
tmux neww -n omega -t ${SESSION}
tmux splitw -h -p 50 -t ${SESSION}:10.1
tmux selectw -t ${SESSION}:1.1

fi

tmux attach -t ${SESSION}