Last active
October 8, 2020 08:00
-
-
Save dienhoa/3a4081039ce140c417f661a8153f61a1 to your computer and use it in GitHub Desktop.
This file contains 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
unbind C-b | |
set -g prefix C-s | |
bind-key -r C-s send-prefix | |
# Use vim keybindings in copy mode | |
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" | |
setw -g mode-keys vi | |
# Setup 'v' to begin selection as in Vim | |
bind-key -T copy-mode-vi 'v' send -X begin-selection | |
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel | |
# Update default binding of `Enter` to also use copy-pipe | |
set -sg escape-time 0 | |
# Smart pane switching with awareness of Vim splits. | |
# See: https://github.com/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' | |
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' | |
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ | |
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" | |
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ | |
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" | |
bind-key -T copy-mode-vi 'C-h' select-pane -L | |
bind-key -T copy-mode-vi 'C-j' select-pane -D | |
bind-key -T copy-mode-vi 'C-k' select-pane -U | |
bind-key -T copy-mode-vi 'C-l' select-pane -R | |
bind-key -T copy-mode-vi 'C-\' select-pane -l | |
set-option -g status-keys "emacs" | |
#set-option -g default-command bash | |
set-option -g status-bg '#666666' | |
set-option -g status-fg '#aaaaaa' | |
set-option -g status-left-length 50 | |
# split panes using | and - | |
bind-key v split-window -v -c '#{pane_current_path}' | |
bind-key h split-window -h -c '#{pane_current_path}' | |
#bind h split-window -h | |
#bind v split-window -v | |
unbind '"' | |
unbind % | |
bind -n S-Left resize-pane -L 2 | |
bind -n S-Right resize-pane -R 2 | |
bind -n S-Down resize-pane -D 1 | |
bind -n S-Up resize-pane -U 1 | |
bind -n C-Left resize-pane -L 10 | |
bind -n C-Right resize-pane -R 10 | |
bind -n C-Down resize-pane -D 5 | |
bind -n C-Up resize-pane -U 5 | |
set-option -g base-index 1 | |
set-option -g renumber-windows on | |
bind-key b break-pane -d | |
bind-key C-j choose-tree | |
set -g default-terminal "screen-256color" | |
bind c new-window -c '#{pane_current_path}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment