How to start tmux with several windows in different directories?

后端 未结 5 1230
一个人的身影
一个人的身影 2021-01-30 03:42

I want to use a script to open a tmux session with 6 windows, each in a different directory. I started with a script I found and tried this first:

tmux new-sessi         


        
5条回答
  •  死守一世寂寞
    2021-01-30 04:06

    Tmuxinator is also really good for this. Basically you create setup files like so:

    # ~/.tmuxinator/project_name.yml
    # you can make as many tabs as you wish...
    
    project_name: Tmuxinator
    project_root: ~/code/rails_project
    socket_name: foo # Not needed. Remove to use default socket
    rvm: 1.9.2@rails_project
    pre: sudo /etc/rc.d/mysqld start
    tabs:
      - editor:
          layout: main-vertical
          panes:
            - vim
            - #empty, will just run plain bash
            - top
      - shell: git pull
      - database: rails db
      - server: rails s
      - logs: tail -f logs/development.log
      - console: rails c
      - capistrano:
      - server: ssh me@myhost
    

    Then you can start a new session with:

    mux project_name
    

    I've been using it for a while and have had a good experience for the most part.

提交回复
热议问题