tmux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tmux [2021/03/10 20:19] – [Starting Tmux, detaching and reattaching] hc9 | tmux [2022/12/05 06:18] (current) – [Resources] hc9 | ||
---|---|---|---|
Line 25: | Line 25: | ||
===== Multiple windows ===== | ===== Multiple windows ===== | ||
- | By default, a Tmux session starts with only one window. You can create more by typing CTRL-b c. All windows have a numeric id, and start named as the current shell or command being run. To rename the current window, type CTRL-b ,. Then you can switch between windows typing CTRL-b number, where number is the number of a window. CTRL-b n and CTRL-b p are both shortcuts to, respectively, | + | By default, a Tmux session starts with only one window. You can create more by typing |
===== Multiple sessions ===== | ===== Multiple sessions ===== | ||
Line 37: | Line 37: | ||
'' | '' | ||
- | It is possible to split windows in a session with CTRL-b " or CTRL-b %, respectively, | + | It is possible to split windows in a session with **CTRL-b "** or **CTRL-b %**, respectively, |
===== Sharing screen sessions ===== | ===== Sharing screen sessions ===== | ||
Line 57: | Line 57: | ||
Tmux is configured by a file located at $HOME/ | Tmux is configured by a file located at $HOME/ | ||
- | <code> | + | <file config $HOME/ |
- | # makes window' | + | |
- | set -g base-index 1 | + | |
- | | + | # makes window' |
- | | + | set -g base-index 1 |
- | | + | # resize windows only when a smaller client is using a session |
- | | + | setw -g aggressive-resize on |
- | | + | # disables panel selection using mouse |
- | bind m command-prompt -p "man page:" " | + | set -g mouse-select-pane off |
+ | |||
+ | # open a man page in a separated split pane | ||
+ | bind m command-prompt -p "man page:" " | ||
+ | |||
+ | # set default terminal | ||
+ | set -g default-terminal " | ||
+ | |||
+ | </ | ||
- | # set default terminal | ||
- | set -g default-terminal " | ||
- | </ | ||
===== Reset Lost Sessions ===== | ===== Reset Lost Sessions ===== | ||
Line 80: | Line 83: | ||
'' | '' | ||
+ | |||
+ | ===== Emulating Emacs-like registers ===== | ||
+ | |||
+ | If you have a need for multiple clipboard-like buffers for storing and retrieving text (akin to registers in Emacs or Vim), Tmux already supports that, although this functionality is not well exposed by default. Below is a sample piece of configuration that makes available 26 registers designated by single lower-case letters //a-z//. | ||
+ | |||
+ | < | ||
+ | |||
+ | # Initialize alphanumerical registers to avoid the problem with ' | ||
+ | run "tmux set-buffer -b a \" | ||
+ | run "tmux set-buffer -b b \" | ||
+ | run "tmux set-buffer -b c \" | ||
+ | run "tmux set-buffer -b d \" | ||
+ | run "tmux set-buffer -b e \" | ||
+ | run "tmux set-buffer -b f \" | ||
+ | run "tmux set-buffer -b g \" | ||
+ | run "tmux set-buffer -b h \" | ||
+ | run "tmux set-buffer -b i \" | ||
+ | run "tmux set-buffer -b j \" | ||
+ | run "tmux set-buffer -b k \" | ||
+ | run "tmux set-buffer -b l \" | ||
+ | run "tmux set-buffer -b m \" | ||
+ | run "tmux set-buffer -b n \" | ||
+ | run "tmux set-buffer -b o \" | ||
+ | run "tmux set-buffer -b p \" | ||
+ | run "tmux set-buffer -b q \" | ||
+ | run "tmux set-buffer -b r \" | ||
+ | run "tmux set-buffer -b s \" | ||
+ | run "tmux set-buffer -b t \" | ||
+ | run "tmux set-buffer -b u \" | ||
+ | run "tmux set-buffer -b v \" | ||
+ | run "tmux set-buffer -b w \" | ||
+ | run "tmux set-buffer -b x \" | ||
+ | run "tmux set-buffer -b y \" | ||
+ | run "tmux set-buffer -b z \" | ||
+ | | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | # Copy to user-selected register | ||
+ | bind -T copy-mode r command-prompt -1 -p ' | ||
+ | # Paste from user-selected register | ||
+ | bind -T prefix C-] command-prompt -1 -p ' | ||
+ | | ||
+ | </ | ||
+ | |||
+ | The way it works is this: when in // | ||
+ | |||
+ | ===== Troubleshooting Colors ===== | ||
+ | |||
+ | If colors are not working in your tmux session try running tmux with the -2 flag. | ||
+ | |||
+ | '' | ||
+ | |||
+ | To persist 256color support in your terminal you can add the following line to your ~/.bashrc | ||
+ | |||
+ | '' | ||
===== Resources ===== | ===== Resources ===== | ||
Line 87: | Line 147: | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[wp>Tmux|https:// |
---- | ---- | ||
- | $Id: tmux.html,v 1.6 2014/06/09 06:08:42 ike Exp $ [[http:// | + | $Id: tmux.html,v 1.6 2014/06/09 06:08:42 ike Exp $ [[http:// |
tmux.txt · Last modified: 2022/12/05 06:18 by hc9