WSL and tmux

开启WSL

1. 设置,更新与安全,针对开发人员


2. 设置,系统,应用和功能,拉到最下面,相关设置,程序与功能,启动或关闭Windows功能,WSL


然后就可以启动bash了。


以前一直用screen,虽然很强大,但是老觉得有美中不足的地方。今天才只有还有tmux这种升级版的东西。

分享一下之前一直用的~/.screenrc

hardstatus alwayslastline
hardstatus string '[ %H ][%=%w%=][ %m/%d %c ]'
startup_message off
vbell on
bind ' ' title
如果用惯了screen的ctrl+a,可以将tmux默认的ctrl+b该成ctrl+a,

~/.tmux.conf

unbind C-b
set -g prefix C-a
setw -g mode-keys vi

tmux相对于screen最强大的地方是可以启动多个session。方法是ctrl+a :,然后输入new -s

session之间跳转用ctrl+a s,然后输入数字,或者用方向键选择。有了这个东西gnome-terminal的多tab都不需要了。

tmux还可以分屏,ctrl+a ",上下分屏,ctrl+a %,左右分屏。之间跳转是ctrl+a o。如果要调换他们的位置用ctrl+a, ctrl+o。

还可以调整他们的大小,方法是ctrl+a,然后按住ctrl不松手,同时按方向键。


改名字screen是ctrl+a space,tmux是ctrl+a ,。windows之间跳好像和screen差不多。

ctrl+a &关闭当前window,相当于screen的ctrl+a, shift+k.

切换到上一个window是ctrl+a l,screen是ctrl+a, ctrl+a。

ctrl+a d,断开session,tmux attach恢复。


最近也发现了一些不方便的地方,以前粘贴只要鼠标选中就行了,现在得右键点一下。以前拷贝的时候shift+insert就行了,现在得点一下右键。

不知道能不能改成原来的样子。


unbind C-b
set -g prefix C-a
setw -g mode-keys vi

bind r source-file ~/.tmux.conf \; display "Reloaded!"
# select last window
unbind-key l
bind-key C-a select-window -l

bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R

# zoom pane <-> window
# http://tmux.svn.sourceforge.net/viewvc/tmux/trunk/examples/tmux-zoom.sh
bind ^z run "tmux-zoom"

bind -r ^k resizep -U 10 # upward (prefix Ctrl+k)
bind -r ^j resizep -D 10 # downward (prefix Ctrl+j)
bind -r ^h resizep -L 10 # to the left (prefix Ctrl+h)
bind -r ^l resizep -R 10 # to the right (prefix Ctrl+l)

bind Escape copy-mode

#-- statusbar --#
set -g status-utf8 on
set -g status-interval 1
set -g status-keys vi

setw -g mode-keys vi
set -g visual-activity on

set -g status-bg black
set -g status-fg white

# 对齐方式
set-option -g status-justify centre

# 左下角
set-option -g status-left '#[bg=black,fg=green][#[fg=cyan]#S#[fg=green]]'
set-option -g status-left-length 20

# 窗口列表
setw -g automatic-rename on
setw -g automatic-rename off
set-window-option -g window-status-format '#[dim]#I:#[default]#W#[fg=grey,dim]'
set-window-option -g window-status-current-format '#[fg=cyan,bold]#I#[fg=blue]:#[fg=cyan]#W#[fg=dim]'

# 右下角
set -g status-right '#[fg=green][#[fg=cyan]%Y-%m-%d#[fg=green]]'

你可能感兴趣的:(linux)