TMUX

参考文献: A Gentle Introduction to tmux

这里是简明用法: http://c.biancheng.net/linux/tmux.html

常用快捷键

下面的快捷键的prefix都是默认的`ctrl+b`  

```text
# Start new named session:
$ tmux new -s [session name]

# Detach from session:
$ ctrl+b d

# List sessions:
$ tmux ls

# Attach to named session:
$ tmux a -t [name of session]

# Kill named session:
$ tmux kill-session -t [name of session]

# Kill tmux server, along with all sessions:
$ tmux kill-server  

# pane maximizing
$ ctrl+b z
```  
- window  

```text
# 新建窗口  
ctrl+b c  
# 切换窗口,下一个窗口,上一个窗口  
ctrl+b n/p
# 切换窗口, 根据数字  
ctrl+b 1 ...
```
- pane

```text
# Split panes horizontally:
$ ctrl+b "

# Split panes vertically:
$ ctrl+b %

# Kill current pane:
$ ctrl+b x

# Move to another pane:
$ ctrl+b [arrow key]

# full screen
$ ctrl+b z

# pane size
:resize-pane -D (Resizes the current pane down)
:resize-pane -U (Resizes the current pane upward)
:resize-pane -L (Resizes the current pane left)
:resize-pane -R (Resizes the current pane right)
:resize-pane -D 10 (Resizes the current pane down by 10 cells)
:resize-pane -U 10 (Resizes the current pane upward by 10 cells)
:resize-pane -L 10 (Resizes the current pane left by 10 cells)
:resize-pane -R 10 (Resizes the current pane right by 10 cells)
```

在tmux里面vim的colorscheme失效的解决办法

我的环境是:MacOS + Item2 + zsh  
在`~/.zshrc`文件里面添加:  

```
alias tmux="TERM=screen-256color-bce tmux"
```  

在`~/.tmux.conf`文件里添加(如没有则新建此文件):  

```
set -g default-terminal "screen-256color"
```  

添加上面的内容之后`source ~/.zshrc`即可  
> 什么?没有生效?kill掉tmux的所有进程,重新启动即生效了

copy

if window is split vertically, when we use mouse to select text, it will select other split panel’s content.
how to solve this problem? we can click ctrl command when we use mouse to select text.

scroll up and down

we can use ctrl+b [ to enter scroll mode, then we can use up and down to scroll up and down.