mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
581 lines
26 KiB
Plaintext
581 lines
26 KiB
Plaintext
|
# 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}'
|