Skip to content

Instantly share code, notes, and snippets.

@minimenchmuncher
Created June 15, 2016 20:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minimenchmuncher/f192517af6ed6e3432711a817ce78b97 to your computer and use it in GitHub Desktop.
Save minimenchmuncher/f192517af6ed6e3432711a817ce78b97 to your computer and use it in GitHub Desktop.
My .tmux.conf
#Change Prefix to control-a
unbind C-b
set -g prefix 'C-\'
bind 'C-\' send-prefix
bind C-c new-session #create new session
bind C-f command-prompt -p find-session 'switch-client -t %%'
bind j detach
# Set XTerm key bindings
setw -g xterm-keys on
# setw -g utf8 on
# Set colors
set-option -g default-terminal "screen-256color"
# Extra keybindings
bind r source-file ~/.tmux.conf #set reload to r
bind S command-prompt -p ssh: "new-window -n %1 'ssh %1'" #ssh to somewhere with hostname
bind | split-window -h -c "#{pane_current_path}" # split pane into 2 columns
bind - split-window -v -c "#{pane_current_path}" # split pane into 2 rows
#bind e new-window -n '~/.tmux.conf' '${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display "~/.tmux.conf sourced"'
# Count sessions start at 1
set -g base-index 1
set -g pane-base-index 1
# activity and activity colors
setw -g monitor-activity off
set -g visual-activity on
set-option -g allow-rename off
set-option -gw window-status-activity-attr bold
set-option -gw window-status-activity-fg yellow
set-window-option -g window-status-current-fg green
set-window-option -g window-status-activity-fg yellow
set-window-option -g window-status-activity-bg default
# set mouse mode on
set -g mouse on
# use vim bindings
setw -g mode-keys vi
bind -r d select-pane -L # move left
bind -r h select-pane -D # move down
bind -r g select-pane -U # move up
bind -r t select-pane -R # move right
bind > swap-pane -D # Swap pane with next one
bind < swap-pane -U # Swap pane with previous
bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane' #maximize current pane
#resize pane
bind -r D resize-pane -L 2
bind -r H resize-pane -D 2
bind -r G resize-pane -U 2
bind -r T resize-pane -R 2
#enable logging
bind-key L pipe-pane "exec cat >>$HOME/'#W-tmux.log'" \; display-message 'Started logging to $HOME/#W-tmux.log'
bind-key l pipe-pane \; display-message 'Ended logging to $HOME/#W-tmux.log'
#-- copying and pasting --------------
#bind Enter copy-mode # enter copy mode
#bind b list-buffers # list paster buffers
#bind p paste-buffer # paste from the top buffer
#bind P choose-buffer # choose which buffer
#bind -t vi-copy v begin-selection
#bind -t vi-copy C-v rectangle-toggle
#bind -t vi-copy y copy-selection
#bind -t vi-copy Escape cancel
#bind -t vi-copy H start-of-line
#bind -t vi-copy L end-of-line
# copy to Mac OSX pasteboard
set-option -g default-command "reattach-to-user-namespace -l zsh"
# set v and y keys as like vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# fix enter-key to use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# set the title bar
set -g set-titles on
set -g set-titles-string '#H:#S.#I.#P #W #T' #window number, program name, active (or not)
#turn off visual bell, use audible instead.
set-option -g bell-action any
set-option -g visual-bell off
#add more lines to history
set -g history-limit 100000
# increase the pane number display time (for C-\ q #)
set -g display-panes-time 2000
# set status bar
# set -g status-utf8 on
set -g status-bg default
set -g status-fg white
set -g status-interval 30 # about 1 minute?
set -g status-left-length 90
set -g status-right-length 60
set -g status-left " #[fg=Green]#(whoami)#[fg=white]@#[fg=cyan]#h#[fg=colour250] <#S> #[fg=green]: #[fg=colour134]#(curl -4 icanhazip.com) #[fg=yellow]#(ipconfig getifaddr en3 || ipconfig getifaddr en2 || ipconfig getifaddr en1 || ipconfig getifaddr en0) #[fg=green] #[default]"
set -g status-justify centre
set -g status-right '#(/Users/ezra/Documents/Battery-my/battery -tap)#[fg=White] %a %d %b %R'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment