Created
April 28, 2017 15:47
-
-
Save tiagopog/d431103142fc96253e272d760b1e3851 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
# 256 colors for vim | |
set -g default-terminal "screen-256color" | |
# Start window numbering at 1 | |
set-option -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
# Cycle panes with C-b C-b | |
unbind ^B | |
bind ^B select-pane -t :.+ | |
# Reload config with a key | |
bind-key r source-file ~/.tmux.conf \; display "Config reloaded!" | |
# Scrolling works as expected | |
set -g terminal-overrides 'xterm*:smcup@:rmcup@' | |
# Clear the pane and it's history | |
bind -n C-k send-keys C-l \; clear-history | |
# smart pane switching with awareness of vim splits | |
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" | |
# C-l is taken over by vim style pane navigation | |
bind C-l send-keys 'C-l' | |
# Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Deal with history in the edit mode | |
bind-key -T edit-mode-vi Up send-keys -X history-up | |
bind-key -T edit-mode-vi Down send-keys -X history-down | |
# Setup 'v' to begin selection and y to yank it as in Vim | |
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection | |
unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" | |
# Utils in copy mode | |
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle | |
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection | |
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment