Skip to content

Instantly share code, notes, and snippets.

@justin808
Last active January 12, 2022 19:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save justin808/9493723 to your computer and use it in GitHub Desktop.
Save justin808/9493723 to your computer and use it in GitHub Desktop.
My tmux conf file for tmux 1.9a
set-option -g default-shell /bin/zsh
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
# http://brentvatne.github.com/tmux-copy-paste/
# this next command takes the current buffer and puts it on the OS clipboard
#bind Y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
#
# I don't understand why the next would be useful
# bind P run "tmux paste-buffer"
bind y copy-mode
# unbind p
# bind p paste-buffer
# Use vim keybindings in copy mode
setw -g mode-keys vi
set -g default-terminal "screen-256color"
set-window-option -g window-status-current-bg blue
# With automatic renaming, tmuxinator names get overriden
# set-window-option -g automatic-rename on
set-window-option -g allow-rename off
set-option -g status-keys vi
set-option -g history-limit 100000
#set-option -g base-index 1
set-option -s escape-time 0
# Mouse mode messes up copying text
#setw -g mode-mouse off
#set-option -g mouse-select-pane off
# We won't worry about sending C-\ to any programs
# bind-key C-\ send-prefix
# hit C-\ twice to go to last window
# C-\ doesn't work on mac os, so use screen's C-a
bind-key a send-prefix
bind-key b set-option status
# C-b is not acceptable, due to emacs, bash, and vim
unbind-key C-b
set-option -g prefix C-a
bind-key / command-prompt "split-window 'exec man %%'"
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
bind-key -r C-a select-window -t :+
bind-key a last-window
# 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
# resize panes like vim
bind < resize-pane -L 10
bind > resize-pane -R 10
bind - resize-pane -D 10
bind + resize-pane -U 10
# setw -g aggressive-resize on
bind-key t swap-window -t 0
bind-key T command-prompt "swap-window -t %%"
# https://github.com/tangledhelix/dotfiles/blob/master/tmux.conf
# Watch for activity in background windows
setw -g monitor-activity on
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
bind-key ^C new-window
bind-key ^V split-window -h
bind-key ^S split-window
# Vim-style copy/paste
bind -t vi-copy H start-of-line
bind -t vi-copy L end-of-line
bind -t vi-copy Escape cancel
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# set first window to index 1 (not 0) to map more to the keyboard layout...
# set -g base-index 1
# + and - "zoom" and "unzoom" a pane.
# + breaks a pane out to its own window
# - restores a broken-out pane to being a pane
unbind +
bind + \
new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \;\
swap-pane -s tmux-zoom.0 \;\
select-window -t tmux-zoom
unbind -
bind - \
last-window \;\
swap-pane -s tmux-zoom.0 \;\
kill-window -t tmux-zoom
# reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
# Toggle mouse on
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# pass through xterm keys
set -g xterm-keys on
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T' # window number,program name, active(or not)
# http://stackoverflow.com/questions/10543684/how-can-i-clear-scrollback-buffer-in-tmux
# bind-key C clear-history
bind-key C send-keys -R \; clear-history
bind-key K send-keys "clear && tmux clear-history" \; send-keys "Enter"
@abaj8494
Copy link

thanks for this mate.

@justin808
Copy link
Author

@br1ttle, this is really old. Feel free to make suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment