Skip to content

Instantly share code, notes, and snippets.

@nkaretnikov
Created May 5, 2020 10:27
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 nkaretnikov/912ef9bbdc8e12fc27d0244b934216f2 to your computer and use it in GitHub Desktop.
Save nkaretnikov/912ef9bbdc8e12fc27d0244b934216f2 to your computer and use it in GitHub Desktop.
My tmux config from a macOS machine
# Change the prefix to C-t.
unbind C-b
set -g prefix C-t
# Default shell.
set-option -g default-shell /bin/zsh
# set -g default-shell $SHELL
# Make clipboard copy/paste work.
# set -g default-command "reattach-to-user-namespace -l ${SHELL}"
# vi-like key bindings.
set-window-option -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
bind c copy-mode
bind-key C-t select-pane -t :.+
bind w new-window
# Resize panes with mouse.
# Old options:
# set -g mode-mouse on
# set -g mouse-resize-pane on
# Requires iTerm or additional tweaking to Terminal:
# http://www.davidverhasselt.com/enable-mouse-support-in-tmux-on-os-x/
# set-option -g mouse on
# Resize panes using prefix with hjkl.
bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5
# Move panes between windows.
# <prefix> [session]:window
bind-key F command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key T command-prompt -p "send pane to:" "join-pane -t '%%'"
# Emulate visual selection. 'v' starts a selection and 'y' finishes it.
# bind-key -t vi-copy v begin-selection
bind-key -T copy-mode-vi v send-keys -X begin-selection
# bind-key -t vi-copy y copy-selection -x
bind-key -T copy-mode-vi y send-keys -X copy-selection
# bind-key -t vi-copy Y copy-pipe 'xclip -in -selection clipboard'
# This is for new tmux and is macOS-specific.
bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
# Paste.
unbind p
bind p paste-buffer
# bind P run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
# macOS-specific.
bind P run "pbpaste | tmux load-buffer - ; tmux paste-buffer"
# More history.
set-option -g history-limit 10000
# Reload tmux config.
bind-key r source-file ~/.tmux.conf
# Allow to move using Shift+arrow or Ctrl+arrow in Vim cmdline mode.
set-window-option -g xterm-keys on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment