Created
September 13, 2015 16:44
-
-
Save craigw/d96c6ce125b37657549b 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
new-session -s Default | |
set-option -g default-shell $SHELL | |
set -g default-terminal "screen-256color" | |
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION" | |
# Status bar | |
set -g status-bg black | |
set -g status-fg white | |
set -g status-interval 5 | |
set -g status-left-length 50 | |
set -g status-left "#[fg=green][#I:#P #W] #(whoami)@#(hostname -s)" | |
set -g status-right "#[fg=colour45]%a %d/%m %H:%M#[fg=default]" | |
# remap prefix to Control + a | |
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
bind C-h select-pane -L | |
bind C-j select-pane -D | |
bind C-k select-pane -U | |
bind C-l select-pane -R | |
# Vim-aware split navigation | |
#bind -n C-h run '(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L' | |
#bind -n C-j run '(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D' | |
#bind -n C-k run '(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U' | |
#bind -n C-l run '(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R' | |
#bind -n C-\ run '(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l' | |
# Smart pane switching with awareness of vim splits | |
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' | |
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" | |
setw -g mode-keys vi | |
unbind Up | |
bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp | |
unbind Down | |
bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment