Skip to content

Instantly share code, notes, and snippets.

@choestelus
Last active November 26, 2019 06:52
Show Gist options
  • Save choestelus/720e9ee2dcb54a44470cc4c2d7bc5ab1 to your computer and use it in GitHub Desktop.
Save choestelus/720e9ee2dcb54a44470cc4c2d7bc5ab1 to your computer and use it in GitHub Desktop.
Chochoe's tmux config, use tmux plugin manager to install plugin first
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set -s escape-time 0
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256color*:Tc"
set -g mouse on
set -g focus-events on
bind -n WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
set -g @shell_mode 'vi'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'knakayama/tmux-uptime'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Copy and Mouse mode Interops
# # disable "release mouse drag to copy and exit copy-mode", ref: https://github.com/tmux/tmux/issues/140
# unbind-key -T copy-mode-vi MouseDragEnd1Pane
# since MouseDragEnd1Pane neither exit copy-mode nor clear selection now,
# let single click do selection clearing for us.
bind-key -T copy-mode-vi MouseDown1Pane select-pane\; send-keys -X clear-selection
# this line changes the default binding of MouseDrag1Pane, the only difference
# is that we use `copy-mode -eM` instead of `copy-mode -M`, so that WheelDownPane
# can trigger copy-mode to exit when copy-mode is entered by MouseDrag1Pane
bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -eM\" \"send-keys -M\"' 'copy-mode -eM'
set -g @yank_action 'copy-pipe'
# status line configuration
set-option -g status-bg colour235
set-option -g status-fg "#14fe93"
setw -g window-status-style bg="colour236"
setw -g window-status-style fg="brightblue"
setw -g window-status-current-style bg="colour24"
setw -g window-status-current-style fg="brightwhite"
setw -g window-status-current-style bright
set -g mode-style fg="#14fe93",bg=colour235
set -g status-right '#{prefix_highlight} #{uptime} | #H | %a %Y-%m-%d %H:%M'
set -g status-right-length 80
set -g @prefix_highlight_show_copy_mode 'on'
# seamless tmux-vim
# 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"
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
# bind c new-window -c "#{pane_current_path}"
# bind '"' split-window -c "#{pane_current_path}"
# bind % split-window -h -c "#{pane_current_path}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment