UPDATE 2017

Fuck with this …

lets use iTermocil

Found this tool. It is really cool! Purely in iTerm and with yaml’s as a config: https://github.com/TomAnthony/itermocil

Motivation:

In previous post I mentioned how to configure iTerm using profiles, to open right apps, activate virtualenv, run development server to save some time.

Cool but not perfect. It was not utilizing any terminal multiplexer like screen, tmux, or byobu.. It was sufficient for small projects like jekyll blog, but not for some serious development, where you need to run and monitor multiple things, e.g:

  • GIT status
  • Project directory tree
  • application server (django)
  • interactive shell (ipdb, shell_plus)
  • coffee compiler
  • sass compiler
  • postgres shell
  • mongo shell

Pretty much huh? It will be cool to have in seperate panes opened few things, and maybe splited among few windows. Doing it manually everyday is pretty tedious. Sometimes multiplexers remember their state, but not always and then you have to do it once more manually…

It will be cool to have some file with sppecified what we neeed. Thats allows us TEAMOCIL

Install

gem install teamocil
mkdir ~/.teamocil
nano my_project.yml

Configuration file

windows:
  - name: sample-three-panes
    root: ~/mbf
    layout: main-vertical
    panes:
      - commands:
        - source ~/.virtualenvs/spots/bin/activate
        - python manage.py shell_plus --settings=mbf.settings.andi
        focus: true
      - commands:
        - git fetch
        - git status
      - commands:
        - source ~/.virtualenvs/spots/bin/activate
        - python manage.py runserver --settings=mbf.settings.andi
    focus: true

  - name: frontend
    root: ~/mbf/www/static
    layout: main-vertical
    panes:
      - commands:
        - cd js
        - tree
        focus: true
      - commands:
        - coffee -o js/ -cw coffee/
      - commands:
        - sass --watch styles:css

  - name: databases
    root: ~/mbf
    layout: main-vertical
    panes:
      - commands:
        - psql
      - commands:
        - mongod
      - commands:
        - mongo
        focus: true

I hope the above things are obvious: we define windows inside each we define panes, and apply layout, and set focuse for pane and window. The window with focus will be selected, and inside each window the pane with focus will be selected.

Starting

tmux
teamocil my_project

Result

Results in following windows: django

databases

frontend

Basic navigation:

Switch between Panes:

Ctrl-b o

Switch between Windows:

Ctrl-b n  # next
Ctrl-b p  # previous

More commands can be found here: http://fideloper.com/mac-vim-tmux