0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

psmuxでWindows 11+PowerShellでtmux

0
Posted at

What's?

ふだんLinux上ではtmuxを使っているのですが、Windowsではどうしようかと探してみたところ、Windowsでも動きそうなtmux代替を2つ見つけました。

psmuxとRMUXです。

最初はRMUXを試してみたのですが、Windowsだとデフォルトシェルがコマンドプロンプトになっていたり、挙動が安定しなかったのでpsmuxを使うことにしました。

psmux

psmuxは、Windowsで動作するtmux互換のソフトウェアです。

動作要件としては以下になります。

  • Windows 10、11
  • PowerrShell 7以降を推奨
    • cmd.exeでも可

できればPowerShell 5.1でも動作しないかな?と試したところ、自分の場合はそこまで問題にならなかったのでそのまま導入です。

環境

今回の環境はこちらです。

PS > [System.Environment]::OSVersion

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.26200.0 Microsoft Windows NT 10.0.26200.0


PS > $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      26100  8655


psmuxをインストールする

psmuxはwingetでインストールできます。

PS > winget search psmux
名前        ID                バージョン ソース
------------------------------------------------
psmux       marlocarlo.psmux  3.3.6      winget
TerminalMap psmux.TerminalMap 0.1.0      winget

インストールします。

PS > winget install psmux

バージョン。

PS > psmux --version
tmux 3.3.6

コマンドはpsmuxなのですが、他にもpmuxtmuxとしてもエイリアス登録されます。

PS > pmux --version
tmux 3.3.6


PS > tmux --version
tmux 3.3.6

ドキュメントはこちら。

設定ファイルは、以下のパスから読み取ります。上の方が優先順位が高いです。

  • ~/.psmux.conf
  • ~/.psmuxrc
  • ~/.tmux.conf
  • ~/.config/psmux/psmux.conf

~%USERPROFILE%ですね。

設定ファイルはこんな感じで用意しました。

.psmux.conf
# デフォルトのprefix Ctrl-bはbash操作と衝突するので、prefixを変更する
set-option -g prefix C-x

# カラーを有効に設定(256色)
set -g default-terminal "tmux-256color"

# ウィンドウを閉じた際に、番号を再ナンバリングする
set-option -g renumber-windows on

# 履歴
set -g history-limit 20000

# マウスホイールを有効に
set -g mouse on
# マウスホイールアップでコピーモードに
bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
# マウスホイールで最後に達するとコピーモード解除
bind-key -n WheelDownPane select-pane -t= \; send-keys -M

あとはtmuxと同じように使ってみましょう。

PS > psmux
PS > psmux new -s work
PS > psmux kill-server
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?