惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
月光博客
月光博客
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
小众软件
小众软件
量子位
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
U
Unit 42
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Tmux Cheatsheet
2021-01-25 · via jdhao's digital space

In this post, I collect some useful tips for using Tmux.

In the following text, <prefix> means the prefix key for Tmux. If you haven’t changed it, it will Ctrl-b by default.

Change layout#

To change the layout of panes in a Tmux windows, press <prefix><space>. It will change between different layouts.

We may also use command select-layout (or selectl for short) instead. Possible layouts are: even-horizontal, even-vertical, main-horizontal, main-vertical, tiled.

Ref:

zoom a pane#

To temporarily zoom in and zoom out a pane, press <prefix>z. It will toggle the zoom state of current pane.

Create a pane that spans window width#

I have two vertical pane side by side in a window, and I want to create a new pane above these two panes, which will span the entire window width. Essentially, I want to change from the following layout:

+--------------+--------------+
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
+--------------+--------------+

to the below layout:

+-----------------------------+
|                             |
+--------------+--------------+
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
|              |              |
+--------------+--------------+

By default, split-window command only spans the width of current pane. We can use the -f option to make the new pane span the entire window width. The help for -f says that:

-f – create new pane spanning full window width or height

To make the new pane created above, we need to use -b option:

-b – create new pane left of or above target pane

Combining the two options, we can use the following command to create what we want:

# run the command after pressing <prefix>
:split-window -fbv

Similarly, if we have two pane one on the other, we want to create a new pane, and get the following layout:

+-----------------+-----------+
|                 |           |
|                 |           |
|                 |           |
+-----------------+           |
|                 |           |
|                 |           |
|                 |           |
+-----------------+-----------+

we can use the following command:

Ref:

swap two panes#

To swap two panes in Tmux, first we need to check their index: press <prefix> + q to show the pane index. Then we can use the tmux command swap-pane to swap the two panes (tmux command mode are activated by pressing <prefix>, followed by :). For example, if we want to swap pane 0 with pane 2, use the following command:

Ref:

equalize two panes#

To make two panes have the same width in side by side position, press <prefix> Alt-1 or run command select-layout even-horizontal. To make two panes have the same height and in top-down position, press <prefix> Alt-2 or run command: select-layout even-vertical.

Ref: