Skip to content

Instantly share code, notes, and snippets.

@NickLarsenNZ
Created October 17, 2021 23:01
Show Gist options
  • Save NickLarsenNZ/b5b51bcd3c03f156d9f92f76e774aa1d to your computer and use it in GitHub Desktop.
Save NickLarsenNZ/b5b51bcd3c03f156d9f92f76e774aa1d to your computer and use it in GitHub Desktop.
Tmux Configs
bind-key D run-shell 'tmux send-keys $(date +%F)'
# The main tmux config file for this machine.
# I like to set per-machine colors so I know where I am!
# Tip: Use named colors so they look good with different terminal themes.
# Unsure what these did, so I removed them
#set -g prefix C-b
#bind-key C-b send-prefix
# prefix+R: Reload of the config
bind-key R source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf."
# maintain pwd when splitting pane
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Start window and pane indices at 1 and rename to the current path.
set -g automatic-rename "on"
set -g automatic-rename-format '#{b:pane_current_path}'
set -g allow-rename "on"
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows "on"
bind -Tcopy-mode WheelUpPane send -N1 -X scroll-up
bind -Tcopy-mode WheelDownPane send -N1 -X scroll-down
source-file ~/.tmux.nav.conf
source-file ~/.tmux.theme.conf
source-file ~/.tmux.mouse.conf
source-file ~/.tmux.commands.conf
setw -g mode-keys vi
set -g mouse on
set -g default-command "reattach-to-user-namespace -l bash"
bind-key -T copy-mode-vi v send-keys -X begin-selection]
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection-and-cancel "reattach-to-user-namespace pbcopy"
# map vi movement keys as pane movement keys
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Move the current window left/right
bind-key -r C-p swap-window -t -1 # maybe make this C-h
bind-key -r C-n swap-window -t +1 # maybe make this C-l
# https://hackernoon.com/customizing-tmux-b3d2a5050207 -> https://raw.githubusercontent.com/sbernheim4/dotfiles/master/.tmux.conf
# Download a font containing powerline icons:
# brew cask install homebrew/cask-fonts/font-liberation-mono-for-powerline
# Set opacity to 100% in Mac Terminal because the foreground colours don't go transparent.
# Set Character Spacing to 0.95, Line spacing to 0.855 to fix up powerline alignment issues
# Set foregound and background colours the same (or disable bold colours), otherwise powerline solid background to arrow foreground don't match up
set -g pane-active-border-style fg=colour1
set -g status-fg white
set -g status-bg black
setw -g window-status-current-style bold
set -g default-terminal "screen-256color"
#Set the left and right status
set -g status-left '#[bg=colour7]#[fg=colour0]#{?client_prefix,#[bg=colour2],} ❐ #S #[bg=colour0]#[fg=colour7]#{?client_prefix,#[fg=colour2],}#{?window_zoomed_flag, 🔍 ,}#[fg=colour1] ♥ #((pmset -g batt || acpi -b) 2>/dev/null | grep -m 1 -Eo "[0-9]+%%") '
set -g status-right '#[fg=colour7]#[bg=colour7] #[fg=colour0]#(uptime | grep -o "[0-9]\+ days\?" || echo "0 days") #[fg=colour1]#[fg=colour3]#[bg=colour3]#[fg=colour0] #(echo "$(whoami)@$(hostname)") #[bg=colour3]#[fg=colour1]#[bg=colour1]#[fg=colour0] %d %b %H:%M '
# length of tmux status line
set -g status-left-length 30
set -g status-right-length 150
# customize how windows are displayed in the status line
set -g window-status-current-format "#[fg=colour0]#[bg=colour4]#[fg=colour7]#[bg=colour4] #I* #[fg=colour7] #W #[fg=colour4]#[bg=colour0]"
set -g window-status-format "#[fg=white]#[bg=colour0]#I-#[fg=lightwhite]  #W"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment