Skip to content

Instantly share code, notes, and snippets.

@przbadu
Last active August 17, 2021 05:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save przbadu/9548a1cfe64aa17b5bf6879680582611 to your computer and use it in GitHub Desktop.
Save przbadu/9548a1cfe64aa17b5bf6879680582611 to your computer and use it in GitHub Desktop.
tmux conf file [przbadu]
###########################
# Configuration
###########################
# use 256 term for pretty colors
# set -g default-terminal "screen-256color" # making tmux slow
set -g default-terminal "xterm-256color"
# Enable mouse support
set -g mouse on
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# start window index at 1
set -g base-index 1
# start pane index at 1
setw -g pane-base-index 1
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# re-number windows when one is closed
set -g renumber-windows on
# Fix nightfly color scheme to display correctly inside tmux
set -ga terminal-overrides ',xterm-256color:Tc'
# enable pbcopy and pbpaste
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md
# set-option -g default-command "reattach-to-user-namespace -l zsh"
###########################
# Key Bindings
###########################
# tmux prefix
set -g prefix C-b
# paste
unbind C-p
bind C-p paste-buffer
# window splitting
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v -p 20
# quickly switch panes
unbind ^B
bind ^B select-pane -t :.+
# switch panes using Alt-arrow without prefix
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
# swap windows
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
# Quickly view system & process info in htop
bind-key h split-window -h "htop"
# Quickly edit todo list
bind-key w split-window -h "vim ~/vimwiki/index.md"
# rails specific
bind-key -n M-s split-window -h "bundle exec sidekiq"
bind-key -n M-r split-window -v -p 20 "redis-server"
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
###########################
# Status Bar
###########################
# set refresh interval for status bar
set -g status-interval 30
# center the status bar
set -g status-justify left
# show session, window, pane in left status bar
set -g status-left-length 40
set -g status-left '#[fg=green]#S#[fg=blue] #I:#P #[default]'
# show hostname, date, time, and battery in right status bar
set-option -g status-right '#[fg=green]#H#[default] %m/%d/%y %I:%M #[fg=red]#(battery discharging)#[default]#(battery charging)#{net_speed}'
###########################
# Colors
###########################
# color status bar
set -g status-style bg=colour235
set -g status-style fg=white
# highlight current window
set-window-option -g window-status-current-style bg=black
set-window-option -g window-status-current-style fg=green
# set color of active pane
set -g pane-border-style bg=colour235
set -g pane-border-style fg=black
set -g pane-active-border-style bg=green
set -g pane-active-border-style fg=black
# Resize pane
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
###########################
# Plugins
###########################
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-net-speed'
# Display internet download and upload speed
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment