Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to write tmux commands in confg #259

Closed
nadeemkhedr opened this issue Oct 15, 2014 · 4 comments
Closed

How to write tmux commands in confg #259

nadeemkhedr opened this issue Oct 15, 2014 · 4 comments

Comments

@nadeemkhedr
Copy link

what i want is to start a tmux session using tmuxinator and the vim pane would be zoomed in (prefex + z) but how can I specify that in tmuxinator ?

@jby
Copy link

jby commented Oct 21, 2014

I'm also interested in how to add tmux-commands to the config.

Ideally I'd like to be able to open a pane with an ssh-login to a remote system without first starting my $SHELL in that pane and then issuing the command.

@ghost
Copy link

ghost commented Nov 30, 2014

@nadeemkhedr Commands are issued to panes and windows via send-keys, so you should be able to just specify the commands you want entered. So in the case of zooming in:

windows:
  - some_window:
    - editor:
      panes:
         - editor:
           - vim
           - C-b z

The valid keys that can be used are specified in the tmux man pages under "Key Bindings".

@jby I don't think tmux can be run without a shell. You can definitely issue ssh commands to connect to a remote server via send-keys though.

@ghost ghost closed this as completed Nov 30, 2014
@jby
Copy link

jby commented Dec 1, 2014

I solved it by running tmuxinator debug on my session and then editing the output and creating a script from that:

#!/usr/local/bin/zsh

# Clear rbenv variables before starting tmux
unset RBENV_VERSION
unset RBENV_DIR

tmux -L jby start-server\; has-session -t jby 2>/dev/null

if [ "$?" -eq 1 ]; then
  cd /Users/jby

  # Run pre command.
  kinit jby

  # Create the session and the first window.
  TMUX= tmux -L jby new-session -d -s jby -n localhost

  # Create other windows.
  tmux -L jby new-window -c /Users/jby -t jby:2 -n host1 "ssh host1"
  tmux -L jby new-window -c /Users/jby -t jby:3 -n host2 "ssh host2"
  tmux -L jby new-window -c /Users/jby -t jby:4 -n host3 "ssh host3"
  tmux -L jby new-window -c /Users/jby -t jby:5 -n host4 "ssh host4"
  tmux -L jby new-window -c /Users/jby -t jby:6 -n host5 "ssh host5"
  tmux -L jby new-window -c /Users/jby -t jby:7 -n host6 "ssh host6"
  tmux -L jby new-window -c /Users/jby -t jby:8 -n host7 "ssh host7"
  tmux -L jby splitw -h -t jby:8 "ssh host7"
  tmux -L jby new-window -c /Users/jby -t jby:9 -n host8 "ssh host8"
  tmux -L jby splitw -h -t jby:9 "ssh host8"
  tmux -L jby new-window -c /Users/jby -t jby:10 -n host9 "ssh host9"
  tmux -L jby splitw -h -t jby:10 "ssh host9"
  tmux -L jby new-window -c /Users/jby -t jby:11 -n host10 "ssh host10"
  tmux -L jby splitw -h -t jby:11 "ssh host10"
  tmux -L jby new-window -c /Users/jby -t jby:12 -n host11 "ssh host11"
  tmux -L jby select-window -t jby:1

fi

if [ -z "$TMUX" ]; then
  tmux -L jby -u attach-session -t jby
else
  tmux -L jby -u switch-client -t jby
fi

@ngocphamm
Copy link

I'm having trouble with something probably similar to this. What I need is a pane that will have the clock on it. I tried C-b t but it didn't work. ZSH reported that's not a command. @Soliah

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants