Adds preferable Tmux kbds
This commit is contained in:
parent
a1a8a73b2d
commit
d996d8e814
1 changed files with 32 additions and 16 deletions
|
@ -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
|
# change tmux leader
|
||||||
unbind C-b
|
unbind C-b
|
||||||
set -g prefix C-q
|
set -g prefix C-q
|
||||||
|
@ -9,15 +14,30 @@ set -g default-terminal "screen-256color"
|
||||||
set-option -sa terminal-overrides ",xterm*:Tc"
|
set-option -sa terminal-overrides ",xterm*:Tc"
|
||||||
|
|
||||||
|
|
||||||
#copy-paste fixes: http://evertpot.com/osx-tmux-vim-copy-paste-clipboard/
|
|
||||||
# Copy-paste integration
|
# Copy-paste integration
|
||||||
set-option -g default-command "reattach-to-user-namespace -l zsh"
|
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
|
# Use vim keybindings in copy mode
|
||||||
setw -g mode-keys vi
|
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
|
# Setup 'v' to begin selection as in Vim
|
||||||
bind-key -t vi-copy v begin-selection
|
bind-key -t vi-copy v begin-selection
|
||||||
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
|
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
|
# Make tmux work like vi
|
||||||
set-window-option -g mode-keys 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
|
# Easier window swaps
|
||||||
|
@ -93,10 +109,9 @@ bind -n m-s choose-session
|
||||||
|
|
||||||
|
|
||||||
# split window shortcuts, maintaing the working directory
|
# split window shortcuts, maintaing the working directory
|
||||||
bind | split-window -h -c '#{pane_current_path}'
|
bind-key -n M-\ split-window -h -c '#{pane_current_path}'
|
||||||
bind \ split-window -h -c '#{pane_current_path}'
|
bind-key -n M-- split-window -v -c '#{pane_current_path}'
|
||||||
bind - split-window -v -c '#{pane_current_path}'
|
|
||||||
bind _ split-window -v -c '#{pane_current_path}'
|
|
||||||
|
|
||||||
bind '"' split-window -c "#{pane_current_path}"
|
bind '"' split-window -c "#{pane_current_path}"
|
||||||
bind % split-window -h -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"
|
# Bindings for "christoomey/vim-tmux-navigator"
|
||||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
bind-key -n M-h if-shell "${is_vim}" "send-keys M-h" "select-pane -L"
|
||||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
bind-key -n M-j if-shell "${is_vim}" "send-keys M-j" "select-pane -D"
|
||||||
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
|
bind-key -n M-k if-shell "${is_vim}" "send-keys M-k" "select-pane -U"
|
||||||
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
|
bind-key -n M-l if-shell "${is_vim}" "send-keys M-l" "select-pane -R"
|
||||||
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"
|
# Configuration for a Pomodoro timer available at 'tj/pomo'
|
||||||
|
set-option -g status-right '#(cat ~/.pomo_stat)'
|
||||||
|
|
Loading…
Reference in a new issue