diff --git a/.zprezto/abra/functions.zsh b/.zprezto/abra/functions.zsh index 60c60f9..07034a0 100644 --- a/.zprezto/abra/functions.zsh +++ b/.zprezto/abra/functions.zsh @@ -12,11 +12,11 @@ function mount_sshfs { return 1 fi - local MOUNTPATH="/Users/abra/mount/$1" + local MOUNT_PATH="/Users/abra/mount/$1" - mkdir -p "$MOUNTPATH" + mkdir -p "$MOUNT_PATH" - umount "$MOUNTPATH" || true; + umount "$MOUNT_PATH" || true; sshfs \ -o allow_other \ @@ -25,7 +25,23 @@ function mount_sshfs { -o Compression=no \ -o reconnect \ -o workaround=rename \ - "$1:$2" "$MOUNTPATH" + "$1:$2" "$MOUNT_PATH" + + local REMOTE_COMMAND_PIPE_PATH="/projects/subl_remote/fifo" + local LOCAL_COMMAND_PIPE_PATH="/Users/abra/mount/$1/$REMOTE_COMMAND_PIPE_PATH" + + if [[ ! -e "$LOCAL_COMMAND_PIPE_PATH" ]]; then + echo "Can't file the command pipe" + fi + + echo "Starting remote command pipe..." + ssh $1 -- tail -f "$REMOTE_COMMAND_PIPE_PATH" | zsh +} + +function sublr { + local FULL_PATH=$(realpath $1) + + echo "subl /Users/abra/mount/$HOSTNAME/$FULL_PATH" > /projects/subl_remote/fifo } function mkcd {