Setup Your Pure VIM Dev Environment--Part I
TMUX
Y-2022
tmux
tools
summary
]
Why Tmux
is needed?
During your daily work, it’s quite common to open several windows to accomplish your tasks.
If you don’t use Tmux
alike screen manager, it will be totally a nightmare.
Following demonstrates a typical scene. You open a window to view the code project, and another one to build it. Apart from them, you can also open some other auxiliary windows, e.g, htop
window, to watch the real-time CPU performance.
What’s more, if you are a DevOps engineer who should ssh to remote machine to do some developments, you will find Tmux
useful. It offers you the mechanism to close the session temporarily without any concern, and reattach to it in an easy manner. Tmux
will manage the sessions until your next access.
There are definitely other alternatives to Tmux
, e.g, screen
, and you can choose anyone as you like.
In this post, we mainly describe our settings based on Tmux
.
Setup
Install Tmux
:
sudo apt-get install tmux
Download the config repo to your home directory:
git clone --recursive git@github.com:sunbingfeng/tmux-config.git $HOME/.tmux
Set it as the default tmux configuration:
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf
Usage
The default prefix/leader key is Control+o
, and you can change it to your preference.
Basic:
tmux
to create a new tmux sessiontmux a
to attach to an existed session- The prefix key must be typed before any commands
Control+o
then?
to bring up list of key mappings
Window managements:
Control+o
thens
to show list of windows availableControl+o
thenf
to search window through keywordsControl+o
then,
to rename current windowControl+o
then&
to kill current windowControl+o
thenc
to create new windowControl+o
thenn
to goto the next windowControl+o
thenp
to goto the previous windowControl+o
thenControl+a
switch between current and last windowControl+o
then[0-9]
to goto the numbered window
Pane managements:
Control+o
thenv
to split horizontallyControl+o
thenb
to split verticallyControl+o
then;
to switch between current and last paneControl+o
thenh
,j
,k
,l
to move left, down, up, right respectively as vim doesControl+o
thenz
to maximum/restore current paneControl+o
thenx
to close current pane
Copy&Paste:
We use xclip
be default, so you should install it through:
sudo apt-get install xclip
Control+o
then[
to enter copy mode- Press
v
to select blocks, orV
to select multiple lines, and theny
to copy it to clipboard - Goto where you want to paste, and press
i
to enter edit mode. PressControl+o
then]
to paste.