Created
July 13, 2017 23:36
-
-
Save grahams/ee40db56efbb0436308028f514b381e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
unbind C-b | |
set -g prefix C-a | |
bind -r a send-prefix | |
bind C-a last-window | |
if-shell 'test "$(uname -s)" = Darwin' 'set-option -g default-command "exec reattach-to-user-namespace -l bash"' | |
# Set reload key to r | |
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" | |
# repeated space/backspace toggles windows forward/backwards | |
bind -r Space next-window | |
bind -r C-Space next-window | |
bind -r C-h previous-window | |
bind -r C-? previous-window | |
# Use vim bindings | |
setw -g mode-keys vi | |
# Smart pane switching with awareness of Vim splits. | |
# See: https://github.com/christoomey/vim-tmux-navigator | |
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" | |
bind-key -T copy-mode-vi C-h select-pane -L | |
bind-key -T copy-mode-vi C-j select-pane -D | |
bind-key -T copy-mode-vi C-k select-pane -U | |
bind-key -T copy-mode-vi C-l select-pane -R | |
bind-key -T copy-mode-vi C-\ select-pane -l | |
# Set the title bar | |
set -g set-titles on | |
set -g set-titles-string '#h' | |
# renumber windows as they are created and destroyed | |
set-option -g renumber-windows on | |
# new windows should open in the cwd of the active pane | |
bind c new-window -c '#{pane_current_path}' | |
# create splits | |
bind - split-window -v -c '#{pane_current_path}' | |
bind \ split-window -h -c '#{pane_current_path}' | |
# resize splits | |
bind -n S-Left resize-pane -L 2 | |
bind -n S-Right resize-pane -R 2 | |
bind -n S-Down resize-pane -D 1 | |
bind -n S-Up resize-pane -U 1 | |
bind -n M-Left resize-pane -L 10 | |
bind -n M-Right resize-pane -R 10 | |
bind -n M-Down resize-pane -D 5 | |
bind -n M-Up resize-pane -U 5 | |
bind K unlink-window | |
# make prefix+S toggle status line visibility | |
bind S set -g status | |
# increase the history buffer length from the default of 2000 | |
set -g history-limit 20000 | |
# enable 256 color support | |
set -g default-terminal "xterm-256color" | |
set -ga terminal-overrides ",xterm-256color:Tc" | |
# setup status bar | |
set -g status-bg '#666666' | |
set -g status-fg '#aaaaaa' | |
set -g status-interval 5 | |
# pane movement | |
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" | |
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" | |
set -g status-left-length 50 | |
set -g status-left "#S %H:%M " | |
set -g status-right "#h: #(uptime |awk -F 'load average.*:' '{ print $2 }')" | |
set -w -g window-status-current-bg black | |
set -w -g window-status-current-fg white | |
set -s escape-time 0 | |
# bind tree session switcher | |
bind-key C-j choose-tree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment