shoestrap/assets/default/dotfiles/tmux.conf

73 lines
3.0 KiB
Plaintext
Raw Normal View History

2013-08-08 03:23:13 +00:00
# set default shell
set-option -g default-shell $SHELL
# Sets xterm window title
set-option -g set-titles on
set-option -g set-titles-string '[#S:#I] #W'
# copy and paster
2014-11-04 18:12:56 +00:00
if-shell 'test "$(uname -s)" = "Darwin"' 'set-option -g default-command "reattach-to-user-namespace-tmux bash"'
2013-08-08 03:23:13 +00:00
# look good
set -g default-terminal "screen-256color"
# act like GNU screen
unbind C-b
#set -g prefix C-a
#set -g prefix C-Space
set -g prefix C-q
# Move thorugh panes with a repeat
#bind C-a select-pane -t :.+
#bind C-Space select-pane -t :.+
bind C-q select-pane -t :.+
# a mouse
set -g mode-mouse on
setw -g mouse-select-window on
setw -g mouse-select-pane on
# easy splitting
2014-11-10 21:08:09 +00:00
if-shell "source ./.bash_funcs && vertest `tmux -V | sed 's/[^0-9\.]*//g'` '>=' 1.9" 'bind | split-window -h -c "#{pane_current_path}"'
if-shell "source ./.bash_funcs && vertest `tmux -V | sed 's/[^0-9\.]*//g'` '>=' 1.9" 'bind - split-window -c "#{pane_current_path}"'
if-shell "source ./.bash_funcs && vertest `tmux -V | sed 's/[^0-9\.]*//g'` '>=' 1.9" 'bind _ split-window -c "#{pane_current_path}"'
2014-11-04 18:12:56 +00:00
# old versions (some won't recognize new vertest function"
2014-11-10 21:08:09 +00:00
if-shell "source ./.bash_funcs && vertest `tmux -V | sed 's/[^0-9\.]*//g'` '<' 1.9 || [ $? -eq 127 ]" 'bind | split-window -h'
if-shell "source ./.bash_funcs && vertest `tmux -V | sed 's/[^0-9\.]*//g'` '<' 1.9 || [ $? -eq 127 ]" 'bind - split-window'
if-shell "source ./.bash_funcs && vertest `tmux -V | sed 's/[^0-9\.]*//g'` '<' 1.9 || [ $? -eq 127 ]" 'bind _ split-window'
2013-08-08 03:23:13 +00:00
# act like vim
setw -g mode-keys vi
# move between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# swap panes
bind-key -r J swap-pane -D
bind-key -r K swap-pane -U
# move between windows
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# use vim style copy mode
unbind [
bind ` copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy v begin-selection
2015-03-26 06:04:24 +00:00
bind -t vi-copy V rectangle-toggle
2013-08-08 03:23:13 +00:00
bind -t vi-copy y copy-selection
# after copying to a tmux buffer, hit y again to copy to clipboard
if-shell 'test "$(uname -s)" = "Darwin"' 'bind-key y run "tmux show-buffer | reattach-to-user-namespace pbcopy"'
if-shell 'test "$(uname -s)" = "Linux"' 'bind-key y run "tmux show-buffer | xclip -sel clip -i"'
# Auto load tmuxline config for themes
if-shell "test -f ~/.tmuxline.conf" "source ~/.tmuxline.conf"
# 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"