Created
February 20, 2019 18:45
-
-
Save maplebed/155fc8a735ca6fbefcd2bf341298a234 to your computer and use it in GitHub Desktop.
My tmux config. I don't know what most of it means anymore. But it works for me.
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
# use UTF8 | |
# set -g utf8 | |
# set-window-option -g utf8 on | |
# make tmux display things in 256 colors | |
# set -g default-terminal "screen-256color" | |
set -g default-terminal "xterm-256color" | |
# set scrollback history to 30000 (30k) | |
set -g history-limit 30000 | |
# tmux messages are displayed for 1 seconds | |
set -g display-time 1000 | |
# eliminate command delay for esc in ms | |
set -sg escape-time 0 | |
# set window and pane index to 1 (0 by default) | |
set-option -g base-index 1 | |
setw -g pane-base-index 1 | |
# reload ~/.tmux.conf using PREFIX r | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" | |
# use PREFIX | to split window horizontally and PREFIX - to split vertically | |
bind | split-window -h | |
bind - split-window -v | |
# rotate to the other layout | |
bind R select-layout -n | |
# Bind 'a' to last used window to easily alternate between two windows | |
bind a last-window | |
# use " to choose from a list of windows (useful with >10) | |
bind '"' choose-window | |
# Make the current window the first window | |
bind T swap-window -t 1 | |
# Merge the most recent window into a pane on this window | |
bind m join-pane -d -s ! | |
# Merge the specified window into a pane on this one | |
bind M command 'join-pane -d -s %%' | |
# Break a pane off to its own window but keep focus here | |
bind ! break-pane -d | |
# Switch to a numbered pane | |
bind P display-panes \; command-prompt -p index "select-pane -t ':.%%'" | |
# Switch directly to numbered pane | |
#bind F1 select-pane -t :.1 | |
#bind F2 select-pane -t :.2 | |
#bind F3 select-pane -t :.3 | |
# map Vi movement keys as pane movement keys | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# and use C-h and C-l to cycle thru panes | |
bind -r C-h select-window -t :- | |
bind -r C-l select-window -t :+ | |
# resize panes using PREFIX H, J, K, L | |
bind H resize-pane -L 5 | |
bind J resize-pane -D 5 | |
bind K resize-pane -U 5 | |
bind L resize-pane -R 5 | |
# C-i for even-vertical arrangement and C-o to zoom current pane | |
bind-key C-i select-layout even-vertical | |
bind-key C-v select-layout even-horizontal | |
bind-key C-o resize-pane -y 1000 | |
# Sync panes | |
bind C-s set-window-option synchronize-panes | |
# only constrain size if two sessions are in the same window | |
#setw -g aggressive-resize on | |
# mouse control for tmux v2.1 | |
set -g mouse off | |
# --------------------- | |
# Copy & Paste | |
# --------------------- | |
# Enter copy mode with either the default [ or t | |
bind t copy-mode | |
# provide access to the clipboard for pbpaste, pbcopy | |
# set -g default-command "reattach-to-user-namespace -l $SHELL; cd ." | |
# set-option -g default-command "reattach-to-user-namespace -l zsh" | |
set-window-option -g automatic-rename on | |
# use vim keybindings in copy mode | |
setw -g mode-keys vi | |
##### blocking out this section; tmux complains on startup. | |
# # setup 'v' to begin selection as in Vim | |
# bind-key -t vi-copy v begin-selection | |
# # bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
# bind-key -t vi-copy y copy-pipe "pbcopy" | |
# | |
# # update default binding of 'Enter' to also use copy-pipe | |
# unbind -t vi-copy Enter | |
# bind-key -t vi-copy Enter copy-pipe "pbcopy" | |
bind y run 'tmux save-buffer - | pbcopy ' | |
bind C-y run 'tmux save-buffer - | pbcopy ' | |
# Save entire tmux history to a file - file will be on machine where tmux is | |
# running | |
bind-key * command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer' | |
# ---------------------- | |
# set some pretty colors | |
# ---------------------- | |
# set pane colors - hilight the active pane | |
set-option -g pane-border-fg colour235 #base02 | |
set-option -g pane-active-border-fg colour33 #blue | |
#set-option -g pane-active-border-fg colour240 #base01 | |
# colorize messages in the command line | |
set-option -g message-bg black #base02 | |
set-option -g message-fg brightred #orange | |
# ---------------------- | |
# Status Bar | |
# ----------------------- | |
set-option -g status on # turn the status bar on | |
# set -g status-utf8 on # set utf-8 for the status bar | |
set -g status-interval 5 # set update frequencey (default 15 seconds) | |
set -g status-justify centre # center window list for clarity | |
# set-option -g status-position top # position the status bar at top of screen | |
# visual notification of activity in other windows | |
setw -g monitor-activity on | |
set -g visual-activity on | |
# set color for status bar | |
set-option -g status-bg colour235 #base02 | |
set-option -g status-fg yellow #yellow | |
set-option -g status-attr dim | |
# set window list colors - green for active and yellow for inactive | |
set-window-option -g window-status-fg yellow #base0 | |
set-window-option -g window-status-bg colour236 | |
set-window-option -g window-status-attr dim | |
set-window-option -g window-status-current-fg brightgreen | |
set-window-option -g window-status-current-bg colour236 | |
set-window-option -g window-status-current-attr bright | |
set-window-option -g window-status-last-fg green | |
set-window-option -g window-status-last-bg colour236 | |
set-window-option -g window-status-last-attr bright | |
set-window-option -g window-status-format "#{window_index}.#{window_panes}:#W#F" | |
set-window-option -g window-status-current-format "#{window_index}.#{pane_index}:#W#F" | |
# Status bar notes: | |
# #(?client_prefix... highlights the status bar when you hit your tmux control character | |
# airport -I shows your current wireless network ID | |
set -g status-left-length 85 | |
set -g status-left "#{?client_prefix,#[bg=blue],}#[fg=green]#h #(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/{print $2}') " | |
# show full command name, session name, window & pane number, time, and UTC time | |
set -g status-right-length 80 | |
set -g status-right "#{?client_prefix,#[bg=blue],}#[fg=cyan]#{=15:pane_title} : #[fg=green]#S #I:#P #[fg=yellow]: %l:%M#[fg=green]|#[fg=yellow]#(date -u +%%H:%%M)" | |
# older status bar lines I cribbed this stuff from: | |
#set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(dig +short myip.opendns.com @resolver1.opendns.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig en3 | grep 'inet ' | awk '{print \"en3 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') #[fg=green]#(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/{print $2}') " | |
# set -g status-left "#[fg=green]: #h : #[fg=brightblue]#(curl icanhazip.com) #[fg=yellow]#(ifconfig en0 | grep 'inet ' | awk '{print \"en0 \" $2}') #(ifconfig en1 | grep 'inet ' | awk '{print \"en1 \" $2}') #(ifconfig en3 | grep 'inet ' | awk '{print \"en3 \" $2}') #[fg=red]#(ifconfig tun0 | grep 'inet ' | awk '{print \"vpn \" $2}') #[fg=green]#(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/{print $2}') " | |
# set -g status-left "#[fg=green]#h #(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/{print $2}') #{?client_prefix,#[bg=yellow]#[fg=black]TMUX, }" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment