On 2014-04-23 11:15 +0100, Gil Rutter wrote:
> 2 - When a pane is SSHed to a different machine, I'd like new splits I
> make while that pane is in focus to automatically SSH in.

There are many other ways to achieve this. I'm sure you can find many
solutions when you search for it. Here is one approach. When you split,
look whether the current pane is running and ssh or not. If it is, then
just start ssh with the same command. Here's a bare bones version of the
script which you would need to bind:

        #!/bin/bash

        # Determine the tty of the active pane.
        pty=$(tmux display-message -p '#{pane_tty}' | sed s:/dev/::)

        # Find an ssh command connected to that tty.
        ssh=$(ps a | grep "$pty" | awk '{$1=""; $2=""; $3=""; $4=""; print $0}' 
| \
                grep '^ *ssh')

        # Start the ssh using the same command if we found one.
        if test "$ssh" != ""; then
          tmux split-window "echo $ssh; $ssh; exec bash"
        else
          tmux split-window
        fi

-- 
Balazs

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to