Skip to content

Instantly share code, notes, and snippets.

@randrews
Created September 25, 2020 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randrews/7b608eeb93275c1420395efe7874ec05 to your computer and use it in GitHub Desktop.
Save randrews/7b608eeb93275c1420395efe7874ec05 to your computer and use it in GitHub Desktop.
# This tmux.conf only works with tmux 2.3
# Also you'll really want to install xclip
# Change prefix key to C-a, like screen
set -g prefix C-a
bind C-a send-prefix
unbind C-b
# C-a r to easily reload conf
bind r source-file ~/.tmux.conf \; display "Loaded ~/.tmux.conf"
# Same key chord to open a prompt as Emacs
# bind -n M-: command-prompt
# Enable mouse
setw -g mouse on
# xterm-keys to enable ctrl-arrows
setw -g xterm-keys on
# gnome-terminal doesn't support set-clipboard
set -g set-clipboard off
# Better keys for splitting windows
bind | split-window -hc '#{pane_current_path}'
bind - split-window -vc '#{pane_current_path}'
# Better shortcut to open copy mode (all one hand)
bind Tab copy-mode
# Without xclip:
# bind -nt emacs-copy M-, copy-selection
# bind -n C-y paste-buffer
# With xclip:
bind -nt emacs-copy M-p copy-pipe "xclip -sel clipboard -i"
bind -nt emacs-copy C-p copy-pipe "xclip -sel clipboard -i"
bind -nt emacs-copy end end-of-line
bind -nt emacs-copy home start-of-line
bind -r C-y run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer"
# Removing -r from these so it doesn't screw up bash history
bind Up select-pane -U
bind Down select-pane -D
bind Left select-pane -L
bind Right select-pane -R
# Which frees us to up default repeat time so
# it works with keyboard repeat
set -g repeat-time 1000
# Easy navigation in copy mode
bind -nt emacs-copy C-left previous-word
bind -nt emacs-copy C-right next-word
bind -nt emacs-copy C-up previous-paragraph
bind -nt emacs-copy C-down next-paragraph
# Window navigation
unbind n
unbind p
bind -r M-right next-window
bind -r M-left previous-window
bind p new-window -c '#{pane_current_path}'
# list-commands and show-messages are useful commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment