tmux 是常用的終端機分割畫面工具,有些人會使用 screen。不過在自己的電腦習慣直接 cmd + t 開分頁視窗。在 ssh 就會使用 tmux,因此沒在自己的電腦安裝 tmux。但因為突然想分開用東西,很習慣的打算使用 tmux,才發現自己沒裝,覺得有點好笑。
在 macOS 透過 Homebrew 安裝 tmux
brew install tmux
安裝後輸入 tmux 就可以直接開始使用,在過去沒有出現這樣的提示。本來不想理會,因為不喜歡有太多瑣碎的偏好設定,對於未來重建環境習慣問題之類的。後來發現每使用一次就出現一次有點惱人,只好找一下解決方式,所以做個紀錄。
WARNING! Your terminal appears to support fewer than 256 colors!
If your terminal supports 256 colors, please export the appropriate environment variable
_before_ loading this theme in your ~/.zshrc. In most terminal emulators, putting
export TERM="xterm-256color" at the top of your ~/.zshrc is sufficient.
因為 ssh 預設是使用 8 色,而所使用的 iTerm2 支援 256 色,但是 tmux 預設吃了 8 色,所以要 tmux 全拿,加入下面設定。
~/.zshrc
[[ $TMUX = "" ]] && export TERM="xterm-256color"
如果 .tmux.conf 不存在,就自己建立檔案
~/.tmux.conf
set -g default-terminal "screen-256color"
指令tput colors
可以查詢當前的顏色
搶先發佈留言