Skip to content

Instantly share code, notes, and snippets.

@srustamo
Created March 30, 2016 14:42
Show Gist options
  • Save srustamo/04934232a6a33268722bbda9c429c178 to your computer and use it in GitHub Desktop.
Save srustamo/04934232a6a33268722bbda9c429c178 to your computer and use it in GitHub Desktop.
#http://superuser.com/questions/479600/how-can-i-prevent-tmux-exiting-with-ctrl-d
# 13_01_2016
# this prevents Ctrl-D exiting tmux - only after 3 will it exit
# set-environment -g 'IGNOREEOF' 2
set-option -g default-shell /usr/local/bin/zsh
set -g mouse on
set -g mouse-utf8 on
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'"
# next line for zsh, but tmux says unkown option
# set -o ignoreeof
unbind-key C-b
#set -g prefix C-m
#bind Space send-prefix
#bind C-m send-prefix
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
set -g prefix C-a
bind C-a send-prefix
bind | split-window -h
bind - split-window -v
bind h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind l select-pane -R
bind m display-panes \; select-pane -t :
# Previous and Next windows 30 Dec 2013: KeyRemap conflicts with these two Next Window commands
bind -r C-l select-window -t :-
bind -r C-h select-window -t :+
# Previous and Next windows 30 Dec 2013: KeyRemap conflicts with previous two Next Window commands
# Crtl + Arrow keys
bind -r C-right next
bind -r C-left prev
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
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
#set -g mode-mouse on
#set -g mouse-select-pane on
#set -g mouse-resize-pane on
#set -g mouse-select-window on
set -g default-terminal "screen-256color"
# set -g status-fg white
# set -g status-bg colour240
# set -g status-fg black
# set -g status-bg white
# setw -g window-status-fg cyan
# setw -g window-status-bg default
# setw -g window-status-attr dim
# setw -g window-status-current-fg white
# setw -g window-status-current-bg red
# setw -g window-status-current-attr bright
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg white
set -g pane-active-border-bg green
# set -g message-fg white
# set -g message-bg black
# set -g message-attr bright
# set -g status-left-length 40
# set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
# set -g status-right "#[fg=cyan]%d %b %R"
set -g status-utf8 on
set -g status-interval 60
# set -g status-justify centre
set -g status-right "#[fg=cyan]%d %b %R"
setw -g monitor-activity on
set -g visual-activity on
set-option -g default-command "reattach-to-user-namespace -l zsh"
## 1 Feb 2014 http://superuser.com/questions/600286/tmux-move-pane-to-new-window
## Join windows: <prefix> s, <prefix> j
bind n command-prompt -p "join pane from:" "join-pane -s '%%'"
bind s command-prompt -p "send pane to:" "join-pane -t '%%'"
## 11 Mar 2014 http://unix.stackexchange.com/questions/23138/esc-key-causes-a-small-delay-in-terminal-due-to-its-alt-behavior
set -s escape-time 0
#--Usability--------------------------------------------------------------------
#### 26 Jun 2014 http://code.tutsplus.com/tutorials/intro-to-tmux--net-33889
set -g status-keys vi
setw -g mode-keys vi
# 26 Jun 2014 keep tmux msgs around longer http://www.tofu.org/drupal/node/182
set -g display-time 3000
## 23 aug 14
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# 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"
#15_Dec_14
# Tmux plugin
# https://github.com/tmux-plugins/tpm
# List of plugins
# Supports `github_username/repo` or full git repo URLs
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-resurrect \
# nhdaly/tmux-scroll-copy-mode \
'
# Other examples:
# github_username/plugin_name \
# git@github.com/user/plugin \
# git@bitbucket.com/user/plugin \
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell '~/.tmux/plugins/tpm/tpm'
# set -g @scroll-down-exit-copy-mode "on"
# set -g @scroll-in-moused-over-pane "on"
# set -g @scroll-without-changing-pane "on"
# set -g @scroll-speed-num-lines-per-scroll "on"
# set -g @prevent-scroll-for-fullscreen-alternate-buffer "on"
#15_Dec_14
#https://github.com/tmux-plugins/tmux-resurrect/blob/master/README.md
#set -g @resurrect-save 'S'
#set -g @resurrect-restore 'R''
# 27_12_2015 http://www.drbunsen.org/the-text-triumvirate/
# status line like powerline
set -g status-left-length 52
set -g status-right-length 451
set -g status-fg white
set -g status-bg colour234
set -g window-status-activity-attr bold
# set -g pane-border-fg colour245
# set -g pane-active-border-fg colour39
set -g message-fg colour16
set -g message-bg colour221
set -g message-attr bold
set -g status-left '#[fg=colour235,bg=colour252,bold] ❐ #S #[fg=colour252,bg=colour238,nobold]#[fg=colour245,bg=colour238,bold] #(whoami) ##[fg=colour238,bg=colour234,nobold]'
set -g window-status-format "#[fg=white,bg=colour234] #I #W "
set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour25,bg=colour39,noreverse,bold] #I  #W #F #[fg=colour39,bg=colour234,nobold]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment