Adds preferable Tmux kbds

This commit is contained in:
William Carroll 2017-09-26 15:30:44 -04:00
parent a1a8a73b2d
commit d996d8e814

View file

@ -1,3 +1,8 @@
# Convenience defn for creating vim-specific kbd behavior
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# change tmux leader
unbind C-b
set -g prefix C-q
@ -9,15 +14,30 @@ set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ",xterm*:Tc"
#copy-paste fixes: http://evertpot.com/osx-tmux-vim-copy-paste-clipboard/
# Copy-paste integration
set-option -g default-command "reattach-to-user-namespace -l zsh"
# copy text like it's Vim
bind-key -n Escape if-shell "${is_vim}" "send-keys Escape" copy-mode
# Transpose window layouts
bind-key -n M-r rotate-window -D
# Maximize current pane
bind-key -n M-z resize-pane -Z
# Use vim keybindings in copy mode
setw -g mode-keys vi
# kbds to create and delete tmux panes and windows (without confirmation)
bind-key -n M-q if-shell "${is_vim}" "send-keys M-q" kill-pane
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
@ -51,10 +71,6 @@ bind c new-window -c '#{pane_current_path}'
# Make tmux work like vi
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Easier window swaps
@ -93,10 +109,9 @@ bind -n m-s choose-session
# split window shortcuts, maintaing the working directory
bind | split-window -h -c '#{pane_current_path}'
bind \ split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
bind _ split-window -v -c '#{pane_current_path}'
bind-key -n M-\ split-window -h -c '#{pane_current_path}'
bind-key -n M-- split-window -v -c '#{pane_current_path}'
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
@ -119,10 +134,11 @@ set-option -g status-right-length 90
# Bindings for "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 -n M-h if-shell "${is_vim}" "send-keys M-h" "select-pane -L"
bind-key -n M-j if-shell "${is_vim}" "send-keys M-j" "select-pane -D"
bind-key -n M-k if-shell "${is_vim}" "send-keys M-k" "select-pane -U"
bind-key -n M-l if-shell "${is_vim}" "send-keys M-l" "select-pane -R"
# Configuration for a Pomodoro timer available at 'tj/pomo'
set-option -g status-right '#(cat ~/.pomo_stat)'