* Ctrl + B 為 tmux 預設前置鍵。所有功能都要先按著前置鍵,放開後,再按其它鍵。 * 優先開啟滑鼠模式,方便點擊切換 window 和 pane。 * [[https://www.youtube.com/watch?v=rc-v6eHdaN4|Tutorial - tmux Basics Part 4: Configuration]] * [[https://linux.cn/article-5666-1.html|Tmux 速成教程:技巧和调整]] * [[https://people.cs.nctu.edu.tw/~wangth/course/netadm/slides/Tmux.pdf|Tmux]] * [[https://larrylu.blog/tmux-33a24e595fbc|終端機 session 管理神器 — tmux]] * 以瀏覽器作為類比,tmux 的 session 代表開啟一個瀏覽器,session 中的 window 代表開啟瀏覽器中的頁籤 (tab),pane 是分割窗口 (split window)。{{https://cdn-images-1.medium.com/max/1600/1*Yp_O0xCIxRZ1JktuBUaKEA.png?700}} * [[http://josephj.com/entry.php?id=373|進化版 screen - tmux]] * [[https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/|A Quick and Easy Guide to tmux]] * [[https://andyyou.github.io/2017/11/27/tmux-notes/|tmux 快速入門筆記]] * [[https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/|Making tmux Pretty and Usable - A Guide to Customizing your tmux.conf]] * [[https://github.com/chriskempson/base16-shell|Base16 for Shells]] ====== 指令快速入門 ====== $ tmux # 列出當前有多少 session。 $ tmux ls # attach 指定的 session。 $ tmux attach [-t number] # 從當前 session detach。 $ tmux detach # 刪除指定的 session。 $ tmux kill-session [-t number] * [[http://atkinsam.com/documents/tmux.pdf|tmux cheat sheet]]: 在 tmux 內按前置鍵,放開後,再按下面的按鍵。 * c : 創建 window。 * , : 重命名當前 window。 * % : 垂直分割當前 window 成兩個 pane。 * " : 水平分割當前 window 成兩個 pane。 * z : 將當前 pane 做全螢幕縮放。 * d : 退出當前 session。 ====== 設定檔快速入門 ====== tmux 1.x 和 2.x 版設定檔寫法不同,底下適用於 2.x 版。 * [[https://github.com/tmux/tmux/wiki/FAQ|tmux FAQ]] * [[https://stackoverflow.com/questions/45017773/what-are-the-differences-between-set-g-set-ga-and-set-option-g-in-a-tmux-co|What are the differences between set -g, set -ga and set-option -g in a .tmux.conf file?]] * 最簡設置,只開啟滑鼠模式。其它一切不動。 $ cat ~/.tmux.conf # MOUSE MODE set -g mouse on * 視自己習慣,增加其它設置。 $ cat ~/.tmux.conf # GENERAL SETTING # 將前置鍵設成 Ctrl + A set -g prefix C-a unbind C-b bind C-a send-prefix # 禁止 tmux 重命名 window 名稱 setw -g automatic-rename off # 設置預設 terminal emulator set -g default-terminal "xterm" # 按下前置鍵後,按 r 重讀 .tmux.conf bind-key r source-file ~/.tmux.conf; display-message "~/.tmux.conf is reloaded" # STATUSBAR STYLE # VI MODE # MOUSE MODE set -g mouse on * [[https://awhan.wordpress.com/2012/04/18/tmux-copy-paste-with-mouse/|tmux copy paste with mouse]] * 按著 S,同時用滑鼠選擇要複製的文字,按右鍵選擇拷貝。 * [[https://cizixs.com/2015/08/16/vi-mode-in-tmux/|使用 vi 模式操作tmux 屏幕]] ====== 外部連結 ====== * [[https://github.com/tmux/tmux/wiki|tmux]] * [[http://aokolish.me/blog/2013/02/12/using-tmux-and-tmuxinator|Using Tmux and Tmuxinator]] * [[http://crazylion.wordpress.com/2011/09/19/tmuxinator/|tmuxinator]] * [[https://linux.cn/article-5667-1.html|用 Tmux 和 Vim 打造 IDE]]