You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Go to file
Ivan Klymenchenko 3a7c152591 Update .gitignore 3 years ago
.github/workflows Create go.yml 3 years ago
.gitignore Update .gitignore 3 years ago
.goreleaser.yml Add goreleaser 3 years ago
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 3 years ago
LICENSE Create LICENSE 3 years ago
Makefile Init 3 years ago
README.md Add support for `layout` in windows (#7) 3 years ago
commander.go Init 3 years ago
config.go Add support for `layout` in windows (#7) 3 years ago
errors.go Init 3 years ago
go.mod Init 3 years ago
go.sum Init 3 years ago
main.go Support passing windows to the stop command 3 years ago
options.go Init 3 years ago
options_test.go Init 3 years ago
smug.go #8 Always kill first window from list-windows command (#9) 3 years ago
smug_test.go #8 Always kill first window from list-windows command (#9) 3 years ago
tmux.go #8 Always kill first window from list-windows command (#9) 3 years ago

README.md

Smug - tmux session manager

Inspired by tmuxinator and tmuxp.

Smug automates your tmux workflow. You can create a single configuration file, and smug will create all required windows and panes from it.

gif

Configuration used in this GIF can be found here.

Usage

smug <command> <project>[:window name] [-w window name].

Examples

To start/stop a project and all windows, run:

xyz@localhost:~$ smug start project

xyz@localhost:~$ smug stop project

When you already have a running session, and you want to create only some windows from the configuration file, you can do something like this:

xyz@localhost:~$ smug start project:window1

xyz@localhost:~$ smug start project:window1,window2

xyz@localhost:~$ smug start project -w window1

xyz@localhost:~$ smug start project -w window1 -w window2

xyz@localhost:~$ smug stop project:window1

xyz@localhost:~$ smug stop project -w window1 -w window2

Installation

Prerequisite Tools

Fetch from GitHub

The easiest is to clone Smug from GitHub and install it using go-cli:

cd /tmp
git clone https://github.com/ivaaaan/smug.git
cd smug
go install

Configuration

Configuration files stored in the ~/.config/smug directory in the YAML format, e.g ~/.config/smug/your_project.yml.

Examples

Example 1

session: blog

root: ~/Developer/blog

before_start:
  - docker-compose -f my-microservices/docker-compose.yml up -d # my-microservices/docker-compose.yml is a relative to `root`

stop:
  - docker stop $(docker ps -q)

windows:
  - name: code
    root: blog # a relative path to root
    manual: true # you can start this window only manually, using the -w arg
    layout: main-vertical
    commands:
      - docker-compose start
    panes:
      - type: horizontal
        root: .
        commands:
          - docker-compose exec php /bin/sh
          - clear

  - name: infrastructure
    root: ~/Developer/blog/my-microservices
    layout: tiled
    panes:
      - type: horizontal
        root: .
        commands:
          - docker-compose up -d
          - docker-compose exec php /bin/sh
          - clear

Example 2

session: blog

root: ~/Code/blog

before_start:
  - docker-compose up -d

stop:
  - docker-compose stop

windows:
  - name: code
    layout: main-horizontal
    commands:
      - vim app/dependencies.php
    panes:
      - type: horizontal
        commands:
          - make run-tests
  - name: ssh
    commands:
      - ssh -i ~/keys/blog.pem ubuntu@127.0.0.1