Last active
August 29, 2015 13:59
-
-
Save rtfpessoa/10585147 to your computer and use it in GitHub Desktop.
Tmux Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat << ►_◄ > /dev/null | |
# | |
# Tmux config | |
# | |
# set Zsh as your default Tmux shell | |
set-option -g default-shell /bin/zsh | |
# colors please | |
set -g default-terminal "screen-256color" | |
setw -g xterm-keys on | |
set -sg repeat-time 600 # increase repeat timeout | |
set -s quiet on # disable various messages | |
set-window-option -g xterm-keys on | |
# Patch for OS X pbpaste and pbcopy under tmux. | |
# set-option -g default-command "reattach-to-user-namespace -l zsh" | |
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL" | |
# no confirmation on quit pane or window | |
bind x kill-pane | |
bind q kill-window | |
# Some tweaks | |
set -g focus-events on | |
set -g display-time 5000 | |
set -g status-interval 5 | |
# Copy mode | |
bind Escape copy-mode | |
# History limit | |
set -g history-limit 50000 | |
# Ring the bell if any background window rang a bell | |
set -g bell-action any | |
# Default termtype. If the rcfile sets $TERM, that overrides this value. | |
set -g default-terminal screen-256color | |
# Keep your finger on ctrl, or don't | |
bind-key ^D detach-client | |
# clear on tmux | |
bind -n C-k send-keys -R \; send-keys C-l \; clear-history | |
# ctrl + a ftw | |
# set -g prefix2 C-a # GNU-Screen compatible prefix | |
# bind C-a send-prefix -2 | |
# utf8 ftw | |
set -g status-utf8 on # expect UTF-8 | |
setw -g utf8 on | |
set-window-option -g utf8 on | |
# force a reload of the config file | |
unbind r | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" | |
# quick pane cycling | |
unbind ^A | |
bind ^A select-pane -t :.+ | |
# Repeat for last active window | |
bind-key C-a last-window | |
# Zero is cool for programming but not for keyboards | |
set -g base-index 1 # start windows numbering at 1 | |
setw -g pane-base-index 1 # make pane numbering consistent with windows | |
# No delay between comands | |
set -sg escape-time 0 | |
# easily toggle synchronization (mnemonic: e is for echo) | |
# sends input to all panes in a given window. | |
bind e setw synchronize-panes on | |
bind E setw synchronize-panes off | |
# Rather than constraining window size to the maximum size of any client | |
# connected to the *session*, constrain window size to the maximum size of any | |
# client connected to *that window*. Much more reasonable. | |
# setw -g aggressive-resize on | |
# Better scrooling (Sane scrolling) | |
set -g terminal-overrides ",xterm*:XT:smcup@:rmcup@" | |
set -g mode-mouse on | |
setw -g mode-mouse on | |
set -g mouse-resize-pane on | |
set -g mouse-select-pane on | |
set -g mouse-select-window on | |
setw -g alternate-screen on | |
set-window-option -g mode-mouse on | |
# Allows us to use C-a a <command> to send commands to a TMUX session inside | |
# another TMUX session | |
bind-key a send-prefix | |
# Activity monitoring | |
setw -g monitor-activity on | |
set -g visual-activity on | |
# Highlight active window | |
set-window-option -g window-status-current-bg red | |
# New window keep path | |
bind c new-window -c "#{pane_current_path}" | |
# Switch windows | |
bind -n S-down new-window | |
bind -n S-left prev | |
bind -n S-right next | |
bind -n C-left swap-window -t -1 | |
bind -n C-right swap-window -t +1 | |
# Pane resize in all four directions using vi bindings. | |
unbind-key j | |
bind-key j select-pane -D | |
unbind-key k | |
bind-key k select-pane -U | |
unbind-key h | |
bind-key h select-pane -L | |
unbind-key l | |
bind-key l select-pane -R | |
# Can use these raw but I map them to shift-ctrl-<h,j,k,l> in iTerm. | |
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 | |
# Create splits and vertical splits | |
bind-key | split-window -h -p 50 -c "#{pane_current_path}" | |
bind-key - split-window -v -p 50 -c "#{pane_current_path}" | |
# Misc | |
setw -g automatic-rename on # rename window to reflect current program | |
# renumber windows when a window is closed | |
set -g renumber-windows on | |
set -g set-titles on # set terminal title | |
set -g set-titles-string '#h ❐ #S ● #I #W' | |
set -g display-panes-time 800 # slightly longer pane indicators display time | |
set -g display-time 1000 # slightly longer status messages display time | |
set -g status-interval 10 # redraw status line every 10 seconds | |
# 24 hour clock | |
setw -g clock-mode-style 24 | |
# create new session | |
bind C-c new-session | |
# find session | |
bind C-f command-prompt -p find-session 'switch-client -t %%' | |
# pane navigation | |
bind -r h select-pane -L # move left | |
bind -r j select-pane -D # move down | |
bind -r k select-pane -U # move up | |
bind -r l select-pane -R # move right | |
bind > swap-pane -D # swap current pane with the next one | |
bind < swap-pane -U # swap current pane with the previous one | |
# maximize current pane | |
bind + run 'cut -c3- ~/.tmux.conf | sh -s maximize_pane' | |
# window navigation | |
bind -r C-h previous-window # select previous window | |
bind -r C-l next-window # select next window | |
bind Space last-window # move to last active window | |
# vi-keys everywhere; anything else would be uncivilized | |
setw -g mode-keys vi | |
set -g status-keys vi | |
setw -g xterm-keys on | |
# Setup 'v' to begin selection as in Vim | |
bind-key -t vi-copy r rectangle-toggle | |
bind-key -t vi-copy v begin-selection | |
bind-key -t vi-copy y copy-pipe "pbcopy" | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -t vi-copy Enter | |
bind-key -t vi-copy Enter copy-pipe "pbcopy" | |
# color scheme (styled as vim-powerline) | |
set -g status-right-length 451 | |
set -g status-fg white | |
set -g status-bg colour234 | |
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 window-status-format "#[fg=colour235,bg=colour252,bold] #I #W #[fg=colour252,bg=colour234]⮀" | |
set -g window-status-current-format "#[fg=black,bg=green,bold] #I: #W #[fg=green,bg=colour234,nobold]⮀" | |
set -g status-left-length 100 | |
set -g status-left "#[fg=colour245,bg=colour238,bold] #(whoami) #[fg=colour234,bg=colour234,bold] " | |
set -g status-right-length 100 | |
set -g status-right "#[fg=yellow] %A, %d %b %Y #[fg=green]::%l:%M:%S %p :: #[fg=blue]S #S : W #I : P #P ::" | |
# Keep parent environment | |
set -ga update-environment -r | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sidebar' | |
# Sidebard plugin config | |
set -g @sidebar-tree-command 'tree -C -L 2' | |
set -g @sidebar-tree-width '40' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run-shell '/Users/rtfpessoa/.tmux/plugins/tpm/tpm' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment