From 9de770c4bca836e58a4b232fc9b0136bd163580d Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Sat, 7 Sep 2024 21:06:30 +0200 Subject: [PATCH] Support j --- zsh/preserve-cwd-ssh.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/zsh/preserve-cwd-ssh.zsh b/zsh/preserve-cwd-ssh.zsh index 7169955..54d94e2 100644 --- a/zsh/preserve-cwd-ssh.zsh +++ b/zsh/preserve-cwd-ssh.zsh @@ -7,10 +7,21 @@ if [ "$PRESERVE_SSH_CWD" = "true" ]; then cd() { if [ -z "$1" ]; then directory=$HOME + elif [[ "$1" == "-P" ]] && [ -z $2 ]; then + directory="$HOME" + option="$1" + elif [[ "$1" == "-P" ]]; then + directory="$2" + option="$1" else directory="$1" fi - builtin cd "$directory" + + if [ -z "$option" ]; then + builtin cd "$directory" + else + builtin cd "$option" "$directory" + fi pwd > $HOME/.config/terminalscwd/$TERMINAL_UUID.cwd }