Forked from MohamedAlaa/tmux-cheatsheet.markdown
Last active
October 20, 2025 15:42
-
Star
(1,772)
You must be signed in to star a gist -
Fork
(484)
You must be signed in to fork a gist
-
-
Save ryerh/14b7c24dfd623ef8edc7 to your computer and use it in GitHub Desktop.
Revisions
-
ryerh revised this gist
Sep 9, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ 注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。 # Tmux 快捷键 & 速查表 & 简明教程 启动新会话: -
ryerh revised this gist
Sep 9, 2019 . No changes.There are no files selected for viewing
-
ryerh revised this gist
Dec 29, 2018 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -85,13 +85,15 @@ ## 文本复制模式: 按下 `PREFIX-[` 进入文本复制模式。可以使用方向键在屏幕中移动光标。默认情况下,方向键是启用的。在配置文件中启用 Vim 键盘布局来切换窗口、调整窗格大小。Tmux 也支持 Vi 模式。要是想启用 Vi 模式,只需要把下面这一行添加到 .tmux.conf 中: setw -g mode-keys vi 启用这条配置后,就可以使用 h、j、k、l 来移动光标了。 想要退出文本复制模式的话,按下回车键就可以了。然后按下 `PREFIX-]` 粘贴刚才复制的文本。 一次移动一格效率低下,在 Vi 模式启用的情况下,可以辅助一些别的快捷键高效工作。 例如,可以使用 w 键逐词移动,使用 b 键逐词回退。使用 f 键加上任意字符跳转到当前行第一次出现该字符的位置,使用 F 键达到相反的效果。 @@ -168,7 +170,7 @@ set -g prefix C-z set -g base-index 1 # 窗口编号从 1 开始计数 set -g display-panes-time 10000 # PREFIX-Q 显示编号的驻留时长,单位 ms set -g mouse on # 开启鼠标 set -g pane-base-index 1 # 窗格编号从 1 开始计数 set -g renumber-windows on # 关掉某个窗口后,编号重排 -
ryerh revised this gist
Sep 4, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ 注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。 # Tmux 快捷键 & 速查表 -
ryerh revised this gist
Aug 26, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -203,7 +203,7 @@ set -g @prefix_highlight_show_copy_mode 'on' set -g @prefix_highlight_copy_mode_attr 'fg=white,bg=blue' # 初始化 TPM 插件管理器 (放在配置文件的最后) run '~/.tmux/plugins/tpm/tpm' # ----------------------------------------------------------------------------- # 结束 -
ryerh revised this gist
Aug 26, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -154,7 +154,7 @@ unbind Down bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp ## 参考配置文件(~/.tmux.conf): 下面这份配置是我使用 Tmux 几年来逐渐精简后的配置,请自取。 -
ryerh revised this gist
Aug 26, 2018 . 1 changed file with 50 additions and 52 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ 注意:本文内容适用于 Tmux 2.3 及以上的版本,不计划兼容低版本。 # Tmux 快捷键 & 速查表 启动新会话: @@ -134,11 +136,8 @@ ## 配置选项: # 鼠标支持 - 设置为 on 来启用鼠标(与 2.1 之前的版本有区别,请自行查阅 man page) * set -g mouse on # 设置默认终端模式为 256color set -g default-terminal "screen-256color" @@ -157,57 +156,56 @@ ## 配置文件(~/.tmux.conf): 下面这份配置是我使用 Tmux 几年来逐渐精简后的配置,请自取。 ```bash # ----------------------------------------------------------------------------- # Tmux 基本配置 - 要求 Tmux >= 2.3 # 如果不想使用插件,只需要将此节的内容写入 ~/.tmux.conf 即可 # ----------------------------------------------------------------------------- # C-b 和 VIM 冲突,修改 Prefix 组合键为 Control-Z,按键距离近 set -g prefix C-z set -g base-index 1 # 窗口编号从 1 开始计数 set -g display-panes-time 10000 # PREFIX-Q 显示编号保留时间,单位 ms set -g mouse on # 开启鼠标 set -g pane-base-index 1 # 窗格编号从 1 开始计数 set -g renumber-windows on # 关掉某个窗口后,编号重排 setw -g allow-rename off # 禁止活动进程修改窗口名 setw -g automatic-rename off # 禁止自动命名新窗口 setw -g mode-keys vi # 进入复制模式的时候使用 vi 键位(默认是 EMACS) # ----------------------------------------------------------------------------- # 使用插件 - via tpm # 1. 执行 git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm # 2. 执行 bash ~/.tmux/plugins/tpm/bin/install_plugins # ----------------------------------------------------------------------------- setenv -g TMUX_PLUGIN_MANAGER_PATH '~/.tmux/plugins' # 推荐的插件(请去每个插件的仓库下读一读使用教程) set -g @plugin 'seebi/tmux-colors-solarized' set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'tmux-plugins/tmux-prefix-highlight' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tpm' # tmux-resurrect set -g @resurrect-dir '~/.tmux/resurrect' # tmux-prefix-highlight set -g status-right '#{prefix_highlight} #H | %a %Y-%m-%d %H:%M' set -g @prefix_highlight_show_copy_mode 'on' set -g @prefix_highlight_copy_mode_attr 'fg=white,bg=blue' # 初始化 TPM 插件管理器 (放在配置文件的最后) run '~/.config/tmux/plugins/tpm/tpm' # ----------------------------------------------------------------------------- # 结束 # ----------------------------------------------------------------------------- ``` -
ryerh revised this gist
Feb 19, 2016 . 1 changed file with 21 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -186,16 +186,28 @@ bind-key l select-pane -R # copy-mode 将快捷键设置为 vi 模式 setw -g mode-keys vi # 启用鼠标(Tmux v2.1) set -g mouse on # 更新配置文件 bind r source-file ~/.tmux.conf \; display "已更新" #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # Tmux Plugin Manager(Tmux v2.1) # Tmux Resurrect set -g @plugin 'tmux-plugins/tmux-resurrect' # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' # Other examples: # set -g @plugin 'github_username/plugin_name' # set -g @plugin '[email protected]/user/plugin' # set -g @plugin '[email protected]/user/plugin' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm' #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ``` -
ryerh revised this gist
Jan 28, 2016 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,12 @@ , 重命名当前窗口 & 关闭当前窗口 ## 调整窗口排序 swap-window -s 3 -t 1 交换 3 号和 1 号窗口 swap-window -t 1 交换当前和 1 号窗口 move-window -t 1 移动当前窗口到 1 号 ## <a name="PanesSplits"></a>窗格(分割窗口) % 垂直分割 @@ -180,6 +186,16 @@ bind-key l select-pane -R # copy-mode 将快捷键设置为 vi 模式 setw -g mode-keys vi # 启用鼠标 setw -g mode-mouse on set -g mouse-select-pane on set -g mouse-resize-pane on set -g mouse-select-window on # 更新配置文件 bind r source-file ~/.tmux.conf \; display "Reloaded!" # 索引从 1 开始,默认从 0 开始 set -g base-index 1 set -g pane-base-index 1 ``` -
ryerh revised this gist
Jan 26, 2016 . No changes.There are no files selected for viewing
-
ryerh revised this gist
Jan 26, 2016 . 1 changed file with 31 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,37 +87,37 @@ 例如,可以使用 w 键逐词移动,使用 b 键逐词回退。使用 f 键加上任意字符跳转到当前行第一次出现该字符的位置,使用 F 键达到相反的效果。 vi emacs 功能 ^ M-m 反缩进 Escape C-g 清除选定内容 Enter M-w 复制选定内容 j Down 光标下移 h Left 光标左移 l Right 光标右移 L 光标移到尾行 M M-r 光标移到中间行 H M-R 光标移到首行 k Up 光标上移 d C-u 删除整行 D C-k 删除到行末 $ C-e 移到行尾 : g 前往指定行 C-d M-Down 向下滚动半屏 C-u M-Up 向上滚动半屏 C-f Page down 下一页 w M-f 下一个词 p C-y 粘贴 C-b Page up 上一页 b M-b 上一个词 q Escape 退出 C-Down or J C-Down 向下翻 C-Up or K C-Up 向下翻 n n 继续搜索 ? C-r 向前搜索 / C-s 向后搜索 0 C-a 移到行首 Space C-Space 开始选中 C-t 字符调序 ## 杂项: -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -154,8 +154,9 @@ ```bash # 基础设置 set -g default-terminal "screen-256color" set -g display-time 3000 set -g escape-time 0 set -g history-limit 65535 set -g base-index 1 set -g pane-base-index 1 -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 33 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -149,24 +149,36 @@ unbind Down bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp ## 配置文件(~/.tmux.conf): ```bash # 基础设置 set -g default-terminal "screen-256color" set -g default-terminal "screen-256color" set -g default-terminal "screen-256color" set -g base-index 1 set -g pane-base-index 1 # 前缀绑定 (Ctrl+a) set -g prefix ^a unbind ^b bind a send-prefix # 分割窗口 unbind '"' bind - splitw -v unbind % bind | splitw -h # 选中窗口 bind-key k select-pane -U bind-key j select-pane -D bind-key h select-pane -L bind-key l select-pane -R # copy-mode 将快捷键设置为 vi 模式 setw -g mode-keys vi # 更新配置文件 bind r source-file ~/.tmux.conf \; display "Reloaded!" ``` -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 17 additions and 27 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,39 +2,31 @@ 启动新会话: tmux [new -s 会话名 -n 窗口名] 恢复会话: tmux at [-t 会话名] 列出所有会话: tmux ls <a name="killSessions"></a>关闭会话: tmux kill-session -t 会话名 <a name="killAllSessions"></a>关闭所有会话: tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill # 在 Tmux 中,按下 Tmux 前缀 `ctrl+b`,然后: ## 会话 :new<回车> 启动新会话 s 列出所有会话 $ 重命名当前会话 ## <a name="WindowsTabs"></a>窗口 (标签页) @@ -52,8 +44,6 @@ " 水平分割 o 交换窗格 x 关闭窗格 ⍽ 左边这个符号代表空格键 - 切换布局 q 显示每个窗格是第几个,当数字出现的时候按数字几就选中第几个窗格 { 与上一个窗格交换位置 @@ -62,7 +52,7 @@ ## <a name="syncPanes"></a>同步窗格 这么做可以切换到想要的窗口,输入 Tmux 前缀和一个冒号呼出命令提示行,然后输入: ``` :setw synchronize-panes @@ -99,29 +89,29 @@ 功能 vi emacs 反缩进 ^ M-m 清除选定内容 Escape C-g 复制选定内容 Enter M-w 光标下移 j Down 光标左移 h Left 光标右移 l Right 光标移到尾行 L 光标移到中间行 M M-r 光标移到首行 H M-R 光标上移 k Up 删除整行 d C-u 删除到行末 D C-k 移到行尾 $ C-e 前往指定行 : g 向下滚动半屏 C-d M-Down 向上滚动半屏 C-u M-Up 下一页 C-f Page down 下一个词 w M-f 粘贴 p C-y 上一页 C-b Page up 上一个词 b M-b 退出 q Escape 向下翻 C-Down or J C-Down 向下翻 C-Up or K C-Up 继续搜索 n n 向前搜索 ? C-r 向后搜索 / C-s -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Tmux 快捷键 & 速查表 启动新会话: -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 62 additions and 69 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ ## 会话 :new<回车> 启动新会话 s 列出所有会话 $ 重命名当前会话 @@ -54,122 +54,115 @@ x 关闭窗格 + break pane into window (e.g. to select text by mouse to copy) - restore pane from window ⍽ 左边这个符号代表空格键 - 切换布局 q 显示每个窗格是第几个,当数字出现的时候按数字几就选中第几个窗格 { 与上一个窗格交换位置 } 与下一个窗格交换位置 z 切换窗格最大化/最小化 ## <a name="syncPanes"></a>同步窗格 这么做可以切换到想要的窗口,输入 Tmux 前缀(通常是 Ctrl-B 或 Ctrl-A)和一个冒号呼出命令提示行,然后输入: ``` :setw synchronize-panes ``` 你可以指定开或关,否则重复执行命令会在两者间切换。 这个选项值针对某个窗口有效,不会影响别的会话和窗口。 完事儿之后再次执行命令来关闭。[帮助](http://blog.sanctum.geek.nz/sync-tmux-panes/) ## 调整窗格尺寸 如果你不喜欢默认布局,可以重调窗格的尺寸。虽然这很容易实现,但一般不需要这么干。这几个命令用来调整窗格: PREFIX : resize-pane -D 当前窗格向下扩大 1 格 PREFIX : resize-pane -U 当前窗格向上扩大 1 格 PREFIX : resize-pane -L 当前窗格向左扩大 1 格 PREFIX : resize-pane -R 当前窗格向右扩大 1 格 PREFIX : resize-pane -D 20 当前窗格向下扩大 20 格 PREFIX : resize-pane -t 2 -L 20 编号为 2 的窗格向左扩大 20 格 ## 文本复制模式: 按下**前缀 [**进入文本复制模式。可以使用方向键在屏幕中移动光标。默认情况下,方向键是启用的。在配置文件中启用 Vim 键盘布局来切换窗口、调整窗格大小。Tmux 也支持 Vi 模式。要是想启用 Vi 模式,只需要把下面这一行添加到 .tmux.conf 中: setw -g mode-keys vi 启用这条配置后,就可以使用 h、j、k、l 来移动光标了。 想要退出文本复制模式的话,按下回车键就可以了。一次移动一格效率低下,在 Vi 模式启用的情况下,可以辅助一些别的快捷键高效工作。 例如,可以使用 w 键逐词移动,使用 b 键逐词回退。使用 f 键加上任意字符跳转到当前行第一次出现该字符的位置,使用 F 键达到相反的效果。 功能 vi emacs 反缩进 ^ M-m 清除选定内容 Escape C-g 复制选定内容 Enter M-w 光标下移 j Down 光标左移 h Left 光标右移 l Right 光标移到尾行 L 光标移到中间行 M M-r 光标移到首行 H M-R 光标上移 k Up 删除整行 d C-u 删除到行末 D C-k 移到行尾 $ C-e 前往指定行 : g 向下滚动半屏 C-d M-Down 向上滚动半屏 C-u M-Up 下一页 C-f Page down 下一个词 w M-f 粘贴 p C-y 上一页 C-b Page up 上一个词 b M-b 退出 q Escape 向下翻 C-Down or J C-Down 向下翻 C-Up or K C-Up 继续搜索 n n 向前搜索 ? C-r 向后搜索 / C-s 移到行首 0 C-a 开始选中 Space C-Space 字符调序 C-t ## 杂项: d 退出 tmux(tmux 仍在后台运行) t 窗口中央显示一个数字时钟 ? 列出所有快捷键 : 命令提示符 ## 配置选项: # 鼠标支持 - 设置为 on 来启用鼠标 * setw -g mode-mouse off * set -g mouse-select-pane off * set -g mouse-resize-pane off * set -g mouse-select-window off # 设置默认终端模式为 256color set -g default-terminal "screen-256color" # 启用活动警告 setw -g monitor-activity on set -g visual-activity on # 居中窗口列表 set -g status-justify centre # 最大化/恢复窗格 unbind Up bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp unbind Down bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp ## 参考资源: * [tmux: 高效的无鼠标开发环境](http://pragprog.com/book/bhtmux/tmux) * [如何重排窗口](http://superuser.com/questions/343572/tmux-how-do-i-reorder-my-windows) ## Notes: -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 28 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -28,44 +28,41 @@ tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill # 在 Tmux 中,按下前缀 `ctrl+b`(我的配置文件中修改为 `ctrl+a`),然后: ## 会话 :new<CR> 启动新会话 s 列出所有会话 $ 重命名当前会话 ## <a name="WindowsTabs"></a>窗口 (标签页) c 创建新窗口 w 列出所有窗口 n 后一个窗口 p 前一个窗口 f 查找窗口 , 重命名当前窗口 & 关闭当前窗口 ## <a name="PanesSplits"></a>窗格(分割窗口) % 垂直分割 " 水平分割 o 交换窗格 x 关闭窗格 + break pane into window (e.g. to select text by mouse to copy) - restore pane from window ⍽ space - 切换布局 q 显示每个窗格是第几个,当数字出现的时候按数字几就选中第几个窗格 { 与上一个窗格交换位置 } 与下一个窗格交换位置 z 切换窗格最大化/最小化 ## <a name="syncPanes"></a>同步窗格 You can do this by switching to the appropriate window, typing your Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up a Tmux command line, and typing: ``` @@ -95,7 +92,7 @@ You can also resize panes if you don’t like the layout defaults. I personally ## 文本复制模式: 按下**前缀 [**进入文本复制模式。可是使用方向键 Pressing PREFIX [ places us in Copy mode. We can then use our movement keys to move our cursor around the screen. By default, the arrow keys work. we set our configuration file to use Vim keys for moving between windows and resizing panes so we wouldn’t have to take our hands off the home row. tmux has a vi mode for working with the buffer as well. To enable it, add this line to .tmux.conf: @@ -139,14 +136,14 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo Start selection Space C-Space Transpose chars C-t ## 杂项: d detach t big clock ? list shortcuts : prompt ## 配置选项: # Mouse support - set to on if you want to use the mouse * setw -g mode-mouse off @@ -169,7 +166,7 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo unbind Down bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp ## 参考资源: * [tmux: Productive Mouse-Free Development](http://pragprog.com/book/bhtmux/tmux) * [How to reorder windows](http://superuser.com/questions/343572/tmux-how-do-i-reorder-my-windows) @@ -178,15 +175,15 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * ## 更新日志: * 1411143833002 - 在窗格(分割窗口)这一节中添加[切换窗格最大化/最小化](#PanesSplits)。 * 1411143833002 - [添加同步窗格](#syncPanes) * 1414276652677 - [添加关闭所有会话](#killAllSessions) * 1438585211173 - [感谢 @justinjhendrick 修正创建并添加前后窗口](#WindowsTabs) ## 大家来帮忙: 我们注意到大家都在帮忙提供新的帮助和技巧来不断丰富我们的速查表,所以如果你有什么好想法请给我们发推吧! * Twitter: [@MohammedAlaa](http://twitter.com/MohammedAlaa) -
ryerh revised this gist
Jan 25, 2016 . 1 changed file with 28 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,42 +1,42 @@ # tmux 快捷键 & 速查表 启动新会话: tmux 启动名为 myname 的新会话: tmux new -s myname 恢复会话: tmux a #(等价于 at 或 attach) 恢复名为 myname 的会话: tmux a -t myname 列出所有会话: tmux ls <a name="killSessions"></a>关闭会话: tmux kill-session -t myname <a name="killAllSessions"></a>关闭所有会话: tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill 在 Tmux 中,按下前缀 `ctrl+b`(我的配置修改为 ctrl+a),然后: ## 会话: :new<CR> new session s list sessions $ name session ## <a name="WindowsTabs"></a>窗口 (标签页) c create window w list windows @@ -46,23 +46,25 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: , name window & kill window ## <a name="PanesSplits"></a>窗格(分割窗口) % 垂直分割 " 水平分割 o 交换窗格 q 显示窗格数量 x 关闭窗格 + break pane into window (e.g. to select text by mouse to copy) - restore pane from window ⍽ space - 切换布局 <prefix> q (Show pane numbers, when the numbers show up type the key to goto that pane) <prefix> { (Move the current pane left) <prefix> } (Move the current pane right) <prefix> z toggle pane zoom ## <a name="syncPanes"></a>同步窗格 You can do this by switching to the appropriate window, typing your Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up a Tmux command line, and typing: @@ -73,7 +75,9 @@ You can do this by switching to the appropriate window, typing your Tmux prefix You can optionally add on or off to specify which state you want; otherwise the option is simply toggled. This option is specific to one window, so it won’t change the way your other sessions or windows operate. When you’re done, toggle it off again by repeating the command. [tip source](http://blog.sanctum.geek.nz/sync-tmux-panes/) ## 调整窗格尺寸 如果你不喜欢默认布局,可以重调窗格的尺寸。尽管这很容易实现,但我一般没必要这么干。 You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes: @@ -89,7 +93,9 @@ You can also resize panes if you don’t like the layout defaults. I personally PREFIX : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells) ## 文本复制模式: 按下**前缀 [** Pressing PREFIX [ places us in Copy mode. We can then use our movement keys to move our cursor around the screen. By default, the arrow keys work. we set our configuration file to use Vim keys for moving between windows and resizing panes so we wouldn’t have to take our hands off the home row. tmux has a vi mode for working with the buffer as well. To enable it, add this line to .tmux.conf: -
MohamedAlaa revised this gist
Aug 3, 2015 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,10 +36,12 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: s list sessions $ name session ## <a name="WindowsTabs"></a>Windows (tabs) c create window w list windows n next window p previous window f find window , name window & kill window @@ -175,6 +177,7 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * 1411143833002 - Added [toggle zoom](#PanesSplits) under Panes (splits) section. * 1411143833002 - [Added Sync Panes](#syncPanes) * 1414276652677 - [Added Kill all tmux sessions ](#killAllSessions) * 1438585211173 - [corrected create and add next and previus thanks to @justinjhendrick](#WindowsTabs) ## Request an Update: -
MohamedAlaa revised this gist
Apr 2, 2015 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -75,17 +75,18 @@ You can optionally add on or off to specify which state you want; otherwise the You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes: PREFIX : resize-pane -D (Resizes the current pane down) PREFIX : resize-pane -U (Resizes the current pane upward) PREFIX : resize-pane -L (Resizes the current pane left) PREFIX : resize-pane -R (Resizes the current pane right) PREFIX : resize-pane -D 20 (Resizes the current pane down by 20 cells) PREFIX : resize-pane -U 20 (Resizes the current pane upward by 20 cells) PREFIX : resize-pane -L 20 (Resizes the current pane left by 20 cells) PREFIX : resize-pane -R 20 (Resizes the current pane right by 20 cells) PREFIX : resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells) PREFIX : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells) ## Copy mode: Pressing PREFIX [ places us in Copy mode. We can then use our movement keys to move our cursor around the screen. By default, the arrow keys work. we set our configuration file to use Vim keys for moving between windows and resizing panes so we wouldn’t have to take our hands off the home row. tmux has a vi mode for working with the buffer as well. To enable it, add this line to .tmux.conf: -
MohamedAlaa revised this gist
Oct 25, 2014 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,10 +20,14 @@ list sessions: tmux ls <a name="killSessions"></a>kill session: tmux kill-session -t myname <a name="killAllSessions"></a>Kill all the tmux sessions: tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: ## Sessions @@ -169,6 +173,7 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * 1411143833002 - Added [toggle zoom](#PanesSplits) under Panes (splits) section. * 1411143833002 - [Added Sync Panes](#syncPanes) * 1414276652677 - [Added Kill all tmux sessions ](#killAllSessions) ## Request an Update: -
MohamedAlaa revised this gist
Sep 19, 2014 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -169,3 +169,9 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * 1411143833002 - Added [toggle zoom](#PanesSplits) under Panes (splits) section. * 1411143833002 - [Added Sync Panes](#syncPanes) ## Request an Update: We Noticed that our Cheatsheet is growing and people are coloberating to add new tips and tricks, so please tweet to me what would you like to add and let's make it better! * Twitter: [@MohammedAlaa](http://twitter.com/MohammedAlaa) -
MohamedAlaa revised this gist
Sep 19, 2014 . 1 changed file with 19 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,7 +40,7 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: , name window & kill window ## <a name="PanesSplits"></a>Panes (splits) % vertical split " horizontal split @@ -51,9 +51,21 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: + break pane into window (e.g. to select text by mouse to copy) - restore pane from window ⍽ space - toggle between layouts <prefix> q (Show pane numbers, when the numbers show up type the key to goto that pane) <prefix> { (Move the current pane left) <prefix> } (Move the current pane right) <prefix> z toggle pane zoom ## <a name="syncPanes"></a>Sync Panes You can do this by switching to the appropriate window, typing your Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up a Tmux command line, and typing: ``` :setw synchronize-panes ``` You can optionally add on or off to specify which state you want; otherwise the option is simply toggled. This option is specific to one window, so it won’t change the way your other sessions or windows operate. When you’re done, toggle it off again by repeating the command. [tip source](http://blog.sanctum.geek.nz/sync-tmux-panes/) ## Resizing Panes @@ -153,6 +165,7 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * ## Changelog: * 1411143833002 - Added [toggle zoom](#PanesSplits) under Panes (splits) section. * 1411143833002 - [Added Sync Panes](#syncPanes) -
MohamedAlaa revised this gist
Jun 3, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -148,7 +148,6 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * [tmux: Productive Mouse-Free Development](http://pragprog.com/book/bhtmux/tmux) * [How to reorder windows](http://superuser.com/questions/343572/tmux-how-do-i-reorder-my-windows) ## Notes: -
MohamedAlaa revised this gist
Jun 3, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -148,7 +148,7 @@ For example, we can use "w" to jump to the next word and "b" to jump back one wo * [tmux: Productive Mouse-Free Development](http://pragprog.com/book/bhtmux/tmux) * [How to reorder windows](http://superuser.com/questions/343572/tmux-how-do-i-reorder-my-windows) * ~~[cheat sheet](http://cheat.errtheblog.com/s/tmux/)~~ ## Notes: -
MohamedAlaa revised this gist
Aug 11, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,8 +42,8 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: ## Panes (splits) % vertical split " horizontal split o swap panes q show pane numbers -
MohamedAlaa revised this gist
Oct 3, 2012 . 1 changed file with 32 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -82,6 +82,38 @@ To get out of Copy mode, we just press the ENTER key. Moving around one characte For example, we can use "w" to jump to the next word and "b" to jump back one word. And we can use "f", followed by any character, to jump to that character on the same line, and "F" to jump backwards on the line. Function vi emacs Back to indentation ^ M-m Clear selection Escape C-g Copy selection Enter M-w Cursor down j Down Cursor left h Left Cursor right l Right Cursor to bottom line L Cursor to middle line M M-r Cursor to top line H M-R Cursor up k Up Delete entire line d C-u Delete to end of line D C-k End of line $ C-e Goto line : g Half page down C-d M-Down Half page up C-u M-Up Next page C-f Page down Next word w M-f Paste buffer p C-y Previous page C-b Page up Previous word b M-b Quit mode q Escape Scroll down C-Down or J C-Down Scroll up C-Up or K C-Up Search again n n Search backward ? C-r Search forward / C-s Start of line 0 C-a Start selection Space C-Space Transpose chars C-t ## Misc d detach -
MohamedAlaa revised this gist
Jun 25, 2012 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,9 +56,8 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: PREFIX } (Move the current pane right) ## Resizing Panes You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes: PREFIX : resize-pane (By default it resizes the current pane down) PREFIX : resize-pane -U (Resizes the current pane upward) -
MohamedAlaa revised this gist
Jun 25, 2012 . 1 changed file with 15 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,7 +55,21 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: PREFIX { (Move the current pane left) PREFIX } (Move the current pane right) ## Resizing Panes Resizing Panes You can also resize panes if you don’t like the layout defaults. I personally rarely need to do this, though it’s handy to know how. Here is the basic syntax to resize panes: PREFIX : resize-pane (By default it resizes the current pane down) PREFIX : resize-pane -U (Resizes the current pane upward) PREFIX : resize-pane -L (Resizes the current pane left) PREFIX : resize-pane -R (Resizes the current pane right) PREFIX : resize-pane 20 (Resizes the current pane down by 20 cells) PREFIX : resize-pane -U 20 (Resizes the current pane upward by 20 cells) PREFIX : resize-pane -L 20 (Resizes the current pane left by 20 cells) PREFIX : resize-pane -R 20 (Resizes the current pane right by 20 cells) PREFIX : resize-pane -t 2 20 (Resizes the pane with the id of 2 down by 20 cells) PREFIX : resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells) ## Copy mode: -
MohamedAlaa revised this gist
Jun 25, 2012 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,6 +51,11 @@ In tmux, hit the prefix `ctrl+b` (my modified prefix is ctrl+a) and then: + break pane into window (e.g. to select text by mouse to copy) - restore pane from window ⍽ space - toggle between layouts PREFIX q (Show pane numbers, when the numbers show up type the key to goto that pane) PREFIX { (Move the current pane left) PREFIX } (Move the current pane right) ## Resizing Panes ## Copy mode:
NewerOlder