Skip to content

Instantly share code, notes, and snippets.

@alexandreab
Last active March 30, 2020 13:34
Show Gist options
  • Save alexandreab/215c3bfafa5b701d973a to your computer and use it in GitHub Desktop.
Save alexandreab/215c3bfafa5b701d973a to your computer and use it in GitHub Desktop.
Personal tmux settings
set-option -g assume-paste-time 1
set-option -g base-index 1
set -g pane-base-index 1
set-option -g bell-action any
set-option -g default-command ""
set-option -g default-shell "/bin/bash"
set-option -g default-terminal "screen"
set-option -g destroy-unattached off
# Modified
# Don't detach completely when a session is destroyed; instead switch to the next session.
set-option -g detach-on-destroy on
set-option -g display-panes-active-colour red
set-option -g display-panes-colour blue
set-option -g display-panes-time 1000
set-option -g display-time 750
set-option -g history-limit 5000
set-option -g lock-after-time 0
set-option -g lock-command vlock
set-option -g message-style bg=yellow,fg=black
set-option -g message-command-style bg=yellow,fg=black
set-option -g message-limit 20
set-option -g prefix C-b
set-option -g prefix2 C-B
# Modified
# Renumber the remaining windows when one is destroyed. Means the windows are always 1-n.
set-option -g renumber-windows on
set-option -g repeat-time 500
set-option -g set-titles on
set-option -g set-titles-string "#S:#I:#W - "#T""
set-option -g status on
set-option -g status-bg green
set-option -g status-fg black
set-option -g status-interval 15
set-option -g status-justify left
set-option -g status-keys emacs
set-option -g status-left "[#S]"
set-option -g status-left-length 10
set-option -g status-position bottom
set-option -g status-right ""#22T" %H:%M %d-%b-%y"
set-window-option -g status-right "#[fg=black,bright,fill=colour232]#(date)"
set-window-option -g status-style fg=black,bg=green
set-window-option -g window-status-current-style bg=blue,fg=white
set-option -g status-right-length 40
set-option -g terminal-overrides "*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E[%p1%d q:Csr=\E[2 q,screen*:XT"
set-option -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-option -g word-separators " -_@"
set-option -g history-limit 3000
# $Id: vim-keys.conf,v 1.2 2010-09-18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v -c '#{pane_current_path}'
bind v split-window -h -c '#{pane_current_path}'
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# swap around panes with HJKL
#bind H swap-pane -L
bind J swap-pane -D
bind K swap-pane -U
#bind L swap-pane -R
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 5
bind > resize-pane -R 5
bind - resize-pane -D 5
bind + resize-pane -U 5
# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt
# vi-style controls for copy mode
setw -g mode-keys vi
# See if this fixes slow ESC issues.
# http://unix.stackexchange.com/questions/23138/esc-key-causes-a-small-delay-in-terminal-due-to-its-alt-behavior
set -s escape-time 0
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi Y send-keys -X copy-end-of-line # ^1
# List Sessions
bind-key S list-sessions
# To vim work correctly
set-option -gw xterm-keys on
set-window-option -g xterm-keys on
set-option -g default-terminal "xterm-256color"
bind-key -n C-Left send-keys C-Left
# Example of using a shell command in the status line
# Highlight active window
set-window-option -g pane-active-border-style fg=brightred,bg=default
# Scrolling with mouse
# Syncronize panes
bind m setw synchronize-panes
# Layout of panes
bind 1 setw select-layout even-horizontal
bind 2 setw select-layout even-vertical
bind 3 setw select-layout main-horizontal
bind 4 setw select-layout main-vertical
bind 5 setw select-layout tiled
# Split and new windows in current path
bind-key c new-window -c '#{pane_current_path}'
bind-key '"' split-window -c '#{pane_current_path}'
bind-key % split-window -h -c '#{pane_current_path}'
# ctrl+left/right cycles thru windows
bind-key r refresh-client
# listen for activity on all windows
set -g bell-action any
# Locksession Shortcut
bind L lock-session
# Loggin session
# bind-key H pipe-pane -o "exec cat >>$HOME/.config/tmux/'#W-tmux.log'" \; display-message 'Toggled logging to $HOME/.config/tmux/#W-tmux.log'
bind r clear-history
bind e send-keys "clear"\; send-keys "Enter"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment