Created
August 7, 2018 10:10
-
-
Save fnurl/690976cd16dda60cf7f758bae002e4ee to your computer and use it in GitHub Desktop.
tmux config
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
# updated for tmux 2.4: use send-keys -X for copy mode | |
# Help | |
# | |
# Bindings belong to tables. The prefix table is used when the following | |
# commands are used: | |
# | |
# bind-key -T prefix <key> <command> | |
# bind-key <key> <command> | |
# | |
# i.e. the prefix table is used as a default. | |
# | |
# The root table is for bindings without using a prefix. The -n option is an | |
# alias for `bind-key -T root` | |
# | |
# The -r option makes the key binding repeatable, i.e. for prefix table keys, | |
# the prefix only has to be entered once and then the key can be typed multiple | |
# times for multiple triggerings. | |
# general bindings {{{1 | |
# use ctrl-a as prefix instead of ctrl-b | |
unbind-key C-b | |
set -g prefix C-a | |
bind-key C-a send-prefix | |
# bind-key R to reload .tmux.conf | |
bind-key -T prefix R source-file ~/.tmux.conf; display-message "~/.tmux.conf reloaded" | |
# clear both screen and history | |
bind-key -n C-l send-keys -R \; clear-history \; send-keys C-l | |
# rebind keys used for new shells to inherit CWD of parent {{{1 | |
bind-key -T prefix '"' split-window -c '#{pane_current_path}' | |
bind-key -T prefix % split-window -h -c '#{pane_current_path}' | |
bind-key -T prefix c new-window -c '~/' -n 'new window' | |
# use vim keys in modes {{{1 | |
setw -g mode-keys vi | |
# vim movement keys for pane navigation (key is repeatable (-r) and bound to the prefix table (-T prefix) | |
bind-key -r -T prefix k select-pane -U | |
bind-key -r -T prefix j select-pane -D | |
bind-key -r -T prefix h select-pane -L | |
bind-key -r -T prefix l select-pane -R | |
# copy / paste {{{1 | |
# copy mode (no table argument defaults to -T prefix) | |
unbind-key [ | |
bind-key -T prefix Escape copy-mode | |
# unbind default paste-buffer key (not doing it since I'm not binding a new one | |
unbind-key ] | |
# paste would have been nice, but I use the <prefix>p for next window binding | |
# a lot. | |
#bind p paste-buffer | |
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection | |
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection | |
# navigation and pane / window manipulation {{{1 | |
# Refs | |
# https://github.com/tmux-plugins/tmux-continuum/issues/30 | |
# https://robots.thoughtbot.com/a-tmux-crash-course | |
# fast pane switching (note: turned out to be bad since this disables <beginning | |
# of line> | |
#unbind ^A | |
#bind-key -r ^A select-pane -t :.+ | |
# move panes {{{2 | |
bind-key C-j command-prompt -p "join pane from:" "join-pane -s '%%'" | |
bind-key C-s command-prompt -p "send pane to:" "join-pane -t '%%'" | |
# pane navigation (no table argument defaults to -T prefix) {{{2 | |
bind-key -r h select-pane -L # move left | |
bind-key -r j select-pane -D # move down | |
bind-key -r k select-pane -U # move up | |
bind-key -r l select-pane -R # move right | |
#bind-key > swap-pane -D # swap current pane with the next one | |
#bind-key < swap-pane -U # swap current pane with the previous one | |
# swap window left/right {{{2 | |
bind-key -n C-S-Left swap-window -t -1 | |
bind-key -r C-p swap-window -t -1 | |
bind-key -n C-S-Right swap-window -t +1 | |
bind-key -r C-n swap-window -t +1 | |
# pane resizing {{{2 | |
# -r means repeatable | |
bind-key -r H resize-pane -L 2 | |
bind-key -r J resize-pane -D 2 | |
bind-key -r K resize-pane -U 2 | |
bind-key -r L resize-pane -R 2 | |
# mouse config {{{1 | |
# enable mouse | |
set -g mouse on | |
# bind mouse wheel up to forward the mouse event to the program running inside | |
# tmux ... dunno | |
# -n is an alias for -T root | |
# copy-mode is the emacs mode table | |
# copy-mode-vi is the vi mode table | |
bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind-key -n WheelDownPane select-pane -t= \; send-keys -M | |
bind-key -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M | |
bind-key -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up | |
bind-key -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down | |
bind-key -T copy-mode C-WheelUpPane send-keys -X halfpage-up | |
bind-key -T copy-mode C-WheelDownPane send-keys -X halfpage-down | |
# Session switching {{{1 | |
# mail session, create a window named mutt and run mutt. -A attaches if a | |
# session with the same name exists. | |
bind-key M new -A -c ~/Downloads/mail -s mail -n shell | |
# system session, create a window named shell. -A attaches if a session with the | |
# same name exists. | |
bind-key S new -A -c ~/ -s sys -n shell | |
# dev session, create a window named dev. -A attaches if a session with the | |
# same name exists. | |
bind-key D new -A -c ~/ -s dev -n shell | |
# End config }}}1 | |
#vim fdm=marker |
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
# tmux config | |
# Jody Foo / @fnurl / [email protected] | |
# General config {{{1 | |
# restore sessions when tmux is started | |
set -g @continuum-restore 'on' | |
set -g default-command "reattach-to-user-namespace -l zsh" # enable access to system clipboard | |
set -g detach-on-destroy off # detach on destroy or switch to mru session | |
# Source keybindings {{{1 | |
source-file "$HOME/.tmux/keybindings.tmux" | |
# Display {{{1 | |
set -g base-index 1 # start windows numbering at 1 | |
set -g renumber-windows on # renumber windows when a window is closed | |
set -g display-panes-time 1000 # time in ms that display-panes indicators are shown | |
set -g display-time 1500 # time in ms that status line msg are shown | |
set -g status-interval 3 # redraw status line every 10 seconds | |
# Terminal Window Title | |
set -g set-titles on | |
#set -g set-titles-string 'tmux ❯ [#S] #I:#W ❯ #{pane_current_path} ⎢ #{pane_current_command}' | |
#set -g set-titles-string 'tmux ● [#S] #I:#W 【#{pane_current_path}】#{pane_current_command}' | |
#set -g set-titles-string 'tmux [#S] #I:#W「#{pane_current_path}」«#{pane_current_command}»' | |
set -g set-titles-string 'tmux [#S] #I:#W ● #{pane_current_path} ● #{pane_current_command}' | |
# Activity monitoring and bells | |
set -g visual-activity on # show status line message for monitor-activity? | |
set -g visual-bell off # show bell message rather than send a bell to terminal? | |
set -g visual-silence on # show message when monitor-silence is enabled? | |
set -g bell-action any # when to trigger a bell when a bell is sent from: any, none, current, other | |
set -g bell-on-alert off # ring terminal bell on alert? | |
# window options | |
setw -g allow-rename off # allow programs to rename window name? | |
setw -g automatic-rename off # rename window using automatic-rename-format? | |
setw -g clock-mode-style 24 # 24 hour clock | |
setw -g monitor-activity on # monitor panes for activity | |
setw -g pane-base-index 1 # make pane numbering consistent with windows | |
# allow cursor to change (from https://github.com/neovim/neovim/wiki/FAQ) | |
#set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' | |
# Load theme {{{1 | |
#source-file "$HOME/.tmux/themes/base16.tmux" | |
#source-file "$HOME/.tmux/themes/default-dark.tmux" | |
#source-file "$HOME/.tmux/themes/default-light.tmux" | |
source-file "$HOME/.tmux/themes/pencil-light.tmux" | |
# Plugin settings {{{1 | |
set -g @continuum-restore 'on' | |
set -g @continuum-save-interval '10' | |
set -g @resurrect-capture-pane-contents 'on' | |
# tpm plugin manger {{{1 | |
# List of plugins | |
set -g @plugin 'tmux-plugins/tpm' | |
set -g @plugin 'tmux-plugins/tmux-sensible' | |
set -g @plugin 'tmux-plugins/tmux-resurrect' | |
set -g @plugin 'tmux-plugins/tmux-continuum' | |
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
run '~/.tmux/plugins/tpm/tpm' | |
# End config {{{1 | |
#vim fdm=marker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment