Skip to content

Instantly share code, notes, and snippets.

@juniorbird
Created July 18, 2017 18:25
Show Gist options
  • Save juniorbird/2dd98916bd25ddc86c8f8f893c873227 to your computer and use it in GitHub Desktop.
Save juniorbird/2dd98916bd25ddc86c8f8f893c873227 to your computer and use it in GitHub Desktop.
My tmux.conf
setw -g mode-keys vi
# split panes using | and -
bind \ split-window -h -c "#{pane_current_path}"
bind - split-window -v
unbind '"'
unbind %
# require I name windows and sessions
bind-key S command-prompt -p "Name of new session: " "new-session -s '%%'"
bind-key W command-prompt -p "Name of new window: " "new-window -n '%%'"
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/dotfiles/tmux.conf
# switch panes using vim keys
bind-key h select-pane -L
bind-key l select-pane -R
bind-key k select-pane -U
bind-key j select-pane -D
# Move windows
bind -r < swap-window -t -1
bind -r > swap-window -t +1
bind-key = resize-pane -Z \; display-message "Zooming..."
# resize panes using vim keys
bind-key H resize-pane -L 10
bind-key K resize-pane -U 10
bind-key J resize-pane -D 10
bind-key L resize-pane -R 10
# Vi-style cut and paste, using the Mac clipboard
unbind [
bind Escape copy-mode
unbind p
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-pipe "tmux save-buffer - | pbcopy"
bind p run "pbpaste | tmux load-buffer - && tmux paste-buffer"
# Basic configuration for happiness
set -g default-shell $SHELL
# set -g default-command "reattach-to-user-namespace -l ${SHELL} || source ~/dotfiles/bashrc && wait ${!} && ${SHELL}"
# This one for nested sessions
bind-key b send-prefix
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# don't rename windows automatically
set-option -g allow-rename off
# environment variables
set -g history-limit 10000
# keep it easy to switch windows/panes/etc
# start numbering at 1 (0 is so far away!)
# renumber if you close windows
set -g base-index 1
bind 0 select-window -t :10
setw -g pane-base-index 1
set -g renumber-windows on
#######################
# customize look
#
# in living color
set -g default-terminal screen-256color
# status bar
set -g status-justify centre
set -g status-left-length 100
set -g status-left "#{prefix_highlight} Session: #S | Continuum: #{continuum_status}"
set -g status-right-length 100
set -g status-right "Active Ports on $MYMACHINENAME: #(echo `lsof -iTCP -sTCP:LISTEN -P -n | grep -v --regexp='2BUA8C4S2' | grep -v --regexp='Dropbox' | grep -v --regexp='Spotify' | grep -v --regexp='Last.fm' | grep -v --regexp='Dropbox' | grep -v --regexp='XMind' | grep -v --regexp='teensy' | grep -oE --regexp='\:([[:digit:]][[:digit:]][[:digit:]][[:digit:]][^[:digit:]])'"
set -g status-fg "$MYMACHINETMUX"
set -g status-bg colour235
# panes
set -g pane-border-bg colour235
set -g pane-border-fg colour0
set -g pane-active-border-bg colour235
set -g pane-active-border-fg "$MYMACHINETMUX"
set -g display-panes-colour colour252
set -g display-panes-active-colour "$MYMACHINETMUX"
# show state
set -g @prefix_highlight_fg colour235
set -g @prefix_highlight_bg "$MYMACHINETMUX"
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr "fg=white,bg=$MYMACHINETMUX,bold"
set -g @prefix_highlight_output_prefix '[ '
set -g @prefix_highlight_output_suffix ' ]'
##########
# tmux plugin manager https://github.com/tmux-plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'tmux-plugins/tmux-yank'
# Continuously save state https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-save-interval '15'
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment