635 views
 owned this note
--- disqus: ncumcl --- tmux === ###### tags: `MCL Notebook` `tmux` ## 重新載入 .tmux.conf ``` C-b :source-file ~/.tmux.conf $ tmux source-file ~/.tmux.conf ``` ### .tmux.conf ``` # command line 的時候可以直接跳整個 word set-window-option -g xterm-keys on # 設定快捷 bind-key # 閱讀模式時,使用 vim 的編輯方式 ``` #### 滑鼠功能 ``` # 支援滑鼠選取內容 setw -g mode-mouse on # 支援使用滑鼠拖曳來調整 panel 大小 (拖曳 panel 分割線) setw -g mouse-resize-pane on # 支援使用滑鼠點選來切換 panel setw -g mouse-select-pane on # 支援使用滑鼠點擊 windows 的名字來切換 (下方標 1, 2, 3 的) setw -g mouse-select-window on ``` [from](http://louiszhai.github.io/2017/09/30/tmux/) 上面的語法在比較新版的 tmux 上面已經被棄用,換成以下的指令: ``` set-option -g mouse on ``` ### 好用的指令 | 指令 | 效果 | | ------- | --------------------------- | |C-b ( | previous session | |C-b ) | next session | |C-b p | previous window | |C-b n | next window | |C-a , | rename the current window | ### Plugin #### [tmux-plugins/tmux-yank](https://github.com/tmux-plugins/tmux-yank) #### Install - edit .tmux.conf ``` set -g @plugin 'tmux-plugins/tmux-yank' ``` - Perfix-I 來安裝 - 安裝相依套件 ``` bash sudo apt-get install xsel ``` ### 參考來源 [個人的設定](https://gist.github.com/andreyvit/2921703) [常用操作](https://larrylu.blog/tmux-33a24e595fbc) [完整的 key mapping](https://www.cheatography.com/bechtold/cheat-sheets/tmux-the-terminal-multiplexer/) ## 學長介紹的來源 [tmux-plugins](https://github.com/tmux-plugins) ## 感覺可以用 - [tmux-sidebar_v1.9](https://github.com/tmux-plugins/tmux-sidebar) 可以有檔案 tree 可以看 - [tmux-resurrect](https://github.com/tmux-plugins/tmux-resurrect) 可以打 tmux 當時的環境存起來,關機才不會不見 - [tmux-online-status_v1.9](https://github.com/tmux-plugins/tmux-online-status) tmux的client可能沒有連上他的server,會有無法回應的問題,因此如果常發生這件事的話,這個會很好用 - [tpm](https://github.com/tmux-plugins/tpm) tmux的plugin管理器 - [tmux-open](https://github.com/tmux-plugins/tmux-open) 可以在閱讀模式(C+[)下,直接移動游標到我們想要開啟的檔案上,按下o就會用預設的開啟,文字檔可以選擇預設的編輯器,URL也可以 - [tmux-prefix-highlight](https://github.com/tmux-plugins/tmux-prefix-highlight) prefix key按下去之後,最下面的bar可以顯示已經按過了 - [tmux-net-speed](https://github.com/tmux-plugins/tmux-net-speed) 顯示網路介面的速度 - [tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) tmux中直接可以搜尋(支援正規表示法),複製,貼上 - [tmux-yank](https://github.com/tmux-plugins/tmux-yank) 又是一個複製貼上,但感覺設計的蠻好用的 - [tmux-cpu](https://github.com/tmux-plugins/tmux-cpu) 看目前CPU、GPU使用率,但只有單個CPU - [tmux-logging_v1.9](https://github.com/tmux-plugins/tmux-logging) 下 command 後的結果,還有指令,都會存到檔案中,也可以下指令去清除他 - [vim-tmux-focus-events](https://github.com/tmux-plugins/vim-tmux-focus-events) 一些原 vim 的 plugin 在 tmux 下會不能使用,因此 tmux 需要安裝此 plugin 讓 vim 可以正常 - [tmux-mem-cpu-load](https://github.com/thewtex/tmux-mem-cpu-load) 顯示幕前記憶體使用 ## 目前沒有想法用 - [tmux-battery](https://github.com/tmux-plugins/tmux-battery) 看目前電量,是否在充電中 - [tmux-maildir-counter](https://github.com/tmux-plugins/tmux-maildir-counter) 計算指定的 mail 資料夾中,有多少檔案,應該也就是有多少email - [tmux-urlview](https://github.com/tmux-plugins/tmux-urlview) terminal 中的 URL 可以直接選擇,然後使用瀏覽器打開 - [tmux-fpp](https://github.com/tmux-plugins/tmux-fpp) 可以一次選取多個檔開啟編輯器編輯 - [tmux-pain-control](https://github.com/tmux-plugins/tmux-pain-control) 看起來就只是切換control plan,原本的tmux就可以了吧?! ## 看不懂 - [tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) - [tmux-sensible](https://github.com/tmux-plugins/tmux-sensible) - [powerline-config](https://github.com/mriehl/powerline-config) 可以讓你的 powerline 顏色更好看 ![](https://github.com/mriehl/powerline-config/raw/master/powerline.png) # 備註 給自己看的啦XDD ## 希望有的功能 - 滑鼠可以點下方的 windows - 創建新的 windows 的時候,可以直接取名(利用快捷鍵的方式製作) ## 目前找到不錯的來源 - [gitst](https://gist.github.com/ryerh/14b7c24dfd623ef8edc7 ) - [設定教學](http://chimerhapsody.blogspot.com/2014/07/tmux_22.html) - [如果想要 Ctrl 左右鍵之類的來使用(不用 prefix)](https://superuser.com/questions/238545/binding-a-command-in-tmux-without-using-the-prefix-key) ## 先記起來之後在處理 - prfix + <C-o> 為[交換 pane](https://superuser.com/questions/879190/how-does-one-swap-two-panes-in-tmux/1020805)