GithubHelp home page GithubHelp logo

remi / teamocil Goto Github PK

View Code? Open in Web Editor NEW
2.3K 43.0 101.0 208 KB

There's no I in Teamocil. At least not where you think. Teamocil is a simple tool used to automatically create windows and panes in tmux with YAML files.

License: MIT License

Ruby 100.00%
tmux

teamocil's Introduction

Teamocil
Teamocil is a simple tool used to automatically create
windows and panes in tmux with YAML files.


Installation

# Install the `teamocil` Ruby gem
$ gem install teamocil

# Create your layout directory
$ mkdir ~/.teamocil

# Edit ~/.teamocil/sample.yml (look for sample layouts in this very `README.md`)
$ teamocil --edit sample

# Launch tmux
$ tmux

# Run your newly-created sample layout
$ teamocil sample

Usage

$ teamocil [options] [layout-name]

Global options

Option Description
--list Lists all available layouts in ~/.teamocil

Layout options

Option Description
--layout Takes a custom file path to a YAML layout file instead of [layout-name]
--here Uses the current window as the layout’s first window
--edit Opens the layout file with $EDITOR instead of executing it
--show Shows the layout content instead of executing it

Upgrading

Teamocil 1.0 is a complete rewrite (from scratch!) of Teamocil. The code is now very much simpler, cleaner and easier to maintain.

The downside of that is that several features were dropped during the rewrite process, mostly because I didn’t actually use/need them and I got tired of maintaining features I don’t think are useful.

You might have to clean up your layout files after upgrading to 1.0. I’m sorry about that. The documentation in README.md should help you find which keys are now supported.

The 0.4-stable branch is still available with the old code. Feel free to fork the repository and add back as many features as you want :)

Configuration

Session

Key Description
name The tmux session name
windows An Array of windows

Windows

Key Description
name The tmux window name (required)
root The path where all panes in the window will be started
layout The layout that will be set after all panes are created by Teamocil
panes An Array of panes
focus If set to true, the window will be selected after the layout has been executed
options A Hash of options that will be set with the set-window-option command

Panes

A pane can either be a String or a Hash. If it’s a String, Teamocil will treat it as a single-command pane.

Key Description
commands An Array of commands that will be ran when the pane is created
focus If set to true, the pane will be selected after the layout has been executed

Examples

Simple two pane window

windows:
  - name: sample-two-panes
    root: ~/Code/sample/www
    layout: even-horizontal
    panes:
      - git status
      - rails server
.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Simple three pane window

windows:
  - name: sample-three-panes
    root: ~/Code/sample/www
    layout: main-vertical
    panes:
      - vim
      - commands:
        - git pull
        - git status
      - rails server
.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |------------------|
|                  | (2)              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Simple four pane window

windows:
  - name: sample-four-panes
    root: ~/Code/sample/www
    layout: tiled
    panes:
      - vim
      - foreman start web
      - git status
      - foreman start worker
.------------------.------------------.
| (0)              | (1)              |
|                  |                  |
|                  |                  |
|                  |                  |
|------------------|------------------|
| (2)              | (3)              |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Two pane window with focus in second pane

windows:
  - name: sample-two-panes
    root: ~/Code/sample/www
    layout: even-horizontal
    panes:
      - rails server
      - commands:
          - rails console
        focus: true
.------------------.------------------.
| (0)              | (1) <focus here> |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
|                  |                  |
'------------------'------------------'

Extras

Zsh autocompletion

To get autocompletion when typing teamocil <Tab> in a zsh session, add this line to your ~/.zshrc file:

compctl -g '~/.teamocil/*(:t:r)' teamocil

zsh-completions also provides additional completion definitions for Teamocil.

Bash autocompletion

To get autocompletion when typing teamocil <Tab> in a bash session, add this line to your ~/.bashrc file:

complete -W "$(teamocil --list)" teamocil

Fish autocompletion

To get autocompletion when typing teamocil <Tab> in a fish session, add the following file ~/.config/fish/completions/teamocil.fish with the following content:

complete -x -c teamocil -a '(teamocil --list)'

Custom window layout

Teamocil supports all the window layout names supported by tmux.

  • even-horizontal
  • even-vertical
  • main-horizontal
  • main-vertical
  • tiled

However, it also supports the custom format understood by tmux. This is especially useful if you want to manually resize your panes and keep using that layout in the future.

You can grab the layout for the current window by running this command:

tmux list-windows -F "#{window_active} #{window_layout}" | grep "^1" | cut -d " " -f 2

You can then use the result as the layout key for any Teamocil window object.

windows:
  - name: sample-two-uneven-panes
    layout: 00c7,158x38,0,0[158x9,0,0,37,158x28,0,10,39]
    panes:
      - echo foo
      - echo bar

Contributors

Feel free to contribute and submit issues/pull requests on GitHub, just like these fine folks did:

License

Teamocil is © 2011-2016 Rémi Prévost and may be freely distributed under the MIT license. See the LICENSE.md file for more information.

teamocil's People

Contributors

electrocucaracha avatar jli1972 avatar remi avatar richardkmichael avatar taher-ghaleb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teamocil's Issues

Ignore adding executed commands to history

Hi,

I find teamocil now and I tried it. Teamocil is good and I love it but when I run teamocil myproject teamocil execute commands in newly created panes and these commands saving to history. I don't want to see these commands in history. How can I ignore save executed commands to history. Maybe If you add a space before command and If histignorespace is on in zsh, commands not save to the history.

Maybe this feature already exist but I could not find.

Running a layout that doesn't specify a root option results in an exception

I'm not sure if the root option is required, but if it isn't specified teamocil produces an exception. This is occurs in 1.0.3.

windows:
  - name: window-1
    panes:
      - ls
Deep-Thought:~ $ teamocil test
/Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/window.rb:8:in `expand_path': no implicit conversion of nil into String (TypeError)
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/window.rb:8:in `initialize'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:15:in `new'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:15:in `block in initialize'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:10:in `each'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:10:in `each_with_index'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:10:in `each'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:10:in `map'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/tmux/session.rb:10:in `initialize'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/layout.rb:49:in `new'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/layout.rb:49:in `parsed_layout'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/layout.rb:37:in `shell_commands'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/layout.rb:7:in `execute!'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/lib/teamocil/cli.rb:21:in `run!'
        from /Users/john/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/teamocil-1.0.3/bin/teamocil:7:in `<top (required)>'
        from /Users/john/.rbenv/versions/2.0.0-p451/bin/teamocil:23:in `load'
        from /Users/john/.rbenv/versions/2.0.0-p451/bin/teamocil:23:in `<main>'
        from /Users/john/.rbenv/versions/2.0.0-p451/bin/ruby_executable_hooks:15:in `eval'

teamocil --here does not create multiple windows

Teamocil fails for me when invoking it with the --here flag. I end up with one window whose shell has tried to execute every command in my yaml file; the end result is a mess. It works fine without the --here flag.

teamocil version 0.2.1

Tha yaml file in question looks like this; perhaps something is wrong with it.

session:
  name: pim
  root: ~/
  windows:
    - name: mail
      root: ~/
      splits:
        - cmd: "sup-mail"
    - name: news
      root: ~/
      splits:
        - cmd: "newsbeuter"
    - name: chat
      root: ~/
      splits:
        - cmd: "irssi"
    - name: cal
      root: ~/
      splits:
        - cmd: "when"
    - name: todo
      root: ~/
      splits:
        - cmd: "task next"

Pane height not respected

Thanks for the effort you have put into writing teamocil. It certainly makes my life a little easier! ;)

I have a couple of issues, although I am not certain whether they are actual bugs, or errors in my config. Apologies if it's the latter.

My requirement is:

  • Open 3 windows
  • win1 - leave as it is
  • win2, with name "user" - split into 3 panes. The first pane should be positioned at the top, span the full-width of the window and consume 70% of its height. The other two should be below the first, with a height of 30% and be sharing the width 50/50
  • win3, with name "root" - same layout as win2. Sync panesm and run "sudo -i"in all panes, ready to accept the password

I am aiming for a layout with a vertical 70/30 split, like the following:

|----------------------|
|                      |
|                      |
|                      |
|                      |
|                      |
|-----------|----------|
|           |          |
|-----------|----------|

However, teamocil produces a 50/50 split

Please see my config below.

Furthermore, after running teamocil, win1 always contains the following text:

~$ teamocil 
usage: show-window-options [-g] [-t target-window]
usage: show-window-options [-g] [-t target-window]
usage: show-window-options [-g] [-t target-window]
usage: show-window-options [-g] [-t target-window]

My config:

session:
  windows:
    - name: "user"
      clear: true
      root: "/home/mydir/"
      splits: 
        - height: 70
          target: top
        - width: 50
          height: 30
          target: bottom-left
        - width: 50
          height: 30
          target: bottom-right
    - name: "root"
      clear: true
      focus: true
      options:
        synchronize-panes: true
      root: "/home/mydir/"
      splits:
        - height: 70
          cmd: "sudo -i"
          target: top
        - width: 50
          height: 30
          cmd: "sudo -i"
          target: bottom-left
        - width: 50
          height: 30
          cmd: "sudo -i"
          target: bottom-right

If there is any info I've omitted, please let me know as I'm happy to provide it.

Btw, the examples directory is a bit sparse. It would be nice to have different types of examples, than all that are pretty much using the same options.

Furthermore, note that the docs state to use the "panes" directive. I think this has changed to "splits", as "panes" doesn't seem to work.

Cheers

Passing teamocil as a command to tmux

HI,

Any idea on how launching teamocil from a tmux window created programmatically from the command line ? Something like this :
tmux -c "teamocil --here --layout=layout.yml"

It would be great !

Bash output

Bash is echoing all commands to my terminal as I start up new splits. Is there a way to suppress this? In my git status window, for example, I get output like the following:

export TEAMOCIL=1
git status
~/Projects ∴ export TEAMOCIL=1
git status
~/Projects ∴ git status
# On branch develop
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)

I'm running teamocil inside tmux from Terminal.app, OS 10.7.3.

create pane failed: pane too small

trying to create 6 panes, I get this error. tmuxinator had this issue too, and had to fix it by setting the layout after each pane was created.

focus: true not switching to correct window // pane?

Here is my current template,

running as: teamocil rails --here

session:
  name: "rails"
  windows:
    - name: "CODE"
      layout: 8590,178x45,0,0{114x45,0,0,3,63x45,115,0,4}
      panes:
        - cmd: "vim"
          focus: true
        - cmd: "guard"
    - name: "SERVER"
      layout: even-horizontal
      panes:
        - cmd: rails s -p 3000
        - cmd: ""

It won't switch to the "vim" pane inside of "CODE", instead it stays in the "SERVER" window.

Am I doing something wrong?

Layout file not found when TEAMOCIL_PATH set (and poss teamocil arguments used)

With the following in my /etc/bash.bashrc, teamocil does not automatically find the default layout file at /etc/tmux/teamocil/default.yml

export TEAMOCIL_PATH="/etc/tmux/teamocil"

Running teamocil as follows:

teamocil

Possibly also:

teamocil default

Produces this result:

[teamocil] There is no file "/etc/tmux/teamocil/.yml"

I think using teamocil arguments like here and show causes a similar problem.

teamocil --show default

These problems can be worked around by passing the full file path.

teamocil --show /etc/tmux/teamocil/default.yml

Ruby interpolations not parsed?

In 0.4.2 you could also use erb in the yaml file:

  root: <%= ENV['PROJECT_NAME_ROOT'] %>

this allowed us as a team to share the config along with our git repo, and allow everyone to use another path on disk. It seems like this is no longer supported?
static paths do work though

Doesn't work with homesick

I use homesick to symlink my dotfiles. The .teamocil folder is thus a symlink to the real folder. In that environment, teamocil can't find my default.yaml file that I created in the teamocil folder.

bash autocompletion

this is more like a request then an issue but is it possible to port zsh autocompletion to bash as well? it looks trivial but I don't have much knowledge about autocompletion in bash.

as I understand there are two kinds of autocompletion in bash. first one is command line options autocompletion (i.e. teamocil --he<tab> => teamocil --here) and the other one is the file name completion from ~/.teamocil which is the one in README for zsh I guess (haven't tested myself). I would love to see them both if possible.

Command in split not executed

I try a simple layout

windows:
  - name: "window1"
    splits:
      - cmd: "pwd"

and got window like this:

export TEAMOCIL=1 && cd . && pwd
user@host:~$ export TEAMOCIL=1 && cd . && pwd
pwd   pwdx  
user@host:~$ export TEAMOCIL=1 && cd . && pwdx 

I need to hit ENTER to execute the command . Is that normal?

And I use Ubuntu 12.10, tmux 1.6, teamocil 0.4.

BTW: I notice there are some message in the window which I run teamocil sample. Here is:

user@host:~$ teamocil sample                                                  
usage: show-window-options [-g] [-t target-window]
usage: show-window-options [-g] [-t target-window]

Extraneous select-layout command is issued when no layout option is provided

If no layout option is provided for a window, an "can't set layout:" error is given.

Deep-Thought:~ $ teamocil test
can't set layout:
Deep-Thought:~ $ teamocil --show test
windows:
  - name: window-1
    root: "~"
    panes:
      - ls
Deep-Thought:~ $ teamocil --debug test
tmux rename-session 'teamocil-session-280683'
tmux new-window -n 'window-1' -c '/Users/john'
tmux send-keys -t 0 'ls'
tmux send-keys -t 0 'Enter'
tmux select-layout ''
tmux select-pane -t 0

Project name too awesome

I'm afraid that the project name is just too awesome.... I'm personally to intimidated to even checkout the code. On the other hand, some of the side effects might be useful to the kind of people that do enough console work to need yaml to manage tmux layouts.

window (pane) names are not displayed

Hi,

cool stuff this, thanks.

However, in my test scenario, the window names are not displayed:

% teamocil --show sample
session:
name: mail
windows:
- name: mymail
splits:
- cmd: "mutt"
- name: sysmon
splits:
- cmd: "mutt -F ~/.muttrc.sysmon"
- name: oi
splits:
- cmd: "nice -n 19 offlineimap"

But after "teamocil --here sample", the display line shows the session name (mail) correctly, but the hostname for all the other windows.

Any idea?

teamocil (0.3.7)
tmux 1.6
ruby 1.8.7
xubuntu 12.04

Thanks,
Sven

Make teamocil work with fish shell

Hey,

fish-shell is a non-bash-compatible shell which is under very active development.
I'd love to see teamocil work with fish too.

The problem is that fish uses ls -la; and ls instead of ls -la && ls and that setting environment variables is handled with set instead of export.

I added the proper commands in the code below as comments. I'll put this into a pull request after feedback.

layout/split.rb:51

# Set the TEAMOCIL environment variable
@cmd.unshift "export TEAMOCIL=1"
           # "set -gx TEAMOCIL 1"

# Execute each split command
commands << "tmux send-keys -t #{@index} \"#{@cmd.flatten.compact.join(" && ")}\""
                                                                    # "; and "
commands << "tmux send-keys -t #{@index} Enter"

Have teamocil set an environment variable?

I'd like to have teamocil set an environment variable, like say, $TEAMOCIL so I can watch for it in some of my zsh scripts. Mainly I'd like to control zsh window renaming based on whether it's a teamocil-spawned window or not.

Teamocil seems to be creating an additional window

I've set up a yml file which launches configures my TMUX session nicely, though an additional window is already created, regardless of yml file. I've tried the most basic configuration, which ought to only create 3 windows, but it creates 4.

windows:
  - name: "a-window"
    panes:
      - cmd:
  - name: "another-window"
    layout: tiled
    panes:
      - cmd:
      - cmd:
  - name: "another-another-window"
    layout: main-vertical
    panes:
      - cmd:
      - cmd:
      - cmd:

Command for first split not running

If I take the example from the documentation and generalize it a bit like this:

windows:
  - name: "my-first-window"
    root: "~/Desktop"
    filters:
      before: "echo rvm use 1.9.2"
      after: "echo 'I am done initializing this split.'"
    splits:
      - cmd: "echo first"
      - cmd: "echo second"
        width: 50
      - cmd:
          - "echo third command1"
          - "echo third command2"
        height: 50

I see the following happen:

$ <teamocil command>                 |   $ <teamocil command>
rvm use 1.9.2                        |   rvm use 1.9.2
second                               |   third command1
I am done initializing this split.   |   third command2
                                     |   I am done initializing this split.
                                     |
                                     |--------------------------------------
                                     |
                                     |  ## Nothing in this split
                                     |  $
                                     |

The first split that is defined never runs the teamocil command.

Check for .teamocil in current directory

First off, this project looks great!

Suggestion: I'd like to track teamocil layouts in my git repos. Forcing the layouts to be in ~/.teamocil results in me putting multiple project layouts in one place, rather than separate and closer to the context where they are used (e.g. the project's directory).

Further, overriding the env variable doesn't help as it's restrictive and breaks when switching projects.

How about you make the gem check ./.teamocil file before ~/.teamocil. That wouldn't break things for existing users and also supports the case where users want portable + version tracked layouts. Thoughts?

Error on running code

When I try to run teamocil, it dies a firey death. All other commands (list, edit) seem to work.

Here is what I see:

->  ~  teamocil mainapp
/home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/../lib/teamocil/layout/session.rb:14:in `each_with_index': no block given (LocalJumpError)
        from /home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/../lib/teamocil/layout/session.rb:14:in `initialize'
        from /home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/../lib/teamocil/layout.rb:34:in `new'
        from /home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/../lib/teamocil/layout.rb:34:in `compile!'
        from /home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/../lib/teamocil/cli.rb:38:in `initialize'
        from /home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/teamocil:8:in `new'
        from /home/mhislop/.gem/ruby/1.8/gems/teamocil-0.3.2/bin/teamocil:8
        from /home/mhislop/.gem/ruby/1.8/bin/teamocil:19:in `load'
        from /home/mhislop/.gem/ruby/1.8/bin/teamocil:19

Allow layout selection from specified file

It would be cool if teamocil could select the layout file from specified file

teamocil --layout ./mylayout.yml

This way the file could live in a project's git repository.

It would be really nice with CoffeeScript and Sass since with those you always need to start the watcher processes which compiles files of you project.

teamocil could really help automating this as it already does, but I would like to share those layouts within my project files.

Why the working directory is not set correctly?

After using teamocil tc, the working directory changed to /home/kamel/.oh-my-zsh/plugin/tmux,
not the intended /home/kamel/Code/study

.tmux.config file

set -g default-terminal "screen-256color"
# zsh is kinda tight
set-option -g default-shell $SHELL

# look good
#set -g default-terminal "screen-256color"

# act like GNU screen
unbind C-b
set -g prefix C-a

# Make shift+arrows, ctrl+arrows etc work in Vim.
set -g xterm-keys on
# See if this fixes slow ESC issues.
# http://unix.stackexchange.com/questions/23138/esc-key-causes-a-small-delay-in-terminal-due-to-its-alt-behavior
set -s escape-time 0

# a mouse
set -g mode-mouse on
setw -g mouse-select-window on
setw -g mouse-select-pane on

# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"

# Maximize pane, e.g. for copying.
bind-key z resize-pane -Z

# Reload tmux conf.
unbind r
bind r source-file ~/.tmux.conf\; display "Reloaded conf."

# move x clipboard into tmux paste buffer
bind C-p run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind C-y run "tmux save-buffer - | xclip -i"
# after copying to a tmux buffer, hit y again to copy to clipboard
#### COLOUR (Solarized 256)

# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default

# default window title colors
set-window-option -g window-status-fg colour244 #base0
set-window-option -g window-status-bg default
#set-window-option -g window-status-attr dim

# active window title colors
set-window-option -g window-status-current-fg colour166 #orange
set-window-option -g window-status-current-bg default
#set-window-option -g window-status-current-attr bright

# pane border
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01

# message text
set-option -g message-bg colour235 #base02
set-option -g message-fg colour166 #orange

# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange

# clock
set-window-option -g clock-mode-colour colour64 #green

tmux --debug tc:

tmux rename-session 'teamocil-session-126108'
tmux new-window -n 'TC' -c '/home/kamel/Code/study'
tmux send-keys -t 1 'vim'
tmux send-keys -t 1 'Enter'
tmux split-window -c '/home/kamel/Code/study'
tmux send-keys -t 2 'whoami'
tmux send-keys -t 2 'Enter'
tmux split-window -c '/home/kamel/Code/study'
tmux send-keys -t 3 'ls'
tmux send-keys -t 3 'Enter'
tmux select-layout 'ba8a,211x49,0,0{165x49,0,0,19,45x49,166,0[45x14,166,0,21,45x34,166,15,22]}'
tmux select-pane -t 1

teamocil1

specify which split should be focused

Totally new to teamocil... would love to specify which split should be focused after they all loaded. Is this already possible? Asking too much? If this is desired by others I'd be happy to do the work, lemme know (;

Send commands separately

For example, I'd like to create a root shell using sudo su - and then execute a command inside that shell. Right now this doesn't seem to be possible.

Implicit-session configs break tmux session name

Scenario:

  • Using tmux solely to create new windows-with-splits; no configs have explicit session settings in them.
    • I manually manage my sessions (e.g. one for work, one for personal/OSS, etc).
  • Executing tmux pollutes my existing session name, calling it e.g. teamocil- (I think tmux is truncating the name, possible)
  • This is because teamocil is auto-generating a unique session name when sessions aren't given (in lib/teamocil/layout/session.rb::Session#initialize).
  • There's no way to disable this behavior.

This seems to regress whatever was done to fix #5.

I regret I have no time to submit a PR for this, partly as I'm not sure what the preferred fix would be.

Suspect best is for implicitly created sessions to skip the automatic name generation - folks using the session are by definition not creating new sessions and do not need the collision-avoidance random name.

Usage error in documentation

Tried the usage instructions:

$ gem install teamocil
$ mkdir ~/.teamocil
$ teamocil --edit sample

running teamocil gets a

command not found

error

Error when starting teamocil

I installed it as described (here)[https://github.com/remiprev/teamocil]

teamocil                                                                                                                                                                                                          :(
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': /var/lib/gems/1.9.1/gems/teamocil-1.0.1/lib/teamocil.rb:50: syntax error, unexpected tLABEL, expecting ')' (SyntaxError)
  def self.parse_options!(arguments: nil)
                                    ^
/var/lib/gems/1.9.1/gems/teamocil-1.0.1/lib/teamocil.rb:54: syntax error, unexpected keyword_end, expecting $end
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /var/lib/gems/1.9.1/gems/teamocil-1.0.1/bin/teamocil:4:in `<top (required)>'
        from /usr/local/bin/teamocil:23:in `load'
        from /usr/local/bin/teamocil:23:in `<main>'

Every time I try to run it I get the error above. What am I doing wrong ? Anny suggestions ?
uname -a
Linux mybox 3.13.0-30-generic #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Mybox is running Kubuntu
EDITOR=emacs

Prefix shell commands with a space

In some bash configs (HISTCONTROL=ignorespace) prefixing a command with a single space prevents it from being saved in the bash history.

I'm sure I'm not the only one who doesn't like export TEAMOCIL=1; cd .; sudo su -; clear; tmux a || tmux etc. to clutter his bash history.

Add an option to starten layout in new session

When a name is given it would be helpful if after a check whether the session already exists with this name, that session will be used instead of the current session.

Or is there another means to start a teamocil-layout in a new session?

"sh: Syntax error: ";" unexpected"

I'm getting this error when spawning any layout, no matter how simple or complex. I realize this is not much information for diagnosis, is there a verbose or debug mode for teamocil?

Cosmetic error when not specifying a session name

If I'm already happy with my session's name, and just want to add windows from a teamocil configuration to it, it's useful to leave out the session name, but it runs rename-session even if the name isn't specified, resulting in a rename-session usage message being displayed.

Add focus key to windows

There's a focus key for panes to select which pane to focus on intially. I'd like to have this key for windows as well since I always start working in my first window instead of the last.

Show help if no layout specified

teamocil shows error trying to find layout file even if its not set:

$ teamocil
[teamocil] There is no file "/Users/vital/.teamocil/.yml"

I suppose the better is to show usage help (as teamocil --help does) if no arguments passed to program:

$ teamocil
Usage: teamocil [options] <layout>
...

Add "clear" after split configuration

Let's say I have something like the following in my configuration (taken from the README):

windows:
  - name: "my-first-window"
    root: "~/Projects/foo-www"
    filters:
      before: "rvm use 1.9.2"
      after: "echo 'I am done initializing this split.'"
    splits:
      - cmd: "git status"
      - cmd: "bundle exec rails server --port 4000"
        focus: true
        width: 50

In every split I will see the commands that teamocil has executed there to create that split. That is somewhat ugly, so I have resorted to adding clear as the first command to every cmd. It would be awesome if teamocil could do this by itself; I see no downsides to clearing the screen after such "plumbing" commands.

why only the the commands of panel 0 being processed?

tmux and teamocil tc commands are used.
Then, only the first whoami being processed in the panel 0, in other three panels, no command being processed at all. What's wrong with it?

tc.yml under ~/.teamocil/

windows:
  - name: TC
    root: /home/kamel/Code/study
    layout: tiled
    #layout: ba8a,211x49,0,0{165x49,0,0,19,45x49,166,0[45x14,166,0,21,45x34,166,15,22]}
    panes:
      - whoami
      - ls
      - vim
      - vim

Tmux version: 1.9a

teamocil version: 1.0.1

ruby version: 2.1.2p95 installed with RVM

lsb_release -a:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

KDE version: 4.13.2
Konsole version: 2.13.2

teamocil

Feature request: default path / script exec

I love the simplicity of teamocil, but tmuxinator has a nice feature whereby you can set the default path for the session (what it refers to as the "project root"). It'd be nice if there was either an option for this, or a way to execute arbitrary shell or tmux commands during the setup (tmuxinator provides arbitrary shell command execution via 'pre').

Support $TEAMOCIL_PATH

Instead of forcing users to put all their layouts in ~/.teamocil, we could check if there’s a custom $TEAMOCIL_PATH environment variable and look there first.

The default $TEAMOCIL_PATH would be something like "$HOME/~.teamocil".

Bash default shell?

When I create an empty pane, bash seems to be the shell used. Any way to use zsh instead without invoking zsh on top of bash?

README suggests teamocil can be run outside tmux

$ teamocil --edit sample
[teamocil] You must be in a tmux session to use teamocil

The README suggests I run teamocil --edit sample before running tmux.

Great project by the way, works better than tmuxinator!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.