tmux関連
Posted: | Categories: tmux | Tags: console, tmux
mac にソースコードからインストール
2024/01時点のbrewのパッケージがsixel未対応だったのでソースからインストール
brew install autoconf automake pkg-config utf8proc
git clone https://github.com/tmux/tmux.git
cd tmux
sh autogen.sh
./configure --enable-sixel --enable-utf8proc
make
sudo make install
/usr/local/bin 配下にインストールされる。
コンテナ環境内のtmuxを使おうとするとターミナルのリサイズを検知しない
2024/02頃、Rancher Desktopで起きたのだが、ターミナル内でコンテナを起動し、コンテナ内のtmuxを起動して使ったところ、tmuxがターミナルのサイズ(COLS, LOWとか)に合わせてリサイズしなかった。
ターミナルはウィンドウのリサイズ時、中のプログラムにSIGWINCH( ウィンドウサイズ変更 )シグナルを送る。 コンテナはうまくこれを拾えていない可能性がある。
mac側のtmuxを利用する分にはうまくいく。
プラグインマネージャ、tpmのインストール
ghq get https://github.com/tmux-plugins/tpm
mkdir -p ~/.config/tmux/plugins
cd ~/.config/tmux/plugins
ln -s ~/workspace/git/github.com/tmux-plugins/tpm ./tpm
tmux.confの最後に下記を追記
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
上記の前に追加したいプラグインを列挙。tmuxの設定を再読込して、prefix + I でインストール。
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-copycat'
追加したプラグイン
- tmux-copycat
- URLをハイライトさせる
- prefix + ctrl-u
- tmux-open
- ハイライトしたURLを開く
- macはopen
- linuxはxdg-opnen
- oキーの振る舞いを変える場合
- set -g @open ‘w3m’
- エディタを変更する場合
- set -g @open-editor ‘C-x’
- ハイライトしたURLを開く
URLを w3m で開きたい
tmux-openはlinuxではxdg-openを用いてURLを開く。 xdg-open( xdg-utils - ArchWiki )はxdg-mime( xdg-utils - ArchWiki )に問い合わせを行い対象を開く。 xdg-mimeの設定はxdg-settingsを用いて行う。
Read more...