Skip to content

Instantly share code, notes, and snippets.

@shariqmalik
Last active February 16, 2023 13:51
Show Gist options
  • Save shariqmalik/1302e46db7a4fb4376fe8b1b6037f01b to your computer and use it in GitHub Desktop.
Save shariqmalik/1302e46db7a4fb4376fe8b1b6037f01b to your computer and use it in GitHub Desktop.
My tmux configuration file
# Send prefix
set-option -g prefix C-d
unbind-key C-b
bind-key C-d send-prefix
set -g default-terminal "xterm-256color"
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
set -sg repeat-time 600 # increase repeat timeout
set -s focus-events on
set -g prefix2 C-a # GNU-Screen compatible prefix
bind C-a send-prefix -2
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
# disallow auto-rename window
set-window-option -g allow-rename off
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
bind-key ! break-pane -d -n _hidden_pane
bind-key @ join-pane -s $.1
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
set -g status-interval 10 # redraw status line every 10 seconds
# activity
set -g monitor-activity on
set -g visual-activity off
# -- navigation ----------------------------------------------------------------
# create session
bind C-c new-session
# find session
bind C-f command-prompt -p find-session 'switch-client -t %%'
# session navigation
bind BTab switch-client -l # move to last session
# Set easier window split keys
bind-key v split-window -h -c "#{pane_current_path}"
bind-key h split-window -v -c "#{pane_current_path}"
# pane navigation
# Use Alt-arrow keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# pane resizing
bind -r H resize-pane -L 2
bind -r J resize-pane -D 2
bind -r K resize-pane -U 2
bind -r L resize-pane -R 2
# Set Create Window in existing path
bind c new-window -c "#{pane_current_path}"
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Mouse mode
setw -g mouse on
# -- buffers -------------------------------------------------------------------
bind b list-buffers # list paste buffers
bind p paste-buffer # paste from the top paste buffer
bind P choose-buffer # choose which buffer to paste from
# New key binding for copying lines from scrollback history
bind-key -n C-y command-prompt -N -p "Number of lines to copy:" "capture-pane -S -'%1'; run 'tmux save-buffer - | xsel -ib'; display 'Copied to Clipboard!'" \;
# Indicator when Prefix is pressed
set -g status-right ' #{?client_prefix,#[reverse]<Prefix>#[noreverse] ,}"#{=21:pane_title}" %H:%M %d-%b-%y'
# --------------------------------------------------------------------------
#History limit
set -g history-limit 1000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment