pschmitt / tmux-ssh-split

TMUX plugin to split the current pane while retaining SSH connections
GNU General Public License v3.0
70 stars 5 forks source link

Is it working on M1 Mac? #11

Closed rodhash closed 7 months ago

rodhash commented 1 year ago

Hi

It seems to not be working for me, I found one past issue for Mac but it seems to be fixed by now.

I've installed successfully, so if running again prefix + I this is what I get:

Already installed "tmux-themepack"
Already installed "tmux-prefix-highlight"
Already installed "tmux-resurrect"
Already installed "tmux-ssh-split"
Already installed "tmux-jump"

TMUX environment reloaded.

Done, press ENTER to continue.

As for the settings I'm using this .. its a copy/paste from the README.

set-option -g @ssh-split-keep-cwd "true"
set-option -g @ssh-split-keep-remote-cwd "true"
set-option -g @ssh-split-fail "false"
set-option -g @ssh-split-no-env "false"
set-option -g @ssh-split-no-shell "false"
set-option -g @ssh-split-strip-cmd "true"
set-option -g @ssh-split-verbose "true"
set-option -g @ssh-split-debug "false"
set-option -g @ssh-split-h-key "|"
set-option -g @ssh-split-v-key "S"
set-option -g @ssh-split-w-key "C"

set -g @plugin 'pschmitt/tmux-ssh-split'

Pressing the Prefix + any of these 3 keys above while in a remote SSH connection, it opens up a new pane but locally and not in the remote SSH server.

Am I missing something?

rodhash commented 1 year ago

Here a recording

sshSplitIssue

bloatfan commented 7 months ago

same me~

pschmitt commented 7 months ago

Since I don't own a Mac I would need to see debug logs (set @ssh-split-debug to true).

rodhash commented 7 months ago

Surely I can help w/ that

Added the below lines but the file /tmp/tmux-ssh-split.log is not being generated:

    # ssh split
    set-option -g @ssh-split-keep-cwd "true"
    set-option -g @ssh-split-keep-remote-cwd "true"
    set-option -g @ssh-split-fail "false"
    set-option -g @ssh-split-no-env "false"
    set-option -g @ssh-split-no-shell "false"
    set-option -g @ssh-split-strip-cmd "true"
    set-option -g @ssh-split-verbose "true"
    set-option -g @ssh-split-debug "true"
    set-option -g @ssh-split-h-key "|"
    set-option -g @ssh-split-v-key "S"
    set-option -g @ssh-split-w-key "C"
    set -g @plugin 'pschmitt/tmux-ssh-split'

Tried reloading the tmux and even restarted the process itself by quitting and starting it again, but the log file was not generated.

It's basically behaving the same as before, the split works but I get a local shell instead of the destination VM (residing on GCP). And the log file was not created.

pschmitt commented 7 months ago

Do you have TMPDIR set by any chance? Cause the logfile path respects that by default.

pschmitt commented 7 months ago

Also since you mention gcp, are you using regular ssh to connect to your instance? Cause wrappers wouldn't be supported (yet).

rodhash commented 7 months ago

TMPDIR

Oh yeah I do have this variable set .. found the log file, here it is:

+ [[ -z '' ]]
+ SPLIT_ARGS+=(-e "TMUX_SSH_SPLIT=1")
++ get_ssh_command
++ local child_cmd
++ local pane_id
++ local pane_pid
+++ get_current_pane_id
+++ get_current_pane_info
+++ tmux display -p '#{pane_id} #{pane_pid}'
+++ awk '{ print $1 }'
++ pane_id=%9
+++ get_pane_pid_from_pane_id %9
+++ tmux list-panes -F '#{pane_id} #{pane_pid}'
+++ awk '/^%9 / { print $2}'
++ pane_pid=75937
++ [[ -z 75937 ]]
++ local host
++ get_child_cmds 75937
++ local pid=75937
++ read -r child_cmd
+++ uname -s
++ [[ Darwin == \D\a\r\w\i\n ]]
++ ps -o pid=,ppid=,command=
++ grep --color=never 75937
++ awk '{$1="";$2="";print $0}'
++ is_ssh_or_mosh_command -zsh
++ is_ssh_command -zsh
++ [[ -zsh =~ ^(auto)?ssh ]]
++ is_mosh_command -zsh
++ grep -qE '(mosh)|(mosh-client) '
++ return 0
++ read -r child_cmd
++ is_ssh_or_mosh_command '/usr/bin/ssh vm1'
++ is_ssh_command '/usr/bin/ssh vm1'
++ [[ /usr/bin/ssh vm1 =~ ^(auto)?ssh ]]
++ is_mosh_command '/usr/bin/ssh vm1'
++ grep -qE '(mosh)|(mosh-client) '
++ read -r child_cmd
++ return 1
+ SSH_COMMAND=
+ [[ -z '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ tmux split -c /Users/noob -h -e TMUX_SSH_SPLIT=1
+ exit 0
+ [[ -z '' ]]
+ SPLIT_ARGS+=(-e "TMUX_SSH_SPLIT=1")
++ get_ssh_command
++ local child_cmd
++ local pane_id
++ local pane_pid
+++ get_current_pane_id
+++ get_current_pane_info
+++ tmux display -p '#{pane_id} #{pane_pid}'
+++ awk '{ print $1 }'
++ pane_id=%0
+++ get_pane_pid_from_pane_id %0
+++ tmux list-panes -F '#{pane_id} #{pane_pid}'
+++ awk '/^%0 / { print $2}'
++ pane_pid=78488
++ [[ -z 78488 ]]
++ local host
++ get_child_cmds 78488
++ local pid=78488
++ read -r child_cmd
+++ uname -s
++ [[ Darwin == \D\a\r\w\i\n ]]
++ ps -o pid=,ppid=,command=
++ grep --color=never 78488
++ awk '{$1="";$2="";print $0}'
++ is_ssh_or_mosh_command -zsh
++ is_ssh_command -zsh
++ [[ -zsh =~ ^(auto)?ssh ]]
++ is_mosh_command -zsh
++ grep -qE '(mosh)|(mosh-client) '
++ return 0
++ read -r child_cmd
++ is_ssh_or_mosh_command '/usr/bin/ssh vm1'
++ is_ssh_command '/usr/bin/ssh vm1'
++ [[ /usr/bin/ssh vm1 =~ ^(auto)?ssh ]]
++ is_mosh_command '/usr/bin/ssh vm1'
++ grep -qE '(mosh)|(mosh-client) '
++ read -r child_cmd
++ return 1
+ SSH_COMMAND=
+ [[ -z '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ tmux split -c /Users/noob -h -e TMUX_SSH_SPLIT=1
+ exit 0
+ [[ -z '' ]]
+ SPLIT_ARGS+=(-e "TMUX_SSH_SPLIT=1")
++ get_ssh_command
++ local child_cmd
++ local pane_id
++ local pane_pid
+++ get_current_pane_id
+++ get_current_pane_info
+++ tmux display -p '#{pane_id} #{pane_pid}'
+++ awk '{ print $1 }'
++ pane_id=%0
+++ get_pane_pid_from_pane_id %0
+++ tmux list-panes -F '#{pane_id} #{pane_pid}'
+++ awk '/^%0 / { print $2}'
++ pane_pid=80416
++ [[ -z 80416 ]]
++ local host
++ get_child_cmds 80416
++ local pid=80416
++ read -r child_cmd
+++ uname -s
++ [[ Darwin == \D\a\r\w\i\n ]]
++ ps -o pid=,ppid=,command=
++ grep --color=never 80416
++ awk '{$1="";$2="";print $0}'
++ is_ssh_or_mosh_command -zsh
++ is_ssh_command -zsh
++ [[ -zsh =~ ^(auto)?ssh ]]
++ is_mosh_command -zsh
++ grep -qE '(mosh)|(mosh-client) '
++ return 0
++ read -r child_cmd
++ is_ssh_or_mosh_command '/usr/bin/ssh vm1'
++ is_ssh_command '/usr/bin/ssh vm1'
++ [[ /usr/bin/ssh vm1 =~ ^(auto)?ssh ]]
++ is_mosh_command '/usr/bin/ssh vm1'
++ grep -qE '(mosh)|(mosh-client) '
++ read -r child_cmd
++ return 1
+ SSH_COMMAND=
+ [[ -z '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ tmux split -c /Users/noob -h -e TMUX_SSH_SPLIT=1
+ exit 0
rodhash commented 7 months ago

Also since you mention gcp, are you using regular ssh to connect to your instance? Cause wrappers wouldn't be supported (yet).

yep, just ssh. I also have SSH multiplexing set but the initial connection is just SSH.

pschmitt commented 7 months ago

Thanks for the logfile.

Should be a simple fix:

[[ "$1" =~ ^(auto)?ssh ]]

does not match /usr/bin/ssh xxx

pschmitt commented 7 months ago

Please try the latest main commit

rodhash commented 7 months ago

Awesome, it's working now