LoginSignup
5
3

More than 5 years have passed since last update.

概要

tmuxでのsession-managerを探していたらtmuxinatorとtmuxpを見つけたものの, tmuxinatorはruby導入してgemから, tmuxpはpython導入してからpipからと, どちらも言語依存. ただでさえ管理が面倒な言語パッケージ(早く全言語統合パッケージを作ってくれ)だが, pythonはよくお世話になってる言語なので, tmuxpを自分の環境に導入した. qiitaというか日本語記事が一切合切tmuxpには存在してなかったのでちょうどいい機会なので記事を書くことにする.


補足情報

repository

環境

  • tmux -V - tmux 2.6
  • pyenv version - anaconda3-5.0.1
  • pip -V - pip 9.0.1

導入方法

基本的に例によってtmuxpのリポジトリにそって導入

1. Installation

❯ pip install --user tmuxp
❯ tmuxp
Usage: tmuxp [OPTIONS] COMMAND [ARGS]...

  Manage tmux sessions.

  Pass the "--help" argument to any command to see detailed help. See
  detailed documentation and examples at:
  http://tmuxp.readthedocs.io/en/latest/

Options:
  -V, --version     Show the version and exit.
  --log_level TEXT  Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --help            Show this message and exit.

Commands:
  convert  Convert a tmuxp config between JSON and YAML.
  freeze   Snapshot a session into a config.
  import   Import a teamocil/tmuxinator config.
  load     Load tmuxp workspaces.

--userオプションはuser環境だけにインストールできるやつ.
インストール後ちゃんとコマンド動いてることを確認.
command not foundの場合は, --userオプションのPATH関係通ってるか確認をば.

2. TMUX sessionのロード.

ここのスタイルはtmuxinatorと同じYAMLを使う様子.
teamocli使えば自動でYAML履いてくれるらしいがやはりgem依存.
rubyのgemはrailsによるトラウマでdocker以外でいじりたくないから仕方なく手作業.

内容はtmuxpリポジトリ除いてもtmuxinatorと同じって書いてあるだけなので, tmuxinatorのREADMEを見ながら書こう.
自分はtmuxinatorにあるsample.yamlをいじって書いた. 作ったものをgistに一応あげとく
https://gist.github.com/take-sei/d051fe227cbb98dc83b19e94e35a5f37

こいつを~/.tmuxp/の中においてあげて, 以下のコマンドを実行. (filenameは.yamlつけずにいける.)

❯ tmuxp load filename

とすると立ち上がるのを確認できる.

詰まりかけた点

1. layoutってなんや

色々デフォルトでセットされているようですが, 一番気に入ったlayoutを対応させるには,

❯ tmux list-windows
1: dev_window* (4 panes) [318x61] [layout a3bc,318x61,0,0{135x61,0,0,1,135x61,136,0[135x45,136,0,2,135x15,136,46,3],46x61,272,0,4}] @1 (active)

とでてきたやつの, layout ~ ]@1までの間の数字を入れる様子. kwskはここに.

2. panesでerrorをはく

どうやら, 何かしらのコマンドを各paneで実行させないとエラーがおきる模様. 仕方がないのでclearを実行させた.

5
3
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
5
3