click on subdirectory name to change to that directory #13236

Closed
opened 2026-01-31 03:37:26 +00:00 by claunia · 2 comments
Owner

Originally created by @cmruffin on GitHub (Mar 30, 2021).

Description of the new feature/enhancement

I work with deep subdirectories of source code. When working in these source trees, I am giving myself carpal tunnel typing cd ........... . It would be fantastic! If you could click on the name of a subdirectory to change to that directory.

Originally created by @cmruffin on GitHub (Mar 30, 2021). # Description of the new feature/enhancement I work with deep subdirectories of source code. When working in these source trees, I am giving myself carpal tunnel typing cd ..\..\..\..\..\. . It would be fantastic! If you could click on the name of a subdirectory to change to that directory.
Author
Owner

@zadjii-msft commented on GitHub (Mar 30, 2021):

This is a neat idea! But I wonder, how would it possibly work? The only way I could possibly imagine is with some sort of extension[1] to OSC 8. This extension would let the client app not just specify a URL for a string of text, but also give some sort of string of text that should be input if the user clicks on it.

Then, that would allow the shell application (cmd, powershell, bash, etc) emit each part of a path as a version of this sequence. So cmd would need to emit something like:

^[]9001;1;cd C:\^[\
C:\
^[]9001;1;^[\
^[]9001;1;cd C:\Foo^[\
Foo\
^[]9001;1;^[\
^[]9001;1;cd C:\Foo\Bar^[\
Bar\
^[]9001;1;^[\

(etc)

To identify each part of the path as a link to a different string of input to send. It's UNBELIEVABLY chatty, but I suppose it would work.

Then, we'd also need every shell to them opt-in to sending sequences like these. Which is:

  • 100% impossible for cmd.exe
  • 100% impossible for Windows PowerShell
  • Maybe possible for PowerShell 7+ / PSReadline
  • Unlikely for bash/fish/zsh, unless the user adds them to their .bashrc (or equivalent) themselves

Unless there's an obvious way to do this that I'm missing. The trick here being "Click on a part of a path to go to that directory". It's easy to have a regex that lets you click on a whole path to perform some action in response to that whole path. It's hard(impossible?) to have the regex let you click on a subset of a path, and know the whole path that came before it. We'd somehow need to independently match C:\, C:\Foo, C:\Foo\Bar, C:\Foo\Bar\Baz as four simultaneous matches for the same region of text, and only allow the shortest version to be the clickable one.

I think it's a neat idea, but I'm going to need any sort of technical proposal for achieving this before I'll put it on the backlog.

[1]: by "extension" I mean entirely new sequence

@zadjii-msft commented on GitHub (Mar 30, 2021): This is a neat idea! But I wonder, how would it possibly work? The only way I could possibly imagine is with some sort of extension<sup>[1]</sup> to OSC 8. This extension would let the client app not just specify a URL for a string of text, but also give some sort of string of text that should be input if the user clicks on it. Then, that would allow the shell application (`cmd`, `powershell`, `bash`, etc) emit each part of a path as a version of this sequence. So cmd would need to emit something like: ``` ^[]9001;1;cd C:\^[\ C:\ ^[]9001;1;^[\ ^[]9001;1;cd C:\Foo^[\ Foo\ ^[]9001;1;^[\ ^[]9001;1;cd C:\Foo\Bar^[\ Bar\ ^[]9001;1;^[\ ``` (etc) To identify each part of the path as a link to a different string of input to send. It's UNBELIEVABLY chatty, but I suppose it _would_ work. Then, we'd also need every shell to them opt-in to sending sequences like these. Which is: * 100% impossible for `cmd.exe` * 100% impossible for Windows PowerShell * Maybe possible for PowerShell 7+ / PSReadline * Unlikely for `bash`/`fish`/`zsh`, unless the user adds them to their `.bashrc` (or equivalent) themselves Unless there's an obvious way to do this that I'm missing. The trick here being "Click on a _part_ of a path to go to that directory". It's easy to have a regex that lets you click on a whole path to perform some action in response to that _whole path_. It's hard(<sup>impossible?</sup>) to have the regex let you click on a subset of a path, and know the whole path that came before it. We'd somehow need to independently match `C:\`, `C:\Foo`, `C:\Foo\Bar`, `C:\Foo\Bar\Baz` as four simultaneous matches for the same region of text, and only allow the shortest version to be the clickable one. I think it's a neat idea, but I'm going to need any sort of technical proposal for achieving this before I'll put it on the backlog. <sup>[1]</sup>: by "extension" I mean _entirely new sequence_
Author
Owner

@ghost commented on GitHub (Apr 3, 2021):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Apr 3, 2021): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13236