Last active
August 22, 2023 15:33
-
-
Save subfuzion/814b3360e9f0b2d89c08 to your computer and use it in GitHub Desktop.
My .tmux.conf for tmux 2.1 (with fixes for mouse breakage)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspirations: | |
# http://mutelight.org/practical-tmux | |
# http://zanshin.net/2013/09/05/my-tmux-configuration/ | |
# http://files.floriancrouzat.net/dotfiles/.tmux.conf | |
# http://stackoverflow.com/questions/9628435/tmux-status-bar-configuration | |
# https://github.com/Lokaltog/powerline | |
# https://github.com/remiprev/teamocil | |
# http://superuser.com/questions/74492/whats-the-best-prefix-escape-sequence-for-screen-or-tmux | |
# http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2/ | |
# | |
set -g default-terminal "screen-256color" | |
# ***WARNING!*** tmux will exit immediately if this plugin is not installed!!! | |
# http://superuser.com/questions/397076/tmux-exits-with-exited-on-mac-os-x | |
# set-option -g default-command "reattach-to-user-namespace -l $SHELL" | |
# change default prefix (C-b) to C-space | |
unbind C-space | |
set -g prefix C-space | |
bind C-space send-prefix | |
#unbind C-k | |
#set -g prefix C-k | |
#bind C-k send-prefix | |
# start numbering from 0 instead of 1 | |
set -g base-index 0 | |
setw -g pane-base-index 0 | |
# bind C-a C-a to last active window | |
bind-key C-a last-window | |
# get rid of delay reading command characters while tmux waits for escape sequence | |
set -s escape-time 1 | |
# reload ~/.tmux.conf using prefix r | |
bind r source-file ~/.tmux.conf \; display "tmux reloaded" | |
# change split prefixes (horizontal: C-space /) (vertical: C-space -) | |
bind / split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
# make current window the 1st window | |
bind T swap-window -t 1 | |
# set scrollback history to 10K lines | |
set -g history-limit 10000 | |
# mouse support | |
#setw -g mode-mouse on | |
set -g mouse on | |
# https://github.com/tmux/tmux/issues/145#issuecomment-151098708 | |
#bind -n WheelUpPane if-shell -F -T = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e; send-keys -M'" | |
# https://github.com/tmux/tmux/issues/145#issuecomment-151123624 | |
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind -n WheelDownPane select-pane -t= \; send-keys -M | |
# vi | |
# == | |
setw -g mode-keys vi | |
set -g status-keys vi | |
# setup 'v' to begin selection as in vim | |
#bind-key -T vi-copy v begin-selection | |
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection | |
#bind-key -T vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection | |
# update default binding of `Enter` to also use copy-pipe (os x) | |
#unbind -T vi-copy Enter | |
unbind -T copy-mode-vi 'Enter' | |
#bind-key -T vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
bind-key -T copy-mode-vi 'Enter' send-keys -X copy-selection | |
# map vi movement keys as pane movement keys | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# use vi left and right to cycle thru panes | |
bind -r C-h select-window -t :- | |
bind -r C-l select-window -t :+ | |
# resize panes using vi keys | |
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 | |
# status bar | |
# ========== | |
# set status bar | |
#set -g status-justify centre | |
set -g status-justify left | |
#set -g status-left "" | |
#set -g status-right "#[fg=green]#H" | |
# dark theme | |
#set -g status-bg "#101010" | |
#set -g status-fg "#005000" | |
# light theme | |
#set -g status-bg "#222222" | |
set -g status-bg "#303030" | |
set -g status-fg "#009000" | |
# show host name and IP address on left side of status bar | |
# set -g status-left-length 70 | |
# informational (but takes room) | |
# set -g status-left "#h #(curl -4 https://icanhazip.com) #(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') " | |
# show session name, window & pane number, date and time on right | |
# of status bar | |
#set -g status-right-length 60 | |
# set -g status-right "#S #I:#P %d %b %Y %l:%M %p (#(date -u | awk '{print $4}' | cut -c1-5))" | |
set -g status-right "" | |
set-option -g set-titles on | |
# Highlight active window | |
setw -g window-status-current-style fg=black | |
setw -g window-status-current-style fg=green | |
# quiet! | |
# http://unix.stackexchange.com/questions/169992/why-are-my-windows-highlighted-when-i-first-open-tmux | |
setw -g monitor-activity off | |
set -g monitor-silence 0 | |
set -g bell-action none | |
set -g visual-activity off | |
set -g visual-bell off | |
set -g visual-silence off | |
set -g bell-action none |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment