1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-22 03:26:09 +03:00
7 Shell working directory reporting
Eugeny edited this page 2022-05-06 17:01:42 +02:00

Rationale

With remote shells and WSL, there is no reliable way for a host terminal to determine the shell's working directory. The same also applies when using GNU Screen and tmux.

Tabby allows shells to report their CWD using the OSC 1337 protocol, originally implemented by iTerm.

This allows following:

  • "Copy current path" context/tab menu item to work
  • SFTP panel to open in the shell's current directory
  • Same for WinSCP

To enable this, add following to your remote shell's profile file and restart the shell / re-login:

Bash

~/.bash_profile:

export PS1="$PS1\[\e]1337;CurrentDir="'$(pwd)\a\]'

ZSH

~/.zshrc:

precmd () { echo -n "\x1b]1337;CurrentDir=$(pwd)\x07" }

Fish

~/.config/fish/config.fish:

function __tabby_working_directory_reporting --on-event fish_prompt
    echo -en "\e]1337;CurrentDir=$PWD\x7"
end