- use emacs key binding mode
- add colors and other changes like prefix related key binding
- disable mouse support as it interferes with x-selection
Last active
June 17, 2020 15:21
-
-
Save suntong/d5b5b11dd86404f413506b7d13b4963d to your computer and use it in GitHub Desktop.
~/.tmux.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Principle | |
# 1. Use screen key binding for common tasks. | |
# 2.1 Use default tmux key binding as much as possible. | |
# 2.2 For the rest, use the setting from tmux book written by Brian P. Hogan | |
# 3. Set escape key (prefix in tmux term) to ^z | |
# References | |
# https://www.dayid.org/comp/tm.html | |
# http://manpages.org/screen http://manpages.org/tmux | |
# https://danielmiessler.com/study/tmux/ | |
# https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/ | |
# https://gist.github.com/terrywang/3950393 | |
# https://gist.github.com/jaceju/d3263bc90e30ba765c7922690a4ecc65 | |
############################################# | |
# ## Set escape key (prefix in tmux) to ^z | |
# Set the prefix to ^Z. | |
unbind C-b | |
set -g prefix ^Z | |
#bind ^z send-prefix # this is default | |
# toggle zoom-state of current pane (maximize/return current pane) | |
bind-key z resize-pane -Z | |
# Setting the delay between prefix and command | |
set -s escape-time 1 | |
############################################# | |
# ## Use screen key binding for common tasks | |
# screen ^C c | |
unbind ^C | |
bind ^C new-window | |
bind c new-window | |
# detach ^D d | |
unbind ^D | |
bind ^D detach | |
# Switch to last window (screen default being ^a ^a) | |
unbind l | |
bind-key C-a last-window | |
bind ^Z last-window | |
# Use emacs key binding mode | |
setw -g mode-keys emacs | |
############################################# | |
# ## from tmux book written by Brian P. Hogan | |
# Set the base index for windows to 1 instead of 0 | |
set -g base-index 1 | |
# Set the base index for panes to 1 instead of 0 | |
setw -g pane-base-index 1 | |
# Enable activity alerts | |
setw -g monitor-activity on | |
set -g visual-activity on | |
# Set the default terminal mode to 256color mode | |
set -g default-terminal "screen-256color" | |
# Set Terminal Emulator Titles - OFF by default | |
# set -g set-titles on | |
# == Pane (Split Window) | |
# Splitting panes replace % and " | |
bind | split-window -h | |
bind - split-window -v | |
# pane navigation, navigate panes ala Vim | |
bind -r h select-pane -L # move left | |
bind -r j select-pane -D # move down | |
bind -r k select-pane -U # move up | |
bind -r l select-pane -R # move right | |
# 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 | |
# Update the status bar every sixty seconds | |
set -g status-interval 60 | |
############################################# | |
# ## Scrolling | |
# Mouse support | |
set -g mouse off | |
# history buffer - max number of lines for each window | |
set -g history-limit 20000 | |
############################################# | |
# ## tmux colors | |
# tmux coloring | |
# Set the status line's colors | |
set -g status-style fg=white,bg=black | |
# Set the color of the window list | |
setw -g window-status-style fg=cyan,bg=default,dim | |
# Set colors for the active window | |
setw -g window-status-current-style fg=white,bg=red,bright | |
# Pane colors | |
set -g pane-border-style fg=green,bg=black | |
set -g pane-active-border-style fg=white,bg=yellow | |
# Reload the file with Prefix r | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" | |
# user defined overrides | |
if '[ -f ~/.tmux.conf.local ]' 'source ~/.tmux.conf.local' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment