Skip to content

Instantly share code, notes, and snippets.

@rhovelz
Created February 23, 2020 12:17
Show Gist options
  • Save rhovelz/d6aa0824efcf5bf388238f7c170752b4 to your computer and use it in GitHub Desktop.
Save rhovelz/d6aa0824efcf5bf388238f7c170752b4 to your computer and use it in GitHub Desktop.
#############################
########## Bindings
#############################
# Set the prefix to `ctrl + a` instead of `ctrl + b`
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# Use | and - to split a window vertically and horizontally instead of " and % respoectively
bind h split-window -h -c "#{pane_current_path}"
bind v split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# Open ~/.tmux.conf in vim and reload settings on quit
unbind e
bind e new-window -n '~/.tmux.conf' "sh -c 'nvim ~/.tmux.conf && tmux source ~/.tmux.conf'"
# Bind D to resize the window to be 8 lines smaller
bind D resize-pane -D 8
# Switch betewen panes using alt + arrow
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Use shift + arrow key to move between windows in a session
bind -n S-Left previous-window
bind -n S-Right next-window
# Use r to quickly reload tmux settings
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'RELOADED'
# Mouse mode
set -g mouse on
# Use a to toggle synchronize panes
bind a set-window-option synchronize-panes
# prefix + / to search
bind-key / copy-mode \; send-key ?
# prefix + h to clear screen and history buffer
bind y \
send-keys "C-c; clear && tmux clear-history" \;\
send-keys "Enter" \;\
display 'Screen cleared'
# Setup 'v' to begin selection, just like Vim
bind-key -T copy-mode-vi 'v' send -X begin-selection
# Setup 'y' to yank (copy), just like Vim
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
#############################
########## Settings
#############################
# Refresh status line every 5 seconds - Good for when music is playing / update time etc
set -g status-interval 5
# Start window and pane indices at 1.
set -g base-index 1
set -g pane-base-index 1
# length of tmux status line
set -g status-left-length 30
set -g status-right-length 150
# Make active pane border red
set -g pane-active-border-style fg=colour1
#Set the left and right status
# Set the history limit so we get lots of scrollback.
#setw -g history-limit 500000
#############################
############# Tmux Vars
#############################
set -g status-left "#[fg=#e06c75,bg=colour16]#[fg=#e5c07b,bg=colour16]#[fg=colour1,bg=colour2,bold] #S #[fg=colour2,bg=colour235,nobold,nounderscore,noitalics]"
set -g status-right "#[fg=colour236,bg=colour16]#[fg=colour12,bg=colour16,nobold,nounderscore,noitalics]#[fg=colour235,bg=colour12] #(~/dotfiles/tmux/suhu)#[fg=colour236,bg=colour12] #[fg=colour12,bg=colour236] #(~/dotfiles/tmux/mem) #[fg=colour12,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour235,bg=colour12] #(~/dotfiles/tmux/./bat)#[fg=colour236,bg=colour12] #[fg=colour12,bg=colour236] %H:%M ⌚ #[fg=colour4,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour0,bg=colour4] #h  #[fg=#e5c07b]#[fg=#e06c75,bg=#e5c07b]"
setw -g window-status-format "#[fg=colour8,bg=colour235] #I #[fg=colour8,bg=colour235] #W "
setw -g window-status-current-format "#[fg=colour235,bg=colour10,nounderscore,noitalics]#[fg=colour235,bg=colour10,bold] #I #[fg=colour235,bg=colour10,nobold]#[fg=colour235,bg=colour10,bold] #W #[fg=colour10,bg=colour16,nobold,nounderscore,noitalics]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment