Last active
December 31, 2019 02:07
-
-
Save phanviet/4f6258764fd304a8ee08cb8790259aa9 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
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'" | |
bind -n C-h run "($is_vim && tmux send-keys C-h) || \ | |
tmux select-pane -L" | |
bind -n C-j run "($is_vim && tmux send-keys C-j) || \ | |
($is_fzf && tmux send-keys C-j) || \ | |
tmux select-pane -D" | |
bind -n C-k run "($is_vim && tmux send-keys C-k) || \ | |
($is_fzf && tmux send-keys C-k) || \ | |
tmux select-pane -U" | |
bind -n C-l run "($is_vim && tmux send-keys C-l) || \ | |
tmux select-pane -R" | |
bind -n 'C-\' if-shell "$is_vim" "send-keys 'C-\\'" "select-pane -l" | |
# Use vim keybindings in copy mode | |
set -sg escape-time 0 | |
set -g default-terminal "screen-256color" | |
set-option -ga terminal-overrides ",xterm-256color:Tc" | |
set -g mouse on | |
# To copy, left click and drag to highlight text in yellow, | |
# once you release left click yellow text will disappear and will automatically be available in clibboard | |
# # Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-yank' | |
# Other examples: | |
# set -g @plugin 'github_username/plugin_name' | |
# set -g @plugin '[email protected]/user/plugin' | |
# set -g @plugin '[email protected]/user/plugin' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '~/.tmux/plugins/tpm/tpm' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment