OSDN Git Service

Regular updates
[twpd/master.git] / tmux.md
1 ---
2 title: tmux
3 category: CLI
4 layout: 2017/sheet
5 ---
6
7 ### Commands
8
9     $ tmux
10       -u        # UTF8 mode
11       -S ~/.tmux.socket
12
13 #### Sessions
14
15     $ tmux new
16     $ tmux new -s session_name
17
18     $ tmux attach # Default session
19     $ tmux attach -t session_name
20
21     $ tmux switch -t session_name
22
23     $ tmux ls     # List sessions
24
25     $ tmux detach
26
27 #### Windows
28
29     $ tmux new-window
30
31 ### Help
32
33     C-b ?
34
35 ### Scrolling
36
37     C-b [       # Enter scroll mode then press up and down
38
39 ### Copy/paste
40
41     C-b [       # 1. Enter scroll mode first.
42     Space       # 2. Start selecting and move around.
43     Enter       # 3. Press enter to copy.
44     C-b ]       # Paste
45
46 ### Panes
47
48     C-b %       # vert
49     C-b "       # horiz
50     C-b hkjl    # navigation
51     C-b HJKL    # resize
52     C-b o       # next window
53     C-b q       # show pane numbers
54     C-b x       # close pane
55
56     C-b { or }  # move windows around
57
58 ### Windows
59
60     C-b c       # New window
61     C-b 1       # Go to window 1
62     C-b n       # Go to next window
63     C-b p       # Go to previous window
64     C-b w       # List all window
65
66 ### Detach/attach
67
68     C-b d       # Detach
69     C-b ( )     # Switch through sessions
70     $ tmux attach
71
72 ### Niceties
73
74     C-b t    # Time
75
76 ## Status formats
77
78 ```
79 setw -g window-status-format `#[fg=8,bg=default]#I`
80 ```
81
82 See `message-command-style` in the man page.
83
84 ### Attribute/colors
85
86 | Key | Description |
87 | --- | --- |
88 | `#[fg=1]` | standard color |
89 | `#[fg=yellow]` | yellow |
90 | `#[bold]` | bold |
91 | `#[fg=colour240]` | 256 color |
92 | `#[fg=default]` | default |
93 | `#[fg=1,bg=2]` | combinations |
94 | `#[default]` | reset |
95
96 ### Colors
97
98  * `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white`
99  * `brightred` (and so on)
100  * `colour0` ... `colour255`
101  * `#333` (rgb hex)
102
103 ### Attributes
104
105  * `bold` `underscore` `blink` `noreverse` `hidden` `dim` `italics`
106
107 ### Variables
108
109 | Key | Description |
110 | --- | --- |
111 | `#(date)` | shell command |
112 | `#I` | window index |
113 | `#S` | session name |
114 | `#W` | window name |
115 | `#F` | window flags |
116 | `#H` | Hostname |
117 | `#h` | Hostname, short |
118 | `#D` | pane id |
119 | `#P` | pane index |
120 | `#T` | pane title |
121
122 ## Options
123
124     set -g status-justify [left|centre|right]
125     set -g status-left '...'
126
127     setw -g window-status-style
128     setw -g window-status-activity-style
129     setw -g window-status-bell-style
130     setw -g window-status-content-style
131     setw -g window-status-current-style
132     setw -g window-status-last-style
133
134     setw -g window-status-format
135     setw -g window-status-current-format
136
137     setw -g window-status-separator