Skip to content

Instantly share code, notes, and snippets.

@schlomok
Forked from napcs/.tmux.clipboard
Last active January 13, 2016 23:48
Show Gist options
  • Save schlomok/500f4010004da7a5ae0c to your computer and use it in GitHub Desktop.
Save schlomok/500f4010004da7a5ae0c to your computer and use it in GitHub Desktop.
My tmux config
# start window index of 1
set-option -g base-index 1
setw -g pane-base-index 1
# sane scrolling
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# UTF-8
set-option -g status-utf8 on
# Supposedly fixes pausing in vim
set-option -sg escape-time 1
# Mouse Mode
set-option -g -q mouse on
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
bind-key -t vi-copy PPage page-up
bind-key -t vi-copy NPage page-down
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
bind-key -t vi-copy WheelUpPane halfpage-up
bind-key -t vi-copy WheelDownPane halfpage-down
# vi mode
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# act like GNU screen
unbind C-b
set -g prefix C-a
# Allow C-A a to send C-A to application
bind C-a send-prefix
# Reload key
bind r source-file ~/.tmux.conf
# Minor config settings
set -g default-terminal "screen-256color"
set -g history-limit 30000
setw -g xterm-keys on
# Rebinding the pane splitting bindings
bind | split-window -h
bind - split-window -v
# Open panes in new window
unbind v
unbind n
bind v send-keys " ~/tmux-panes -h" C-m
bind n send-keys " ~/tmux-panes -v" C-m
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# Panes
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
set-option -g pane-border-fg green
set-option -g pane-border-bg black
set-option -g pane-active-border-fg white
set-option -g pane-active-border-bg yellow
# statusbar --------------------------------------------------------------
# default statusbar colors
set-option -g status-fg white
set-option -g status-bg black
set-option -g status-attr default
# default window title colors
set-window-option -g window-status-fg cyan
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg red
set-window-option -g window-status-current-attr bright
# command/message line colors
set-option -g message-fg white
set-option -g message-bg black
set-option -g message-attr bright
# Refresh the status bar every 30 seconds.
set-option -g status-interval 30
# The status bar itself.
set -g status-justify centre
set -g status-left-length 40
set -g status-left "#[fg=#009900]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
set-option -g display-time 1000
# Reload source file
bind-key r source-file ~/.tmux.conf \; display-message "Configuration reloaded"
# Macros
# Show url in buffer
bind C-o run-shell "open $(tmux show-buffer)"
# Pipe pane to log file
bind-key P pipe-pane -o "cat >>$HOME/#W-tmux.log" \; display-message "Toggled logging to $HOME/#W-tmux.log"
# Maximize and restore panes. Don't switch windows between using these
# maximize
unbind Up
bind Up neww -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp
# Restore
unbind Down
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp
# Sync panes
bind C-s set-window-option synchronize-panes
# OSX Clipboard support
# set-option -g default-command "reattach-to-user-namespace -l sh"
# bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
# bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
# Linux clipboard support
# bind C-p run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
# bind C-y run "tmux save-buffer - | xclip -i -selection clipboard"
# Clear the current pane AND clear the pane's history
bind C-k send-keys 'C-l'\; clear-history
# Make brewed installed zsh default shell.
set-option -g default-shell /usr/local/bin/zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment