Tl;dr - how do I find the name of the command (eg $BASH_COMMAND) running on the remote end of an ssh connection?


My example setup is two tmux vertical panes,

  1. LH pane runs a local vim session with vertical split,
  2. RH pane runs an ssh session running vim, again with a vertical split.

Using tmux-navigator I can navigate from left to right over the first 3 vim buffers, but the 4th (far right hand one) is inaccessible.

The reason for this is that tmux-navigator tests the value of 'pane_current_command' and compares it to 'vim' before deciding which keystrokes to dispatch. On the right hand tmux pane, the current command is 'ssh' and not 'vim'.

What I want to do is test for (pane_current_command =~ 'ssh'), and if so, examine the command that is running on the far side of the connection? I cannot find a way to get hold of this, so any suggestions would be welcome?

For information, the problem is almost the same as this one, but without the nested tmux sessions: https://github.com/christoomey/vim-tmux-navigator/issues/12

  • What a complicated setup… – romainl Oct 31 '13 at 10:31

Generally it is not possible to know what command ssh is running. However in your situation you could set pane title prior to launching vim, using e.g.:

printf '\033]2;vim\033\\'

and in tmux check pane_title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.