diff options
Diffstat (limited to 'regress/conf')
20 files changed, 2574 insertions, 0 deletions
diff --git a/regress/conf/21867280ff7e99631046f9cc669b80d2.conf b/regress/conf/21867280ff7e99631046f9cc669b80d2.conf new file mode 100644 index 00000000..43b142b4 --- /dev/null +++ b/regress/conf/21867280ff7e99631046f9cc669b80d2.conf @@ -0,0 +1,8 @@ +%if #{l:1} +set -g status-style fg=cyan,bg='#001040' +%elif #{l:1} +set -g status-style fg=white,bg='#400040' +%else +set -g status-style fg=white,bg='#800000' +%endif +bind ^X last-window diff --git a/regress/conf/29813ff35544434e2e64dc879a8dd274.conf b/regress/conf/29813ff35544434e2e64dc879a8dd274.conf new file mode 100644 index 00000000..d0bda4a2 --- /dev/null +++ b/regress/conf/29813ff35544434e2e64dc879a8dd274.conf @@ -0,0 +1,58 @@ +set -g prefix C-g +# needed for e.g. mutt +bind C-g send-prefix + +set -g set-titles on +set -g status-position top +set -g status-keys vi +set -g mode-keys vi +set -g base-index 1 +set -g pane-base-index 1 +set -g focus-events on + +set history-file ~/.tmux_SSH_history +set focus-events on +set -g history-limit 100000 +set -s set-clipboard on +set -g display-time 3000 +set -g display-panes-time 3000 + +set -g pane-border-status top + +setw -g window-status-current-style bg=colour240,fg=colour250 +setw -g window-status-separator "|" +set -g status-bg colour235 +set -g status-fg colour245 + +set -g window-status-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }" +set -g window-status-current-format " #I #{=+15:pane_title} #{=-2:?window_flags, #{window_flags}, }" +set -g pane-border-format " #P: #{s/ //:pane_title} " + +set -g renumber-windows on +set -g status-right-length 0 +############################################################## + +# I prefer not to have a status for my tabbed term +set -g status-right "" +set -g status-right-length 0 +set -g status-left-length 0 +set -g status-left "" + +# some settings for "navigation" +bind -n C-PageUp copy-mode -u +unbind -n C-Left +unbind -n C-Right +bind -n C-Left select-window -t :- +bind -n C-Right select-window -t :+ + +# I prefer a tiled layout and easy joining of current active pane via windows' +# index +bind F1 join-pane -s 1.\; select-layout tiled +bind F2 join-pane -s 2.\; select-layout tiled +bind F3 join-pane -s 3.\; select-layout tiled +bind F4 join-pane -s 4.\; select-layout tiled +bind F5 join-pane -s 5.\; select-layout tiled +bind F6 join-pane -s 6.\; select-layout tiled +bind F7 join-pane -s 7.\; select-layout tiled +bind F8 join-pane -s 8.\; select-layout tiled +bind F9 join-pane -s 9.\; select-layout tiled diff --git a/regress/conf/2eae5d47049c1f6d0bef3db4e171aed7.conf b/regress/conf/2eae5d47049c1f6d0bef3db4e171aed7.conf new file mode 100644 index 00000000..c09adc24 --- /dev/null +++ b/regress/conf/2eae5d47049c1f6d0bef3db4e171aed7.conf @@ -0,0 +1,56 @@ +# 256 colors for vim +set -g default-terminal "screen-256color" + +# Set default shell to zsh +set-option -g default-shell /bin/zsh + +# Start window numbering at 1 +set-option -g base-index 1 +set-window-option -g pane-base-index 1 + +# Cycle panes with C-b C-b +unbind ^B +bind ^B select-pane -t :.+ + +# Reload config wtih a key +bind-key r source-file ~/.tmux.conf \; display "Config reloaded!" + +# Mouse works as expected +# set -g mode-mouse on +# set -g mouse-select-pane on +# set -g mouse-resize-pane on +# set -g mouse-select-window on + +# Scrolling works as expected +set -g terminal-overrides 'xterm*:smcup@:rmcup@' + +# Use the system clipboard +# set-option -g default-command "reattach-to-user-namespace -l zsh" + +# Clear the pane and its history +bind -n C-k send-keys C-l \; clear-history + +# smart pane switching with awareness of vim splits +bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" +bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" +bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" +bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" +bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l" + +# C-l is taken oer by vim style pane navigation +bind C-l send-keys 'C-l' + +# Use vim keybindings in copy mode +setw -g mode-keys vi + +# Setup 'v' to begin selection as in Vim +# bind-key -t vi-copy v begin-selection +# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" + +# Update default binding of `Enter` to also use copy-pipe +# unbind -t vi-copy Enter +# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" + +# Powerline +run-shell "powerline-daemon -q" +source "/Users/adamcooper/Library/Python/3.7/lib/python/site-packages/powerline/bindings/tmux/powerline.conf"
\ No newline at end of file diff --git a/regress/conf/327af72ad372255817b585a74da06eda.conf b/regress/conf/327af72ad372255817b585a74da06eda.conf new file mode 100644 index 00000000..2a719c8b --- /dev/null +++ b/regress/conf/327af72ad372255817b585a74da06eda.conf @@ -0,0 +1,30 @@ +set -sg escape-time 10 + +set -g default-terminal tmux-256color +set -g prefix ^X +set -g history-limit 10000 +setw -g mode-keys vi +setw -g xterm-keys off + +# black, red, green, yellow, blue, magenta, cyan, white, default. +setw -g message-command-style fg=yellow,bg=black +setw -g message-style fg=black,bg=yellow + +%if #{m:*mydomain*,#{host}} +set -g status-style fg=cyan,bg='#001040' +setw -g window-status-current-style fg='#f0f0f0',bg='#001040' +%elif #{||:#{m:*somedomain*,#{host}},#{m:*otherdomain*,#{host}}} +set -g status-style fg=white,bg='#400040' +setw -g window-status-current-style fg=yellow,bg='#400040',bright +%else +set -g status-style fg=white,bg='#800000' +setw -g window-status-current-style fg=brightwhite,bg='#800000' +%endif + +unbind ^B +bind ^X last-window +bind x send-prefix +bind ^C new-window +bind ^D detach-client +bind ^N next-window +bind ^P previous-window diff --git a/regress/conf/58304907c117cab9898ea0b070bccde3.conf b/regress/conf/58304907c117cab9898ea0b070bccde3.conf new file mode 100644 index 00000000..c9ce3fa4 --- /dev/null +++ b/regress/conf/58304907c117cab9898ea0b070bccde3.conf @@ -0,0 +1,118 @@ +# +# Tureba's tmux.conf +# +# To use it, either: +# a) link ~/.tmux.conf to it; or +# b) create a ~/.tmux.conf that sources it. +# +# who: Arthur Nascimento <tureba@gmail.com> +# where: github.com/tureba/myconfigfiles +# + +# defaults +set -g default-shell /bin/zsh +set -g default-command zsh +# tmux sets screen/screen-256, but has no codes for italics +set -g default-terminal tmux-256color +# linux terminal doesn't need this, but xterm does +set -g terminal-overrides 'xterm*:smcup@:rmcup@,*256col*:colors=256,xterm*:XT' +# xterm-style function key sequences +setw -g xterm-keys on + +# 1, 2 and 3 are closer together than 0, 1 and 2 +set -g base-index 1 +set -g pane-base-index 1 + +# easier to type than C-b +set -g prefix C-a +set -g prefix2 C-b +unbind C-b +bind C-a send-prefix + +# for repeatable keys +set -g repeat-time 170 + +# status bar +set -g status-style fg=green,bg=colour234 +set -g status-right-style bg=colour236 +set -g status-right "#[bold,fg=blue][#[fg=default]#T#[fg=blue]]#[nobold,fg=default] | #[fg=yellow]%F %R" +set -g status-right-length 120 +set -g status-left-style bg=colour236,bright +set -g status-left "#[fg=blue][#[fg=default]#h#[fg=cyan]:#[fg=default]#S#[fg=blue]]" +set -g status-left-length 30 +setw -g window-status-style fg=green +setw -g window-status-format " #I#[nobold]:#W " +setw -g window-status-current-style fg=green,bright +setw -g window-status-current-format "#[fg=red][#[fg=default]#I:#W#[fg=red]]" +setw -g window-status-separator "|" +setw -g window-status-activity-style blink +setw -g window-status-bell-style blink +setw -g window-status-last-style bright + +# enable wm window titles +set -g set-titles on + +# auto window rename +setw -g automatic-rename on +# auto window resize +setw -g aggressive-resize on + +# mouse settings +set -g mouse on + +# var|bind \ cmd | vim | less | copy | zsh +# pane_in_mode | 0 | 0 | 1 | 0 +# mouse_any_flag | 1 | 0 | 0 | 0 +# alternate_on | 1 | 1 | 0 | 0 +# WheelUpPane | send -M | send Up | * | send Up (** or copy-mode -e) +# WheelDownPane | send -M | send Down | * | send Down +# * panes in copy mode have scroll handled by different bindings + +# ** cycle over shell history +#bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'send -Mt=' 'send -t= Up' + +# ** enter copy mode +bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'send -Mt=' 'if -Ft= "#{alternate_on}" "send -t= Up" "copy-mode -et="' + +bind -T root WheelDownPane if -Ft= '#{mouse_any_flag}' 'send -Mt=' 'send -t= Down' + +# sensible v/h splits +unbind % +unbind '"' +bind | split-window -h +bind - split-window -v + +# hjkl pane traversal +bind -r h select-pane -L +bind -r j select-pane -D +bind -r k select-pane -U +bind -r l select-pane -R + +# window navigation +unbind p +bind -r [ previous-window +unbind n +bind -r ] next-window + +# Vi copypaste mode +setw -g mode-keys vi +bind C-c copy-mode +bind p paste-buffer +bind -T copy-mode-vi v send-keys -X begin-selection +bind -T copy-mode-vi y send-keys -X copy-selection +bind -T copy-mode-vi V send-keys -X rectangle-toggle + +# toggle window activity monitoring +bind m setw monitor-activity + +# reload the configuration +bind r source-file ~/.tmux.conf + +# toggle synchronize-panes +bind S setw synchronize-panes + +# create a new window with exactly this command +bind C command-prompt "new-window 'exec %%'" + +# (toggle) mark this pane for easier joins and swaps +bind . select-pane -m diff --git a/regress/conf/872441a98b06444acc5ce08eb24aabde.conf b/regress/conf/872441a98b06444acc5ce08eb24aabde.conf new file mode 100644 index 00000000..b074ad76 --- /dev/null +++ b/regress/conf/872441a98b06444acc5ce08eb24aabde.conf @@ -0,0 +1,26 @@ +bind -r Up if -F '#{pane_at_top}' '' 'selectp -U' +bind -r Down if -F '#{pane_at_bottom}' '' 'selectp -D' +bind -r Left if -F '#{pane_at_left}' '' 'selectp -L' +bind -r Right if -F '#{pane_at_right}' '' 'selectp -R' + +bind -n WheelUpPane if -Ft= "#{mouse_any_flag}" "send -M" "send Up" +bind -n WheelDownPane if -Ft= "#{mouse_any_flag}" "send -M" "send Down" + +bind w run 'tmux choose-tree -Nwf"##{==:##{session_name},#{session_name}}"' + +bind C { + splitw -f -l30% '' + set-hook -p pane-mode-changed 'if -F "#{!=:#{pane_mode},copy-mode}" "kill-pane"' + copy-mode -s'{last}' +} + +set -g word-separators "" +bind -n C-DoubleClick1Pane if -F '#{m/r:^[^:]*:[0-9]+:,#{mouse_word}}' { + run -C { popup -w90% -h90% -E -d '#{pane_current_path}' ' + emacs `echo #{mouse_word}|awk -F: "{print \"+\"\\$2,\\$1}"` + ' } +} { + run -C { popup -w90% -h90% -E -d '#{pane_current_path}' ' + emacs "#{mouse_word}" + ' } +} diff --git a/regress/conf/91378fd400b0444eb8cac471e30642b3.conf b/regress/conf/91378fd400b0444eb8cac471e30642b3.conf new file mode 100644 index 00000000..40810076 --- /dev/null +++ b/regress/conf/91378fd400b0444eb8cac471e30642b3.conf @@ -0,0 +1,30 @@ +### + +if-shell " \ + tmux -V \ + | awk '{print $2}' \ + | awk -F - '{print $1}' \ + | awk '{ \ + if ($1 ~ /^[[:digit:].]+$/) { \ + exit !($1 >= 2.6) \ + } else { \ + exit !($1 == \"master\" || $1 == \"next\") \ + } \ + }'" \ + "source-file ~/.tmux/v2rc" \ + "source-file ~/.tmux/v1rc" \ + ; + +### + +set-option -qg status-left \ + "[#[fg=yellow]#{session_name}#[default]] #[fg=colour060]#{host_short}#[default]:#[fg=colour151]#{b:pane_current_path} #[fg=colour099]#(git -C #{pane_current_path} symbolic-ref --short HEAD) #[fg=green]#(git -C #{pane_current_path} status --porcelain --untracked-files=no | cut -b 1-1 | sort | uniq | awk '/^[^[:space:]]/ {printf\(\"%%s\", $0\)}')#[fg=red]#(git -C #{pane_current_path} status --porcelain --untracked-files=no | cut -b 2-2 | sort | uniq | awk '/^[^[:space:]]/ {printf\(\"%%s\", $0\)}')#[fg=colour113]#(git -C #{pane_current_path} stash list 2>/dev/null | wc -l | tr -d '\n' | sed s,^0\$,,) #[default]" + +set-option -qg status-right \ + "#[default] ┊ #[fg=colour065]#(grep ^MemFree /proc/meminfo | awk '{print rshift\($2, 10\)}')#[fg=colour071]m #[default]┊ #[fg=colour101]#(echo \"\(`awk '{print \$1}' /proc/loadavg` / `grep ^processor /proc/cpuinfo | wc -l`\) \* 100\" | bc -ql | sed 's,\\..*,,' | awk '{printf\(\"%%2u\", $0\)}')#[fg=colour102]%% " + +set-option -qwg window-status-current-format \ + "#[fg=colour208]»#[fg=colour190]#{window_name}#[fg=colour037]·#{?window_flags,#[fg=colour058]#{window_flags}#[default], #[default]}" + +set-option -qwg window-status-format \ + "#[default]»#[fg=colour066]#{window_name}#[fg=colour037]·#{?window_flags,#[fg=colour058]#{window_flags}#[default], #[default]}" diff --git a/regress/conf/99749670b62bcb99a9b2e3d59708e357.conf b/regress/conf/99749670b62bcb99a9b2e3d59708e357.conf new file mode 100644 index 00000000..dd1700b0 --- /dev/null +++ b/regress/conf/99749670b62bcb99a9b2e3d59708e357.conf @@ -0,0 +1,93 @@ +# ----------------------------------------------------------------------------- +# This config is targeted for tmux 2.1+ and should be placed in $HOME. +# +# Read the "Plugin Manager" section (bottom) before trying to use this config! +# ----------------------------------------------------------------------------- + +# ----------------------------------------------------------------------------- +# Global options +# ----------------------------------------------------------------------------- + +# Set a new prefix / leader key. +set -g prefix ` +bind ` send-prefix + +# Allow opening multiple terminals to view the same session at different sizes. +setw -g aggressive-resize on + +# Remove delay when switching between Vim modes. +set -s escape-time 0 + +# Allow Vim's FocusGained to work when your terminal gains focus. +# Requires Vim plugin: https://github.com/tmux-plugins/vim-tmux-focus-events +set -g focus-events on + +# Add a bit more scroll history in the buffer. +set -g history-limit 50000 + +# Enable color support inside of tmux. +set -g default-terminal "screen-256color" + +# Ensure window titles get renamed automatically. +setw -g automatic-rename + +# Start windows and panes index at 1, not 0. +set -g base-index 1 +setw -g pane-base-index 1 + +# Enable full mouse support. +set -g mouse on + +# Status bar optimized for Gruvbox. +set -g status-fg colour244 +set -g status-bg default +set -g status-left '' +set -g status-right-length 0 +#set -g status-right-length 20 +#set -g status-right '%a %Y-%m-%d %H:%M' + +set -g pane-border-fg default +set -g pane-border-bg default +set -g pane-active-border-fg colour250 +set -g pane-active-border-bg default + +set-window-option -g window-status-current-attr bold +set-window-option -g window-status-current-fg colour223 + +# ----------------------------------------------------------------------------- +# Key bindings +# ----------------------------------------------------------------------------- + +# Unbind default keys +unbind C-b +unbind '"' +unbind % + +# Reload the tmux config. +bind-key r source-file ~/.tmux.conf + +# Split panes. +bind-key h split-window -v +bind-key v split-window -h + +# Move around panes with ALT + arrow keys. +bind-key -n M-Up select-pane -U +bind-key -n M-Left select-pane -L +bind-key -n M-Down select-pane -D +bind-key -n M-Right select-pane -R + +# ----------------------------------------------------------------------------- +# Plugin Manager - https://github.com/tmux-plugins/tpm +# In order to use the plugins below you need to install TPM and the plugins. +# Step 1) git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +# Step 2) Reload tmux if it's already started with `r +# Step 3) Launch tmux and hit `I (capital i) to fetch any plugins +# ----------------------------------------------------------------------------- + +# List of plugins. +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @plugin 'tmux-plugins/tmux-yank' + +# Initialize TPM (keep this line at the very bottom of your tmux.conf). +run -b '~/.tmux/plugins/tpm/tpm' diff --git a/regress/conf/a46e6e84cd1071105aa807256dbc158d.conf b/regress/conf/a46e6e84cd1071105aa807256dbc158d.conf new file mode 100644 index 00000000..bfbb2d3e --- /dev/null +++ b/regress/conf/a46e6e84cd1071105aa807256dbc158d.conf @@ -0,0 +1,432 @@ +# Dynamic configuration file generated by ~/Makefile from /home/sunny/.tmux.conf.erb +# +# DO NOT EDIT THIS FILE BY HAND -- +# YOUR CHANGES WILL BE OVERWRITTEN +# + + + +bind-key R source ~/.tmux.conf \; display-message 'config reloaded!' + +#----------------------------------------------------------------------------- +# terminal +#----------------------------------------------------------------------------- + +# enable mouse support for general selection and control +set-option -g mouse on + +# auto-set terminal title to current window pane's title +set-option -g set-titles on + +# enable 256-color support for pretty colorschemes in Vim +set-option -g default-terminal 'screen-256color' + +# allow Vim to receive focus events from terminal window +set-option -g focus-events on + +# allow Vim to recieve modifier keys: Shift, Control, Alt +set-window-option -g xterm-keys on + +# prevent tmux from catching modifier keys meant for Vim +set-option -s escape-time 0 + +# enable 24-bit true color RGB escape sequences under st +# https://sunaku.github.io/tmux-24bit-color.html +set-option -ga terminal-overrides ',st-256color:Tc' +set-option -ga terminal-overrides ',xterm-256color:Tc' # hterm (ChromeOS) + +# allow set-titles to change the window title under XTerm +# http://opennomad.com/content/goodbye-screen-hello-tmux +set-option -ga terminal-overrides ',xterm*:XT' + +# allow set-titles to change the window title under XTerm +# http://opennomad.com/content/goodbye-screen-hello-tmux +# http://stackoverflow.com/questions/15195624 +set-option -ga terminal-overrides ',st-256color:smkx=\E=' + +# yank to system clipboard rather than primary selection +# http://invisible-island.net/xterm/terminfo-contents.html#tic-xterm_tmux +set-option -ga terminal-overrides ',xterm*:Ms=\E]52;c;%p2%s\007' + +# KiTTY always appends to clipboard; must clear it first +# https://sw.kovidgoyal.net/kitty/protocol-extensions.html#pasting-to-clipboard +set-option -ga terminal-overrides ',xterm-kitty:Ms=\E]52;c;!\007\E]52;c;%p2%s\007' + +# prevent standout from appearing as italics under URxvt +# http://comments.gmane.org/gmane.comp.terminal-emulators.tmux.user/1927 +set-option -ga terminal-overrides ',rxvt-unicode*:sitm@' + +#----------------------------------------------------------------------------- +# appearance +#----------------------------------------------------------------------------- + +# Colors from the "lucius" and "gruvbox" themes in the vim-airline plugin: +# https://github.com/bling/vim-airline/blob/master/autoload/airline/themes/lucius.vim +# https://github.com/morhetz/gruvbox/blob/master/autoload/airline/themes/gruvbox.vim + +set-option -g status-style fg=colour246,bg=colour237 +set-window-option -g window-status-current-style fg=colour214,bg=colour239 +set-option -g pane-border-style fg=colour239 +set-option -g pane-active-border-style fg=colour208 +set-option -g message-style fg=colour214,bg=colour239 +set-window-option -g mode-style fg=colour214,bg=colour239,bold,reverse + +# Common UI interaction cues from Blueprint CSS: +# http://blueprintcss.org/tests/parts/forms.html +set-window-option -g window-status-bell-style 'bg=#205791,fg=#d5edf8' # info (blue) +set-window-option -g window-status-activity-style 'bg=#8a1f11,fg=#fbe3e4' # error (red) + +#----------------------------------------------------------------------------- +# status bar +#----------------------------------------------------------------------------- + +# toggle status bar visibility +bind-key -n M-` set-option -g status + +# toggle status bar position +bind-key -n M-~ \ + if-shell 'tmux show-option -g status-position | grep -q top$' \ + 'set-option -g status-position bottom' \ + 'set-option -g status-position top' + +# put status bar at the top of the screen +set-option -g status-position top + +# list windows on left side of status bar +set-option -g status-left-length 0 + +# make window list easier to scan +set-window-option -g window-status-format ' #[bold]#I#F#[nobold]#W ' +set-window-option -g window-status-current-format ' #[bold]#I#F#[nobold]#W ' +set-window-option -g window-status-separator '' + +# show pane title, pane identifier, and hostname on right side of status bar +set-option -g status-right-length 64 +set-option -g status-right '#{=32:pane_title} \ +#[fg=colour214,bg=colour239] #S:#I.#P \ +#(test -n "$SSH_TTY" && echo "#[fg=colour214,bg=colour239,bold,reverse] #H ")' + +#----------------------------------------------------------------------------- +# windows +#----------------------------------------------------------------------------- + +# create window +bind-key -n M-e new-window + +# rename window +bind-key -n M-E command-prompt -I '#W' 'rename-window "%%%"' + +set-window-option -g automatic-rename off + + +# break off pane to a new window +bind-key -n M-x \ + command-prompt -p 'break-pane:' -I '#W' \ + 'break-pane ; rename-window "%%%"' +bind-key -n M-X break-pane + +# focus window +bind-key -n M-, previous-window +bind-key -n M-. next-window +bind-key -n M-o last-window + +# focus by number +set-option -g base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on +bind-key -n M-0 choose-window +bind-key -n M-1 select-window -t :1 +bind-key -n M-2 select-window -t :2 +bind-key -n M-3 select-window -t :3 +bind-key -n M-4 select-window -t :4 +bind-key -n M-5 select-window -t :5 +bind-key -n M-6 select-window -t :6 +bind-key -n M-7 select-window -t :7 +bind-key -n M-8 select-window -t :8 +bind-key -n M-9 select-window -t :1 \; select-window -t :-1 + +# swap window +bind-key -n M-< swap-window -t :-1 +bind-key -n M-> swap-window -t :+1 + +# monitor window +set-option -g visual-activity on +set-option -g visual-silence on + + +bind-key -n M-k \ + set-window-option monitor-activity \;\ + display-message 'monitor-activity #{?monitor-activity,on,off}' + +bind-key -n M-K \ + if-shell 'tmux show-window-option -g monitor-activity | grep -q off$' \ + 'set-window-option -g monitor-activity on' \ + 'set-window-option -g monitor-activity off' \;\ + display-message 'monitor-activity #{?monitor-activity,on,off} (global)' + +bind-key -n M-j \ + command-prompt -p 'monitor-silence (seconds):' -I '#{monitor-silence}' \ + 'set-window-option monitor-silence %% ;\ + display-message "monitor-silence #{?monitor-silence,on,off}"' + +#----------------------------------------------------------------------------- +# panes +#----------------------------------------------------------------------------- + +# send input to all panes in window (toggle) +bind-key C-a \ + set-option synchronize-panes \;\ + display-message 'synchronize-panes #{?synchronize-panes,on,off}' + +# clear the screen in all panes in window +bind-key C-l \ + set-option synchronize-panes on \;\ + send-keys C-l \;\ + set-option synchronize-panes off + +# create pane (below, above, left, right) +bind-key -n M-c split-window -c '#{pane_current_path}' +bind-key -n M-C split-window -c '#{pane_current_path}' -b +bind-key -n M-R split-window -c '#{pane_current_path}' -b -h +bind-key -n M-r split-window -c '#{pane_current_path}' -h + +# join pane (above, left, below, right) +bind-key -n M-g move-pane -t .-1 -s . # join pane at bottom of prev pane +bind-key -n M-l move-pane -t .-1 -s . -h # join pane at right of prev pane +bind-key -n M-G move-pane -d -s .+1 -t . # join next pane at bottom +bind-key -n M-L move-pane -d -s .+1 -t . -h # join next pane at right + +# Intelligently navigate tmux panes and Vim splits using the same keys. +# See https://sunaku.github.io/tmux-select-pane.html for documentation. +# +# +-------------+------------+-----------------------------+ +# | inside Vim? | is Zoomed? | Action taken by key binding | +# +-------------+------------+-----------------------------+ +# | No | No | Focus directional tmux pane | +# | No | Yes | Nothing: ignore key binding | +# | Yes | No | Seamlessly focus Vim / tmux | +# | Yes | Yes | Focus directional Vim split | +# +-------------+------------+-----------------------------+ +# +vim_navigation_timeout=0.05 # number of seconds we give Vim to navigate +navigate=' \ + pane_is_zoomed() { \ + test #{window_zoomed_flag} -eq 1; \ + }; \ + pane_title_changed() { \ + test "#{pane_title}" != "$(tmux display -p "##{pane_title}")"; \ + }; \ + command_is_vim() { \ + case "${1%% *}" in \ + (vi|?vi|vim*|?vim*|view|?view|vi??*) true ;; \ + (*) false ;; \ + esac; \ + }; \ + pane_contains_vim() { \ + case "#{=3:pane_current_command}" in \ + (git|ssh|sh) command_is_vim "#{=5:pane_title}" ;; \ + (*) command_is_vim "#{=5:pane_current_command}" ;; \ + esac; \ + }; \ + pane_contains_neovim_terminal() { \ + test "#{=12:pane_title}" = "nvim term://"; \ + }; \ + navigate() { \ + tmux_navigation_command=$1; \ + vim_navigation_command=$2; \ + vim_navigation_only_if=${3:-true}; \ + if pane_contains_vim && eval "$vim_navigation_only_if"; then \ + if pane_contains_neovim_terminal; then \ + tmux send-keys C-\\ C-n; \ + fi; \ + eval "$vim_navigation_command"; \ + if ! pane_is_zoomed; then \ + sleep $vim_navigation_timeout; : wait for Vim to change title; \ + if ! pane_title_changed; then \ + eval "$tmux_navigation_command"; \ + fi; \ + fi; \ + elif ! pane_is_zoomed; then \ + eval "$tmux_navigation_command"; \ + fi; \ + }; \ +navigate ' +navigate_left=" $navigate 'tmux select-pane -L' 'tmux send-keys C-w h'" +navigate_down=" $navigate 'tmux select-pane -D' 'tmux send-keys C-w j'" +navigate_up=" $navigate 'tmux select-pane -U' 'tmux send-keys C-w k'" +navigate_right="$navigate 'tmux select-pane -R' 'tmux send-keys C-w l'" +navigate_back=" $navigate 'tmux select-pane -l || tmux select-pane -t1'\ + 'tmux send-keys C-w p' \ + 'pane_is_zoomed' " + +## QWERTY keys - comment these out if you don't use QWERTY layout! +#bind-key -n M-h run-shell -b "$navigate_left" +#bind-key -n M-j run-shell -b "$navigate_down" +#bind-key -n M-k run-shell -b "$navigate_up" +#bind-key -n M-l run-shell -b "$navigate_right" +#bind-key -n M-\ run-shell -b "$navigate_back" + +# Dvorak keys - comment these out if you don't use Dvorak layout! +bind-key -n M-d run-shell -b "$navigate_back" +bind-key -n M-h run-shell -b "$navigate_left" +bind-key -n M-t run-shell -b "$navigate_up" +bind-key -n M-n run-shell -b "$navigate_down" +bind-key -n M-s run-shell -b "$navigate_right" + +# resize pane +bind-key -r H resize-pane -L 5 +bind-key -r T resize-pane -U 5 +bind-key -r N resize-pane -D 5 +bind-key -r S resize-pane -R 5 + +# zoom pane +bind-key -n M-m resize-pane -Z + +# swap pane +bind-key -n M-- swap-pane -D +bind-key -n M-_ swap-pane -U +bind-key -n M-D run-shell 'tmux select-pane -l \; swap-pane -d -s #D' +bind-key -n M-H run-shell 'tmux select-pane -L \; swap-pane -d -s #D' +bind-key -n M-T run-shell 'tmux select-pane -U \; swap-pane -d -s #D' +bind-key -n M-N run-shell 'tmux select-pane -D \; swap-pane -d -s #D' +bind-key -n M-S run-shell 'tmux select-pane -R \; swap-pane -d -s #D' + +# attach by number +bind-key -n 'M-!' join-pane -t :1 +bind-key -n 'M-@' join-pane -t :2 +bind-key -n 'M-#' join-pane -t :3 +bind-key -n 'M-$' join-pane -t :4 +bind-key -n 'M-%' join-pane -t :5 +bind-key -n 'M-^' join-pane -t :6 +bind-key -n 'M-&' join-pane -t :7 +bind-key -n 'M-*' join-pane -t :8 +bind-key -n 'M-(' run-shell 'tmux select-window -t :1 \;\ + select-window -t :-1 \;\ + join-pane -s "#{pane_id}"' +bind-key -n 'M-)' choose-window 'join-pane -t "%%%"' + +# promote pane (toggle) +bind-key -n M-Enter \ + if-shell 'test #P -ne 1' \ + 'select-pane -t 1' \ + 'last-pane; swap-pane -s 1' + +# rotate panes +bind-key -n M-a rotate-window -D +bind-key -n M-A rotate-window -U + +#----------------------------------------------------------------------------- +# layouts +#----------------------------------------------------------------------------- + +bind-key M-w select-layout main-horizontal +bind-key M-W select-layout even-vertical +bind-key M-v select-layout main-vertical +bind-key M-V select-layout even-horizontal +bind-key M-z select-layout tiled + +# half-screen tiling layouts (horizontal, vertical) +# https://sunaku.github.io/tmux-half-screen-tiling-layouts.html +bind-key -n M-w select-layout main-horizontal \;\ + run-shell 'tmux resize-pane -t 1 -y $(( #{window_height} / 2 ))' +bind-key -n M-v select-layout main-vertical \;\ + run-shell 'tmux resize-pane -t 1 -x $(( #{window_width} / 2 ))' + +# binary space partitioned layouts (dwindle, spiral) +# https://sunaku.github.io/tmux-layout-dwindle.html +bind-key -n M-w run-shell 'tmux-layout-dwindle brhc && tmux-redraw-vim' +bind-key -n M-W run-shell 'tmux-layout-dwindle trhc && tmux-redraw-vim' +bind-key -n M-v run-shell 'tmux-layout-dwindle brvc && tmux-redraw-vim' +bind-key -n M-V run-shell 'tmux-layout-dwindle blvc && tmux-redraw-vim' |