Skip to content

Instantly share code, notes, and snippets.

@canabady
Last active August 14, 2021 10:39
Show Gist options
  • Save canabady/e9e8ad082416ce40be5ecec011bd6659 to your computer and use it in GitHub Desktop.
Save canabady/e9e8ad082416ce40be5ecec011bd6659 to your computer and use it in GitHub Desktop.
tmux configuration
set -g @resurrect-processes ':all:'
#set -g mode-mouse on
set -g mouse on
# sane scrolling:
#bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e; send-keys -M'"
# In order for Tmux to do its magic focus-events option has to be set to on.
# Needed by 'tmux-focus-events.vim'
set -g focus-events on
# use UTF8
# set -g utf8
# set-window-option -g utf8 on
set -g base-index 1
# set -g pane-baseindex 1
set -g mode-keys vi
set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix
set -g status-justify centre
unbind-key %
bind-key | split-window -h
bind-key _ split-window -v
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
# For copy and paste
# unbind [
# bind Escape copy-mode
# unbind p
bind p paste-buffer
# bind-key -t vi-copy 'v' begin-selection # Begin selection in copy mode.
# bind-key -t vi-copy 'C-v' rectangle-toggle # Begin selection in copy mode.
# bind-key -t vi-copy 'y' copy-selection # Yank selection in copy mode.
# To demote a window
## Join windows: <prefix> ^, <prefix> *
bind-key ^ command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key * command-prompt -p "send pane to:" "join-pane -t '%%'"
# Needed for Tmux prefix highlight plugin
# set -g status-right '#{prefix_highlight} | %a %Y-%m-%d %H:%M'
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
# A sidebar with the directory tree for the current path.
# Tries to make tmux more IDE like.
# set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-urlview'
set -g @plugin 'jbnicolai/tmux-fpp'
# Tmux prefix highlight
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# Lightweight tmux utils for manipulating sessions
set -g @plugin 'tmux-plugins/tmux-sessionist'
# standard pane key-bindings for tmux
set -g @plugin 'tmux-plugins/tmux-pain-control'
# Easy logging and screen capturing for Tmux.
set -g @plugin 'tmux-plugins/tmux-logging'
# Color theme for the tmux terminal multiplexer using Ethan Schoonover’s Solarized color scheme
set -g @plugin 'seebi/tmux-colors-solarized'
# An alternative pack of various Tmux themes.
set -g @plugin 'jimeh/tmux-themepack'
# Seamless navigation between tmux panes and vim splits
set -g @plugin 'christoomey/vim-tmux-navigator'
# 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"
# You can pick and choose a theme via .tmux.conf option:
# https://github.com/jimeh/tmux-themepack
# set -g @themepack 'basic'
set -g @themepack 'powerline/block/blue'
# set -g @themepack 'powerline/block/cyan'
# set -g @themepack 'powerline/default/gray'
# set -g @themepack 'powerline/double/magenta'
# 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