Files
dotfiles/.tmux.conf
T
2020-05-05 17:17:24 +03:00

170 lines
4.2 KiB
Bash
Executable File

# ------------------
# General Settings
# ------------------
# See: https://github.com/gpakosz/.tmux/blob/master/.tmux.conf
# Set Custom Prefix
set -g prefix C-a
unbind C-b
# Start in newer bash
set-option -g default-command "/usr/local/bin/bash --login"
# Disable delay
set -sg escape-time 1
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
# -------------------
# Visual Settings
# -------------------
set -g default-terminal "screen-256color"
# Theme Variables
TMUX_ACTIVE_COLOR="#3e999f"
TMUX_PANE_BORDER_FG="#d6d6d6"
TMUX_PANE_ACTIVE_BORDER_FG=$TMUX_ACTIVE_COLOR
TMUX_MESSAGE_FG=$TMUX_ACTIVE_COLOR
TMUX_MESSAGE_BG="#d6d6d6"
TMUX_STATUS_TEXT_COLOR="#efefef"
TMUX_STATUS_BG="#26292c"
TMUX_PANE_BG=$TMUX_STATUS_TEXT_COLOR
TMUX_NAMESPACE_FG=$TMUX_STATUS_TEXT_COLOR
TMUX_STATUS_RED="#c82829"
TMUX_USERNAME_FG=$TMUX_STATUS_TEXT_COLOR
TMUX_STATUS_ORANGE="#f5871f"
# Pane borders
set -g pane-border-style "fg=$TMUX_PANE_BORDER_FG"
set -g pane-active-border-style "fg=$TMUX_PANE_ACTIVE_BORDER_FG"
# Styles
STYLE_DEFAULT="fg=white,bg=$TMUX_STATUS_BG"
STYLE_ACTIVE_ITEM="fg=$TMUX_STATUS_TEXT_COLOR,bg=$TMUX_ACTIVE_COLOR,noreverse,bold"
STYLE_RED="fg=$TMUX_NAMESPACE_FG,bg=$TMUX_STATUS_RED,bold"
STYLE_ORANGE="fg=$TMUX_USERNAME_FG,bg=$TMUX_STATUS_ORANGE,bold"
# Message in status bar (e.g. Copied successfully)
# set -g message-style "fg=$TMUX_STATUS_TEXT_COLOR,bg=$TMUX_MESSAGE_BG"
# Status bar
set-option -g status-position bottom
# Status mid style
set -g status-style $STYLE_DEFAULT
set -g status-left "#{prefix_highlight}#[$STYLE_RED] #S #[fg=$TMUX_STATUS_RED,bg=$TMUX_STATUS_ORANGE,bold]#[$STYLE_ORANGE] #(whoami) #[fg=$TMUX_STATUS_ORANGE,bg=$TMUX_STATUS_BG,bold] "
set -g status-left-length 30
PC_STATS="#[$STYLE_ACTIVE_ITEM] cpu #{cpu_icon} #{cpu_percentage} #[$STYLE_DEFAULT] #[$STYLE_ACTIVE_ITEM] mem #{ram_icon} #{ram_percentage} #[$STYLE_DEFAULT]"
set -g status-right "$PC_STATS #[fg=$TMUX_STATUS_ORANGE,bg=$TMUX_STATUS_BG,bold]#[$STYLE_ORANGE] #H #[fg=$TMUX_STATUS_RED,bg=$TMUX_STATUS_ORANGE,bold]#[$STYLE_RED] %a, %h %d %H:%M "
set -g status-right-length 90
# window name options
set -g window-status-format "#[$STATUS_DEFAILT] #I #W "
set -g window-status-current-format "#[$STYLE_ACTIVE_ITEM] #I #W "
# Prefix style
# https://github.com/tmux-plugins/tmux-prefix-highlight
set -g @prefix_highlight_fg $TMUX_STATUS_TEXT_COLOR
set -g @prefix_highlight_bg $TMUX_ACTIVE_COLOR
# --------------------
# Custom keybindings
# --------------------
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
setw -g mode-keys vi
bind C-a send-prefix
# Unbind unused defaults
unbind %
unbind [
unbind p
unbind Up
unbind Down
unbind Left
unbind Right
unbind M-Up
unbind M-Down
unbind M-Left
unbind M-Right
unbind C-Up
unbind C-Down
unbind C-Left
unbind C-Right
# Source this file
bind r source-file ~/.tmux.conf \; display "Config file reloaded!"
# split current window horizontally
bind v split-window -h
bind | split-window -h
# split current window vertically
bind s split-window -v
bind - split-window -v
# Swap panes
bind-key -r "<" swap-window -d -t -1
bind-key -r ">" swap-window -d -t +1
bind-key -r n swap-pane -U
# Move between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Move between windows
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# Resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Copy & Paste
bind Escape copy-mode
bind b list-buffers # list paste buffers
bind p paste-buffer # paste last buffer
bind P choose-buffer # see all buffers
bind C-c run-shell "bash -c 'tmux show-buffer | pbcopy'" \; display 'Copied to clipboard'
# Tmux Plugin manager
# https://github.com/tmux-plugins/tpm
# Enabled plugins
# install prefix I
# update prefix u
# uninstall all prefix alt u
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
run -b '~/.tmux/plugins/tpm/tpm'