Last active
July 22, 2022 15:23
-
-
Save spikegrobstein/5724689 to your computer and use it in GitHub Desktop.
my tmux config (updated for 2.4)
This file contains 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
# This requires tmux 2.1. a lot of these settings will error on anything earlier. | |
# Act like Vim; use h,j,k,l to select panes and move the cursor | |
set-window-option -g mode-keys vi | |
bind-key h select-pane -L | |
bind-key j select-pane -D | |
bind-key k select-pane -U | |
bind-key l select-pane -R | |
# Look good | |
set-option -g default-terminal "xterm-256color" | |
# macOS bash only: connect to user namespace | |
# (http://www.economyofeffort.com/2013/07/29/reattach-to-user-namespace-the-fix-for-your-tmux-in-os-x-woes/) | |
# set-option -g default-command "reattach-to-user-namespace -l bash" | |
# Enable mouse support (works in iTerm) | |
set-option -g -q mouse on | |
# make mousewheel work when not in copy mode | |
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M" | |
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M" | |
# bind-key -t vi-copy WheelUpPane halfpage-up | |
# bind-key -t vi-copy WheelDownPane halfpage-down | |
# scrollback buffer size increase (this eats up memory, sometimes) | |
set -g history-limit 500000 | |
# C-b C-b will swap to last used window | |
bind-key C-b last-window | |
# Start tab numbering at 1 | |
set -g base-index 1 | |
set-window-option -g pane-base-index 1 | |
# Allows for faster key repetition | |
set -s escape-time 0 | |
## Color Shit | |
# Highlight active window in tab-bar at bottom in grey | |
set-window-option -g window-status-current-style 'bg=#151122 fg=#e0af68' | |
set-window-option -g window-status-current-format ' #I:#W ' | |
# purple status bar | |
set-option -g status-style 'bg=colour54 fg=white' | |
set-window-option -g window-status-format ' #I:#W#F' | |
# border colors | |
set-option -g pane-border-style 'fg=color18' | |
set-option -g pane-active-border-style 'fg=colour54' | |
# command mode | |
set-option -g message-style 'fg=#e0af68 bg=black' | |
set-option -g message-command-style 'fg=#e0af68 bg=black' | |
set-option -g mode-style 'fg=black bg=#e0af68' | |
## end color shit | |
# set -g window-style 'fg=default,bg=default' | |
# set -g window-active-style 'fg=default,bg=default' | |
# set -g pane-border-style "fg=green,bg=default" | |
# set -g pane-active-border-style "fg=default,bg=default" | |
# set -g pane-active-border-fg colour51 | |
# use different keys to split vertical and horizonal | |
# ^B | for vertical split | |
# ^B - for horizontal split | |
bind | split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
# Change cursor in vim to distinguish between insert and command mode | |
# Use in conjunction with tmux-cursors.vim | |
#set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007' | |
set-option -ga terminal-overrides ',xterm-256color:RGB' | |
# use C-b v to paste the tmux buffer | |
bind v paste-buffer | |
# clipboard stuff for OSX | |
# be sure to `brew install reattach-to-user-namespace` to use this | |
# ^B ^C to set system clipboard to tmux's | |
# bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy" | |
# bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer" | |
bind p paste-buffer | |
bind -T copy-mode-vi 'v' send -X begin-selection | |
bind -T copy-mode-vi 'y' send -X copy-selection | |
# show battery status in status bar. comment this out if you don't need it | |
# gem install batt | |
set-option -g status-right-length 120 | |
set-option -g status-right "[ #(batt meter --tmux --size 10) #(batt capacity) ] #(date \"+%Y-%m-%d %H:%M\")" | |
# renumber windows (if you have gaps in numbering, this renumbers them sequentially | |
# ^B r | |
bind r movew -r | |
# split the screen into a main screen and an 80-width pane on the right | |
bind -n C-g split-window -h -c "#{pane_current_path}" \; resize-pane -x 80 \; select-pane -t 0 | |
# split the screen into main screen with 16-tall pane on the bottom | |
bind g split-window -v -c "#{pane_current_path}"\; resize-pane -y 16# \; select-pane -t 0 | |
# move current window left and right in the tab list, respectively. | |
bind '<' swap-window -t -1 \; previous-window | |
bind '>' swap-window -t +1 \; next-window | |
# ^B \ : resize the currently selected pane to be 80 columns | |
bind '\' resize-pane -x 80 | |
# ^B ] : resize the currently selected pane to 16 rows high | |
bind ']' resize-pane -y 16 | |
# 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" |
Per our convo, ln40 need to be update to the following for tmux 2.9
set-window-option -g window-status-current-style "bg=red"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@spikegrobstein
Just a note, I ran into a minor issue setting up a new machine.
reattach-to-user-namespace
needs to be installed or ln15 will causetmux
to immediately exit.