Skip to content

Instantly share code, notes, and snippets.

@VeryDampTowel
Last active April 12, 2024 18:58
Show Gist options
  • Save VeryDampTowel/3f6909e579d0e79867f819cf0ba39964 to your computer and use it in GitHub Desktop.
Save VeryDampTowel/3f6909e579d0e79867f819cf0ba39964 to your computer and use it in GitHub Desktop.
Tmux Configurations
set -g default-terminal xterm-256color
set -g default-shell /bin/zsh
set -g default-command /bin/zsh
# remap prefix from 'C-b' to 'C-a'
# Remember 'C' == CTRL
# unbind C-b
# set-option -g prefix C-a
# bind-key C-a send-prefix
# split panes using | and -
# Use current directory for new pane
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# Use current directory for new window
bind c new-window -c "#{pane_current_path}"
# reload config file
bind r source-file ~/.tmux.conf
# Stop confirming kill pane
bind-key x kill-pane
# switch panes using Alt-arrow without prefix
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
# Use vim-style bindings
set -g mode-keys vi
# Scroll with mouse
# Hold shift to copy/paste to clipboard
# set -g mouse on
# Copy to clipboard
# Last field options are (p)rimary, (s)econdary, (c)lipboard
# Honestly, sometimes (c) works, sometimes (p) ¯\_(ツ)_/¯
# bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -selection c'
# TPM - Tmux Plugin Manager
# https://github.com/tmux-plugins/tpm
# Clone the following to start:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-logging'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @tpm-clean 'u' # Remap TPM uninstall to Prefix + u
set -g @resurrect-capture-pane-contents 'on'
# Shortcuts of plugins
# prefix + ctrl + s -> Save current tmux session
# prefix + ctrl + r -> Restore saved tmux session
# prefix + P -> Start/stop logging current pane
# prefix + alt + p -> save visible text on screen
# prefix + alt + P -> save complete history to file for retroactive logging
# prefix + y -> copies text from commandline to clipboard
# prefix + Y -> Copy current directory to clipboard
# prefix + [ -> Enter Copy Mode
# In Copy Mode: y -> copy current selection to clipboard
# In Copy Mode: Y -> paste the current selection to the command line
# Install TPM if not found
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment