Skip to content

Instantly share code, notes, and snippets.

@gmena
Last active April 18, 2024 22:57
Show Gist options
  • Save gmena/09ff11c1bb093a20714edfcd8bcbe9e9 to your computer and use it in GitHub Desktop.
Save gmena/09ff11c1bb093a20714edfcd8bcbe9e9 to your computer and use it in GitHub Desktop.
My Tmux configuration
# Tmux personalization
# Works with tmux 3.0
# Usually at ~/.tmux.conf
# Author: gonzalo@mena.com.mx
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Renumber when deleting a window
set-option -g renumber-windows on
# Shortcut to reload my config file
bind r source-file ~/.tmux.conf
# Allow mouse scrolling
setw -g mouse on
# Increase up scrolling
set -g history-limit 999999
# Show current directory and current command on window name
# https://stackoverflow.com/questions/28376611/how-to-automatically-rename-tmux-windows-to-the-current-directory
# what would be ${pwd##*/} is escaped to ${pwd####*/} since # has special meaning in the format string
#set -g window-status-format '#[bold]#{window_index}#[nobold]:#(pwd="#{pane_current_path}"; echo ${pwd####*/}):#{pane_current_command}#{window_flags}'
#set -g window-status-current-format '#{window_index}:#(pwd="#{pane_current_path}"; echo ${pwd####*/}):#{pane_current_command}#{window_flags}'
set -g window-status-format '#[bold]#{window_index}#[nobold]:#{pane_current_command}#{window_flags}'
set -g window-status-current-format '#{window_index}:#{pane_current_command}#{window_flags}'
setw -g window-status-style 'fg=black nobold'
setw -g window-status-current-style 'fg=white bold'
# Status bar updates every 15s by default, change to 1s here (a lower latency might have negative battery/cpu usage impacts)
set -g status-interval 1
# Follow current directory when creating new window or pane
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Shortcuts to swap window to left or right
bind-key -r < swap-window -d -t -1
bind-key -r > swap-window -d -t +1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment