Skip to content

Instantly share code, notes, and snippets.

@medihack
Last active April 28, 2021 11:01
Show Gist options
  • Save medihack/41494be79c87a381252b09c01423ab82 to your computer and use it in GitHub Desktop.
Save medihack/41494be79c87a381252b09c01423ab82 to your computer and use it in GitHub Desktop.
For tmux version 3.x
# C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
setw -g xterm-keys on
# Fix colors tmux + vim
# if this still does not work then put this in your .bashrc:
# alias tmux='tmux -2'
set -g default-terminal "screen-256color"
# Start window numbering at 1
set -g base-index 1
# automatically renumber window numbers on closing a pane (tmux >= 1.7)
set -g renumber-windows on
# Allows for faster key repetition
set -s escape-time 0
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left ""
set -g status-right "#[fg=yellow]Session:#S Host:#H"
# To make autoreloading of files in Vim work
# See https://unix.stackexchange.com/a/383044
set -g focus-events on
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
# Allows us to use C-a a <command> to send commands to a TMUX session inside
# another TMUX session
bind-key a send-prefix
# Activity monitoring
#setw -g monitor-activity on
#set -g visual-activity on
# increase history
set -g history-limit 262144
# Example of using a shell command in the status line
#set -g status-right "#[fg=yellow]#(uptime | cut -d ',' -f 2-)"
# Highlight active window
set-window-option -g window-status-current-style bg=red
# Search like in Vim
setw -g mode-keys vi
# increase repeate time (-r option) a bit
set -g repeat-time 800
# allow mouse
set -g mouse on
# double prefix switch to last window
unbind-key C-a
bind-key C-a last-window
# Split a more like vim
unbind-key s
bind-key s split-window -v
unbind-key v
bind-key v split-window -h
# Navigate panes like in Vim
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
# Resize panes in a similar way
unbind-key C-j
bind-key -r C-j resize-pane -D
unbind-key C-k
bind-key -r C-k resize-pane -U
unbind-key C-h
bind-key -r C-h resize-pane -L
unbind-key C-l
bind-key -r C-l resize-pane -R
# reorder windows
unbind-key Left
bind-key Left swap-window -t -1
unbind-key Right
bind-key Right swap-window -t +1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment