diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-05-21 08:01:57 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2019-05-21 08:02:17 +0100 |
commit | afe231c94cc4cc013f74d0c5511987f70b697875 (patch) | |
tree | 2178a48f89398689e73d22e9538b964e50769c5d /regress/conf | |
parent | 98ee93bde39b608fbcdca3b246b7d2088740f7cb (diff) |
Add a few test configs thanks to various people.
Diffstat (limited to 'regress/conf')
-rw-r--r-- | regress/conf/91378fd400b0444eb8cac471e30642b3.conf | 30 | ||||
-rw-r--r-- | regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf | 80 | ||||
-rw-r--r-- | regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf | 580 | ||||
-rw-r--r-- | regress/conf/d2e576f947e108eb9903679b65c81fbc.conf | 198 | ||||
-rw-r--r-- | regress/conf/e2661d67d0d45a8647fb95de76ec8174.conf | 78 | ||||
-rw-r--r-- | regress/conf/ed08995f38b5a3079262a88d2563abe4.conf | 283 |
6 files changed, 1249 insertions, 0 deletions
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/a4789a6782859c66aa8c9614ee6fabfa.conf b/regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf new file mode 100644 index 00000000..7f4a8cd1 --- /dev/null +++ b/regress/conf/a4789a6782859c66aa8c9614ee6fabfa.conf @@ -0,0 +1,80 @@ +set -g default-command "if [ \"$(uname)\" = 'Darwin' ]; then exec reattach-to-user-namespace $SHELL; else exec $SHELL; fi" +set -g history-limit 32000 +set -g update-environment "DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION SSH_CLIENT SSH_TTY KRB5CCNAME Apple_PubSub_Socket_Render Apple_Ubiquity_Message" + +# Reset SHLVL (otherwise it is 2 inside tmux) +setenv -g SHLVL 0 + +# Send esc faster so that neovim won't get so laggy +# https://github.com/neovim/neovim/issues/2093 +set -g escape-time 100 + +# Disable paste detection +set -g assume-paste-time 0 + +# Titles and window names +set -g set-titles on +set -g set-titles-string "#T" + +# Make it not so annoying/sticky to switch windows +set -g repeat-time 170 + +# Don't deattach me when a session ends +set -g detach-on-destroy off + +# Make shift+keys work +setw -g xterm-keys on + +# Prefix +set -g prefix ^A +unbind ^B +bind ^A send-prefix +bind a send-prefix + +# Last window +bind ^a last + +# Next & prev +bind ' ' next +bind '^ ' next +bind ^p prev + +# Status +set -g status off +# Need more (cow)bells! +set -g bell-action any +set -g bell-on-alert on + +# Detach +bind ^d detach + +# Control the a tmux in a tmux +bind A send-prefix \; send-prefix +bind C send-prefix \; send-keys c +bind n send-prefix \; send-keys ' ' +bind bspace send-prefix \; send-keys p +bind '#' send-prefix \; send-keys '"' + +# Other key bindings. +bind ^r command-prompt "find-window '%%'" +bind '"' choose-tree -w +bind w split-window +bind W split-window -c "#{pane_current_path}" +bind ^w split-window +bind I list-windows +bind i list-windows +bind D neww 'if who | grep -q "$USER.* via mosh"; then tmux lsc -F "#{client_activity} #{client_tty}" | sort | head -n -1 | awk "{print \$2}" | xargs -n1 tmux detach -t; else for i in $(tmux lsc | cut -d: -f1 | grep -v "^$SSH_TTY$"); do tmux detach -t $i; done; fi' +bind S neww -t 999 'window=`tmux display -p "#{pane_title}"`; i=0; tmux list-windows | cut -d: -f1 | while read j; do if [ $j != $i ]; then tmux move-window -s $j -t $i; fi; i=$(($i+1)); done' # ; tmux find-window -T "$window" +bind ^s command-prompt "rename-session '%%'" +# Make the default HOME always ~ +bind c neww -c ~ +bind ^c new -c ~ +bind escape copy-mode +# Copy to the OS clipboard +bind -T copy-mode-vi y send -X copy-pipe-and-cancel "if [ \"$(uname)\" = 'Darwin' ]; then reattach-to-user-namespace pbcopy; else xclip; fi" +bind j command-prompt "join-pane -s '%%'" +bind ! break-pane -d +bind - command-prompt "move-pane -t '%%'" + +# Makes `tmux a` work even when there isn't a session going on +new-session -A -c ~ diff --git a/regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf b/regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf new file mode 100644 index 00000000..27d8f310 --- /dev/null +++ b/regress/conf/ad21dbb0893240563ddfdd954b9903a1.conf @@ -0,0 +1,580 @@ +# Time-stamp: <2018-05-31 17:10:05 kmodi> +# https://github.com/tmux/tmux +# Hi-lock: (("\\(^\\s< \\**\\)\\(\\* *.*\\)" (1 'org-hide prepend) (2 '(:inherit org-level-1 :height 1.3 :weight bold :overline t :underline t) prepend))) +# Hi-Lock: end + +# Running tmux built from master branch on tcsh in uxterm +# tmux version 2.5-RC+ dev + +# Contents: +# +# PREFIX +# Source config +# Pane Management +# Window <-join/split-> Pane +# Select Panes +# Resize Panes +# Dynamic Split +# Window Management +# Window Navigation +# Swap Windows +# Split Window +# Layout +# Session Management +# Mouse +# Drag pane border to resize +# Left click on pane +# Middle click on pane +# Right click on pane +# Wheel scroll in pane +# Wheel scroll in pane WHILE in copy-mode +# Left click on status +# Middle click on status +# Other mouse settings +# Window Title +# Status Bar +# Left Status +# Right Status +# Pane Status +# Colors +# Status Bar Colors +# Message Colors +# Window Status Colors +# Pane Colors +# Mode Info Colors +# Activity +# Command Prompt +# Audible and Visual Bells +# Copy & Paste +# Synchronize commands to panes/windows/sessions +# Terminal Setting +# Other Options +# Server Options +# Session Options +# Window Options +# Notes + +# * PREFIX +set -g prefix C-z +unbind C-b # unbind the default binding to send prefix key to the application +# Often you'll run a tmux inside another tmux and need a command sequence to +# send things to the inner session. With below binding that can be accomplished +# using "PREFIX Z <command>" +bind Z send-prefix + +# * Source config +unbind r # unbind default binding to force redraw of attached client +bind r source-file ~/.tmux.conf \; display "Finished sourcing ~/.tmux.conf ." + +# * Pane Management + +set -g pane-base-index 1 # start pane indices at 1 +set -g main-pane-width 100 # used by selectl main-vertical +bind z resize-pane -Z # zoom/unzoom the current pane +# If the window has >1 panes kill them without confirming. But confirm before kill +# the last pane (along with its window) in a window +bind x if "tmux display -p \"#{window_panes}\" | grep ^1\$" \ + "confirm-before -p \"Kill the only pane in window? It will kill this window too! (y/n)\" kill-pane" \ + "kill-pane" +bind C clear-history \; display "Cleared history of the current pane." +unbind C-p +bind C-p run -b "tmux display -p -F '#{pane_current_path}' | xclip -i -sel pri" \; display "Copied current path '#{pane_current_path}' to the primary selection." + +# Hooks need tmux 2.3+ +# set-hook -g -u after-kill-pane # Remove after hook for kill-pane +set-hook -g after-kill-pane "selectl main-vertical" +# If -g options is used when setting the hook, it has to be used when +# removing (-u option) the hook too. + +# ** Window <-join/split-> Pane +# Join a pane *from* a different window (of same or different session) into the CURRENT window +# Binding mnemonic: F for (F)etch/pull (as in git) from a different window +bind F command-prompt -p "Join pane from [sess:]win#[.pane#] (ex: kmodi:3.1) into current window:" "join-pane -s '%%'" +# Join CURRENT pane *to* a different window +# Binding mnemonic: P for (P)ush (as in git) to a different window +bind P command-prompt -p "Send CURRENT pane to [sess:]win# (ex: kmodi:3):" "join-pane -t '%%'" +# PREFIX ! : break-pane, convert the current pane to a window + +# ** Select Panes +bind o select-pane -t :.+ # cycle to the next pane number +bind O select-pane -t :.- # cycle to the previous pane number +# PREFIX ; : last-pane or select-pane -l, switch to the last active pane +# PREFIX ← : select-pane -L, switch to the pane on the left +# PREFIX → : select-pane -R, switch to the pane on the right +# PREFIX ↑ : select-pane -U, switch to the pane on the top +# PREFIX ↓ : select-pane -D, switch to the pane on the bottom +# PREFIX { : swap-pane -U, swap current pane with the pane above (not literally above) +# PREFIX } : swap-pane -D, swap current pane with the pane below (not literally below) + +# ** Resize Panes +bind -r h resize-pane -L 2 +bind -r C-h resize-pane -L 2 +bind -r j resize-pane -D 2 +bind -r C-j resize-pane -D 2 +bind -r k resize-pane -U 2 +bind -r C-k resize-pane -U 2 +unbind l # unbind default binding for `last-window` +bind -r l resize-pane -R 2 +bind -r C-l resize-pane -R 2 + +# ** Dynamic Split +# Key-chaining example, analogous to prefix maps in emacs +bind / switch-client -Tlauncher +# Run below -Tlauncher commands using "PREFIX / <binding>" +# Open calendar in a split window "PREFIX / c" +# FIXME: Below does not work; cal pane quits as soon as it launches (before "&& sleep .." +# was added). To make better of the situation, I now auto-close that pane after 3 seconds. +# bind -Tlauncher c split-window -h 'cal && sleep 3' +bind -Tlauncher c run "/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'cal && sleep 3'" +# Start emacsclient in terminal mode in a split window "PREFIX / e" +# Use the emacs binding "C-x 5 0" to quit from that pane gracefully. +bind -Tlauncher e run "/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'emacsclient -a \"\" -t'" +# Open man page "PREFIX / m" +# PREFIX / m will bring up the tmux command prompt. Enter the command for which +# you want to see the man page, example: ls. That man page will open in a split +# pane. When you are done reviewing the man page, hit q and the split pane +# closes by itself. Beautiful! +bind -Tlauncher m command-prompt -p "man" "run \"/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'man %1'\"" +# Open python interpreter in a split window for quick calculations "PREFIX / p" +# Ctrl-D in python quits python and thus closes the split window too. +bind -Tlauncher p run "/home/kmodi/scripts/tcsh/tmux/dynamic_split.csh 'ipython --profile=default --no-confirm-exit'" +# PREFIX Up, Down, Right, Left : Move cursor from one pane to another +# PREFIX Space : Cycle through different pane layouts +# PREFIX C-o : rotate-window, rotate panes in the current window + +# * Window Management +set -g base-index 1 # start window indices at 1 +# automatically renumber the windows +# http://unix.stackexchange.com/questions/21742/renumbering-windows-in-tmux +set -g renumber-windows on + +bind C-f command-prompt -p "New window:" "new-window -c '#{pane_current_path}' -n %1" +bind C-r command-prompt -p "New name for this window:" "rename-window '%%'" +unbind L # unbind default binding for `switch-client -l` +bind L list-windows -F '#{window_index}:#{window_name}: #{?pane_dead, (dead), (not dead)}' +unbind & # unbind default binding for `kill-window` +bind C-c confirm-before -p "Kill this window? (y/n)" kill-window +# Move the current window to another window index in the same or any other session +bind m command-prompt -p "Move window to sess or sess:win# or win# (ex: kmodi or kmodi:3 or 2(of current session)):" "move-window -t '%%'" +# Move or bring a window from a different session to the current one +bind M command-prompt -p "Move the window from sess:win# (ex: kmodi:3):" "move-window -s '%%'" + +# ** Window Navigation +bind C-z last-window # switch to last active window +# Allow repeats for next/previous-window +bind -r p previous-window +bind -r n next-window +# switch to another window by name +bind W split-window "tmux lsw | peco --initial-index `tmux lsw | awk '/active.$/ {print NR-1}'` | cut -d':' -f 1 | xargs tmux select-window -t" +# PREFIX <N> : switches to window with index=N + +# ** Swap Windows +bind N move-window -r # renumber the windows +unbind , # unbind default binding for `rename-window` +bind -r , swap-window -t -1 # move window one position to the left +bind -r < swap-window -t -1 # move window one position to the left +unbind . # unbind default binding to move window to user provided index +bind -r . swap-window -t +1 # move window one position to the right +bind -r > swap-window -t +1 # move window one position to the right +unbind t # unbind default binding to show time +bind t swap-window -t 1 # swap the current window's position with window # 1, move it to the top + +# ** Split Window +unbind & # unbind default binding for `split-window -h` +bind - split-window -v -c '#{pane_current_path}' # vertical split +bind _ split-window -v -c '#{pane_current_path}' -f # full vertical split (v2.3+) +bind \ split-window -h -c '#{pane_current_path}' # horizontal split +bind | split-window -h -c '#{pane_current_path}' -f # full horizontal split (v2.3+) +# https://www.reddit.com/r/tmux/comments/3paqoi/tmux_21_has_been_released/cw5wy00 +bind w switch-client -Tsplit_wind +bind -Tsplit_wind v split-window -v -c '#{pane_current_path}' +bind -Tsplit_wind V split-window -v -c '#{pane_current_path}'\; swap-pane -U +bind -Tsplit_wind h split-window -h -c '#{pane_current_path}' +bind -Tsplit_wind H split-window -h -c '#{pane_current_path}'\; swap-pane -U + +# ** Layout +bind Space next-layout +bind C-Space select-layout -o # undo only the last layout change #v2.1 + +# * Session Management +bind C-t command-prompt -p "New name for this session:" "rename-session '%%'" +bind b switch-client -l # switch to previously selected session +# switch to another session by name +bind S split-window "tmux ls | peco --initial-index `tmux ls | awk '/attached.$/ {print NR-1}'` | cut -d':' -f 1 | xargs tmux switch-client -t" +# switch to ANY window in ANY session by name +bind s split-window "tmux ls | cut -d: -f1 | xargs -I SESSION tmux lsw -F 'SESSION:#{window_name}' -t SESSION | peco --initial-index `tmux ls | cut -d: -f1 | xargs -I SESSION tmux lsw -F '___#{session_attached}#{window_active}___' -t SESSION | awk '/___11___/ {print NR-1}'` | xargs tmux switch-client -t" +# tmux kill-session -t NAME/SESSIONNUMBER # Kill session + +# * Mouse +# setw -g mode-mouse on # incompatible in tmux 2.1+ +set -g mouse on + +# ** Drag pane border to resize +# set -g mouse-resize-pane off # incompatible in tmux 2.1+ +bind -T root MouseDrag1Border resize-pane -M # default +# unbind -T root MouseDrag1Border # disable drag pane border to resize + +bind -T root MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= "#{pane_in_mode}" "copy-mode -M" "send-keys -M"' 'copy-mode -M' # default + +# ** Left click on pane +# set -g mouse-select-pane on # incompatible in tmux 2.1+ +# Left click on a pane selects it +# bind -T root MouseDown1Pane select-pane -t=\; send-keys -M # default +bind -T root MouseDown1Pane select-pane -t= + +# Sun Feb 19 11:31:34 EST 2017 - kmodi +# Below break in tmux 2.4 +# # Fri Aug 26 18:35:21 EDT 2016 - kmodi +# # FIXME Need to remember why I unbound the below 2 bindings +# unbind -temacs-copy MouseDown1Pane +# unbind -temacs-copy MouseUp1Pane +# # + +# https://groups.google.com/forum/#!topic/tmux-users/mHhdx7Au0Ds +# Fri Aug 26 18:30:15 EDT 2016 - kmodi +# Do not do the below!! That will update the primary selection with the top-most +# tmux buffer each time you left click on a pane. +# bind -T root MouseUp1Pane run -b "tmux show-buffer | xclip -i -sel pri" +# + +# Left click in the pane *followed after a region selection* copies that to the +# secondary selection +bind -T root MouseUp1Pane run -b "tmux show-buffer | xclip -i -sel sec" +# Fri Aug 26 19:03:57 EDT 2016 - kmodi +# FIXME: As of today it needs to be figured out how to best paste the content +# from secondary selection + +# ** Middle click on pane +# Middle click in a pane to paste from the primary selection +bind -T root MouseDown2Pane run -b "xclip -o -sel pri | tmux load-buffer - && tmux paste-buffer -s ' '" + +# ** Right click on pane +# Right click on a pane selects and marks it *if not in copy-mode*; else +# passes on the mode keys +# bind -T root MouseDown3Pane select-pane -t= -m # default +bind -T root MouseDown3Pane if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t= -m' + +# Sun Feb 19 11:32:00 EST 2017 - kmodi +# Below breaks in tmux 2.4 +# # Right click *release* on a pane *in copy-mode* quits copy-mode +# bind -temacs-copy MouseUp3Pane cancel + +# ** Wheel scroll in pane +unbind -T root WheelUpPane +unbind -T root WheelDownPane +# Do mouse wheel-up to enter copy mode and do page-up +# https://groups.google.com/d/msg/tmux-users/XTrSVUR15Zk/3iyJLMyQ7PwJ +# Below binding did not work +# bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'if -Ft= "#{pane_in_mode}" "copy-mode -u" "send-keys -M"' 'copy-mode -u' +# Below works and allows the WheelUpPane binding in emacs-copy table to be effective +bind -T root WheelUpPane if -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= "#{pane_in_mode}" "send-keys -M" "copy-mode -u"' +# |---------------------+-----------------------------------------+--------------------------------| +# | using mouse? AND .. | #{pane_in_mode} (already in copy-mode?) | action | +# |---------------------+-----------------------------------------+--------------------------------| +# | Yes | Don't care | Send the mode keys | +# | No | Yes | Send the mode keys | +# | No | No | Enable copy-mode and do PageUp | +# |---------------------+-----------------------------------------+--------------------------------| + +# *** Wheel scroll in pane WHILE in copy-mode +# Sun Feb 19 11:32:16 EST 2017 - kmodi +# Below breaks in tmux 2.4 +# # Once in copy-mode, mouse wheel scrolls scrolls by half pages +# bind -temacs-copy WheelUpPane halfpage-up +# bind -temacs-copy WheelDownPane halfpage-down + +# ** Left click on status +# set -g mouse-select-window on # incompatible in tmux 2.1+ +# Left click on a window name in status bar to select it +bind -T root MouseDown1Status select-window -t= # default + +# ** Middle click on status +# Middle click on a window name in status bar to kill it +bind -T root MouseDown2Status kill-window + +# ** Other mouse settings +# The special token ‘{mouse}’ or ‘=’ may be used as target-window or target-pane in +# commands bound to mouse key bindings. Example: -t = + +# * Window Title +set -g set-titles on +set -g set-titles-string '#h :: #S:W#I(#W).P#P' + +# * Status Bar +set -g status-interval 5 # default = 15 seconds +set -g status-justify centre + +# ** Left Status +set -g status-left-length 20 +# Change the left status when prefix is pressed. +# https://www.reddit.com/r/tmux/comments/5cm2ca/post_you_favourite_tmux_tricks_here/d9ziuy9/ +set -g status-left "#{?client_prefix,#[fg=yellow]prefix pressed ..,[#S]}" + +# ** Right Status +set -g status-right-length 20 +set -g status-right "%l:%M %b %d %a " + +# ** Pane Status +setw -g pane-border-status "bottom" +setw -g pane-border-format " #P #T " + +# # tmux-powerline +# # https://github.com/erikw/tmux-powerline +# set -g status-left-length 30 +# set -g status-right-length 30 +# set -g status-left "#(~/usr_local/scripts/tmux-powerline/powerline.sh left)" +# set -g status-right "#(~/usr_local/scripts/tmux-powerline/powerline.sh right)" + +# * Colors + +# ** Status Bar Colors +set -g status-style fg=colour246,bg=colour233 # default for whole status line +set -g status-left-style fg=white,bold,bg=colour233 +set -g status-right-style fg=colour75,none,bg=colour233 + +# ** Message Colors +set -g message-style fg=colour2,bold,bg=default + +# ** Window Status Colors +setw -g window-status-style default # default for all window statuses +setw -g window-status-last-style fg=default,bg=colour235 +setw -g window-status-current-style fg=white,bold,bg=colour63 +setw -g window-status-bell-style default +setw -g window-status-activity-style fg=white,none,bg=colour196 +# setw -g window-status-content-style fg=black,none,bg=green # incompatible with tmux 2.0+ + +# ** Pane Colors +setw -g pane-active-border-style fg=colour63,bg=default +setw -g pane-border-style fg=colour235,bg=default +setw -g window-active-style 'bg=#330000' # bg color of active pane +setw -g window-style 'bg=black' # bg color of inactive pane(s) + +# ** Mode Info Colors +# Color of display shown on top-right in copy-mode, highlighting +setw -g mode-style fg=black,bg=colour244 + +# * Activity +# Notify when a window has activity +# This quick snippet will have tmux notify you in the status area when a +# window has activity: +setw -g monitor-activity on +set -g visual-activity off # Display message telling that an activity happened (on/off) +# It lets me know that there is activity in a non-active window +# To try this, enter `sleep 10 && echo “Hi”` in a window and switch to +# another window. + +# # Notify when a window has a content alert +# setw -g monitor-content "--[A-Za-z][A-Za-z]sim Done--" # This string appears when a sim finishes, alert then # incompatible with tmux 2.0+ +# # setw -g monitor-content "" # Disable monitor-content +# set -g visual-content on # Display message telling that a content alert was triggered (on/off) # incompatible with tmux 2.0+ + +# * Command Prompt +# Move focus to command prompt. tmux commands can be entered there directly +# without using the `tmux` prefix and it also supports auto-complete. +bind C-x command-prompt # default command-prompt binding "PREFIX :" also works + +# * Audible and Visual Bells +set -g bell-action any +set -g bell-on-alert off +set -g visual-bell on + +# * Copy & Paste +set -g set-clipboard off # default is on + +# Copy tmux buffer to primary and clipboard selections +# run -b runs a shell command in background +# http://grota.github.io/blog/2012/05/08/tmux-clipboard-integration/ +bind C-w run -b "tmux show-buffer | xclip -i -sel pri && tmux show-buffer | xclip -i -sel cli" +# Fri Aug 26 18:41:30 EDT 2016 - kmodi +# Below binding was suggested by Nicholas Marriott +# But the my older binding works fine so I am commenting out below for now. +# bind C-w run "tmux saveb - | xclip -i -sel pri; tmux saveb - | xclip -i -sel cli" +# Paste into tmux; also replace LF characters with +# space as separator characters (-s) when pasting. +# Yank from primary +bind C-y run -b "xclip -o -sel pri | tmux load-buffer - && tmux paste-buffer -s ' '" +# Yank from clipboard +bind M-y run -b "xclip -o -sel cli | tmux load-buffer - && tmux paste-buffer -s ' '" +# Open the file/dir path that was copied by selection in existing emacs client +# Usage: Highlight a file name in ls output and press "PREFIX e" +bind e run -b "tmux show-buffer | xclip -i -sel pri; (emacsclient -a '' `tmux display -p '#{pane_current_path}'`/`xclip -o -sel pri `&)" + +# * Synchronize commands to panes/windows/sessions +# Send the same command to all panes in the same window +bind C-a command-prompt -p "Command to all panes in this window:" \ + "run \"tmux list-panes -F '##{pane_index}' | xargs -I PANE \ + tmux send-keys -t PANE '%1' Enter\"" +# Alternative to using the above "C-a" binding is to enable pane synchronization, +# type the command you want to execute in all panes in the same window and disable +# pane synchronization +# Also turn the pane borders red while pane synchronization is enabled. +# - https://www.reddit.com/r/tmux/comments/5cm2ca/post_you_favourite_tmux_tricks_here/d9y6jzu/ +bind C-s if -F '#{pane_synchronized}' \ + 'setw synchronize-panes off; \ + setw pane-active-border-style fg=colour63,bg=default; \ + setw pane-border-format " #P #T "' \ + 'setw synchronize-panes on; \ + setw pane-active-border-style fg=red; \ + setw pane-border-format " #P - Pane Synchronization ON "' +# So it would be: C-s <type the command RET> C-s + +# https://scripter.co/command-to-every-pane-window-session-in-tmux/ +# Send the same command to all panes/windows in the current session +bind C-e command-prompt -p "Command:" \ + "run \"tmux list-panes -s -F '##{session_name}:##{window_index}.##{pane_index}' \ + | xargs -I PANE tmux send-keys -t PANE '%1' Enter\"" + +# Send the same command to all panes/windows/sessions +bind E command-prompt -p "Command:" \ + "run \"tmux list-panes -a -F '##{session_name}:##{window_index}.##{pane_index}' \ + | xargs -I PANE tmux send-keys -t PANE '%1' Enter\"" + +# * Terminal Setting + +# From `man tmux', about `default-terminal' +# Set the default terminal for new windows created in this session - the default +# value of the TERM environment variable. For tmux to work correctly, this must +# be set to ‘screen’, ‘tmux’ or a derivative of them. +# set -g default-terminal "screen" +set -g default-terminal "screen-256color" +# Mon May 22 11:43:56 EDT 2017 - kmodi +# Blinking text (useful to show broken symlinks in ls) does not work when using tmux-24bits. +# set -g default-terminal "tmux-24bits" +# tmux-24bits is a custom terminfo profile created using the steps explained +# on https://github.com/ThomasAdam/tmux/blob/master/FAQ to support italics and +# 256 colors. + +# Enable 24-bit color +# https://sunaku.github.io/tmux-24bit-color.html +set -ga terminal-overrides ",screen-256color:Tc" +# set -ga terminal-overrides ",tmux-24bits:Tc" + +# Thu May 31 17:10:04 EDT 2018 - kmodi +# TODO: Try the 24-bit emacs+tmux config for ST +# https://www.reddit.com/r/emacs/comments/8ndm2x/gnu_emacs_261_24bit_colors_suckless_st_terminal/dzwh4vv/ +# set -g default-terminal "tmux-256color" +# set -ga terminal-overrides ",*256col*:Tc" +# + +setw -g xterm-keys on + +# Uncomment below when using st (by suckless.org) +# set -g default-terminal "st-256color" +# # https://sunaku.github.io/tmux-24bit-color.html +# # st supports 24-bit color, so enable support for that in tmux +# set -ga terminal-overrides ",st-256color:Tc" +# setw -g xterm-keys off + +bind R refresh-client +# bind R refresh-client \; display "Refreshed the client." + +# * Other Options + +# ** Server Options +set -s escape-time 0 # Allows for faster key repetition + +# ** Session Options +# Set the default shell to /bin/sh. If the default is tcsh, doing a split-window takes a long +# time as my tcsh init is loaded first (which takes really long). +set -g default-shell /bin/sh +# If I am doing a new-window or split-window without a specified command, start the tcsh +# shell by default. +set -g default-command tcsh +set -g history-limit 100000 +set -g display-time 1000 # Duration of tmux display messages in milliseconds + +# ** Window Options +# When a smaller terminal connects to a tmux client, it shrinks to fit it. The +# clients attached with bigger displays see this constrained view. +# aggressive-resize makes it such that the window is only resized if the smaller +# client is actively looking at it. +setw -g aggressive-resize on +setw -g mode-keys emacs # Use emacs keybindings in copy mode +setw -g status-keys emacs + +# * Notes + +# |-------------------+------------| +# | tmux command | short form | +# |-------------------+------------| +# | set-option | set | +# | set-window-option | setw | +# | bind-key | bind | +# | unbind-key | unbind | +# | display-message | display | +# | run-shell | run | +# | if-shell | if | +# |-------------------+------------| + +# Colo'u'r table +# http://guns.github.io/xterm-color-table.vim/images/xterm-color-table.png + +# CHARACTER PAIR REPLACED WITH +# #(command) First line of command’s output +# #[attributes] Colour or attribute change +# #H Hostname of local host +# #I Current window index +# #P Current pane index +# #S Session name +# #T Current window title +# #W Current window name +# ## A literal ‘#’ + +# Variables used in time format +# Source: http://docs.splunk.com/Documentation/Splunk/5.0.2/SearchReference/Commontimeformatvariables +# %y = year in numbers (2-digit) +# %Y = year in numbers (4-digit) +# %m = month in number (eg: 12) + # %B = full month name (eg: December)sho +# %b = short month name (eg: Dec) +# %d = day in numbers, with leading zeros (eg: 08) +# %e = day in numbers, no leading zeros (eg: 8) +# %A = full weekday name (eg: Sunday) +# %a = short weekday name (eg: Sun) +# %H = hours in 24-clock, with leading zeros +# %k = hours in 24-clock, no leading zeros +# %l = hours in 12-clock, with leading zeros +# %p = am/pm +# %T = time in 24-hour notation (%H:%M:%S) + +# PREFIX ? : list-keys, display key bindings + +# In command-prompt: show-options -g shows the global options +# In command-prompt: show-window-options -g shows the global windows options + +# How do I know which tmux version I am running? +# tmux -V + +# How to set bindings that don't need the prefix? +# bind -n .. or +# bind -T root .. + +# Changelog: https://github.com/tmux/tmux/blob/master/CHANGES + +# style colors: default, black, red, green, yellow, blue, magenta, cyan, white, +# colour0-colour255, hexdecimal RGB string '#ffffff' +# Use $SCRIPTS/bash/256-colors.sh to figure out the color number you want +# style attributes: none, bold/bright, dim, underscore, blink, reverse, hidden, +# or italics + +# https://www.reddit.com/r/tmux/comments/3paqoi/tmux_21_has_been_released/cw552qd + +# tmux buffers +# PREFIX # : List all paste buffers +# PREFIX - : Delete the most recently copied buffer of text +# PREFIX = : Choose which buffer to paste interactively from a list +# PREFIX ] : Paste the most recently copied buffer of text + +# How to start a temporary tmux server in addition to an existing running one? +# > tmux -L temp + +# In a shell environment in a terminal in tmux, the env var $TMUX will be +# defined to something like "/tmp/tmux-23273/default,31101,0". Outside tmux, +# $TMUX will be undefined. + +# Notation to address a specific pane +# SESSION_NAME:WINDOW_INDEX.PANE_NUMBER (Example: foo:2.1 i.e. Pane 1 in Window 2 of Session foo) + +# To print a message containing tmux variable values to stdout use '-p' option in display-message +# tmux display-message -p '#{session_name}:#{window_name}.#{pane_index}', or +# tmux display -p '#{session_name}:#{window_name}.#{pane_index}' diff --git a/regress/conf/d2e576f947e108eb9903679b65c81fbc.conf b/regress/conf/d2e576f947e108eb9903679b65c81fbc.conf new file mode 100644 index 00000000..392a69f0 --- /dev/null +++ b/regress/conf/d2e576f947e108eb9903679b65c81fbc.conf @@ -0,0 +1,198 @@ +### GENERAL + +set-option -g prefix C-a # Set prefix to <C-a> +bind a send-prefix # Send <C-a> with <C-a>a + +bind R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded" +bind -n M-R source-file ~/.tmux.conf \; display "~/.tmux.conf reloaded" + +set -g history-limit 10000 # lines to keep in hisoty +set-option -g display-panes-time 3000 # Timeout for pane-numbering in ms +bind -n M-q display-panes +set-option -sg escape-time 0 # speed up commands +set -g mouse on # enable mouse (tmux 2.1+) +set -g base-index 1 # start window numbering at 1 +set -g pane-base-index 1 # start pane numbering at 1 +set -g renumber-windows on # renumber windows automatically +setw -g automatic-rename on # rename window after process + +# Clear window name before renaming +bind , rename-window "" \; command-prompt "rename-window '%%'" + +#### APPEARANCE + +set -g default-terminal "screen-256color" # use 256 colors +setw -g aggressive-resize on # resize window to smallest client + +set -g pane-border-style fg=colour238 # border color for inactive panes +set -g pane-active-border-style fg=colour247 # border color for active panes + +# Status bar colors and format +setw -g window-status-format ' #[fg=#999999]#I #[fg=$666666]#W ' +setw -g window-status-current-format '#[fg=#ffffff] #I #W#[fg=#ffffff] ' +setw -g window-status-separator '#[fg=#292929]|#[fg=default]' +set -g status-bg default # background color for status bar +set -g status-position bottom # put status bar on top or bottom +set -g status-interval 2 # interval in s to update status +set -g status-justify left # horizontal alignment +set -g message-style fg=white,bg=black # appearance of status messages +set -g message-command-style fg=white # appearance of status message cmds + +# Left section of status bar +set -g status-left "" + +# Status bar visibility +set -g status off +bind -r -n M-t set status on +bind -r -n M-T set status off +bind t set status on +bind T set status off + +# Right section of status bar +if-shell 'uname | grep -qi Darwin' "set -g status-right \"#[fg=#81a2be]#(/usr/local/bin/mpc | head -n 1 | sed 's/volume.*$//') #[fg=cyan]#(~/bin/battery-osx) #(~/bin/mailstatus.sh) #[fg=yellow]#(uptime|sed 's/.* //') #[fg=#666666]%F #[fg=#bababa]%R\"" + +if-shell 'uname | grep -qi Linux' "set -g status-right \"#[fg=cyan]#(~/bin/battery-linux) #(~/bin/mailstatus.sh) #[fg=yellow]#(cat /proc/loadavg|awk '{print $1;}') #[fg=#666666]%F #[fg=#bababa]%R\"" + +# Scaling of status-bar sections +set -g status-right-length 40 + + +#### NAVIGATION + +# With C-a prefix +bind h select-pane -L # navigate left with <C-a>h +bind j select-pane -D # navigate down with <C-a>j +bind k select-pane -U # navigate up with <C-a>k +bind l select-pane -R # navigate right with <C-a>l +bind -r H resize-pane -L 5 # resize pane left with <C-a>H +bind -r J resize-pane -D 5 # resize pane down with <C-a>J +bind -r K resize-pane -U 5 # resize pane up with <C-a>K +bind -r L resize-pane -R 5 # resize pane right with <C-a>L + +# Navigate panes with Meta (alt) modifier + hjkl +bind -r -n M-h select-pane -L # navigate left with M-h +bind -r -n M-j select-pane -D # navigate down with M-j +bind -r -n M-k select-pane -U # navigate up with M-k +bind -r -n M-l select-pane -R # navigate right with M-l +bind -r -n M-H resize-pane -L 5 # resize pane left with M-H +bind -r -n M-J resize-pane -D 5 # resize pane down with M-J +bind -r -n M-K resize-pane -U 5 # resize pane up with M-K +bind -r -n M-L resize-pane -R 5 # resize pane right with M-L + +# Navigate windows with Meta (alt) modifier + number keys +bind -n M-1 select-window -t :=1 +bind -n M-2 select-window -t :=2 +bind -n M-3 select-window -t :=3 +bind -n M-4 select-window -t :=4 +bind -n M-5 select-window -t :=5 +bind -n M-6 select-window -t :=6 +bind -n M-7 select-window -t :=7 +bind -n M-8 select-window -t :=8 +bind -n M-9 select-window -t :=9 +bind -n M-0 select-window -t :=10 + +bind C-s last-window # go to last window with <C-a><C-s> +bind C-a last-pane # go to last pane with <C-a><C-a> +bind -n M-s last-window # go to last pane with M-s +bind -n M-a last-pane # go to last pane with M-a +bind -r n next-window # next window with <C-a>n +bind -r b previous-window # next window with <C-a>p + +bind -n -r M-n next-window # next window with <M-n> +bind -n -r M-b previous-window # previous window with <M-n> +#bind -n M-, run-shell "tmux list-panes -as -F \"##I.##P ##{pane_current_command} . #{pane_current_path} (#W)#F\" | fzf-tmux | cut -d \" \" -f 1 | xargs tmux select-pane -t" +bind -n M-, run-shell "tmux list-windows -F \"##I:##W\" | fzf-tmux | cut -d \":\" -f 1 | xargs tmux select-window -t" +bind -n M-. run-shell "tmux list-sessions -F \"##S\" | fzf-tmux | xargs tmux switch -t" + + +#### LAYOUT CHANGING BINDINGS + +# create panes in same directory +bind '"' split-window -c "#{pane_current_path}" +bind '%' split-window -h -c "#{pane_current_path}" + +bind -r z resize-pane -Z # toggle pane zoom with <C-a>z +bind -r y next-layout # cycle to next pane layout with <C-a>y +bind -r Y previous-layout # cycle to previous pane layout with <C-a |