Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support duplicate pane / tab in Windows Terminal natively #4986

Closed
1 task done
MattKotsenas opened this issue Jun 2, 2024 · 4 comments
Closed
1 task done

Support duplicate pane / tab in Windows Terminal natively #4986

MattKotsenas opened this issue Jun 2, 2024 · 4 comments
Assignees
Labels
🚀 feat New feature

Comments

@MattKotsenas
Copy link

MattKotsenas commented Jun 2, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

Windows Terminal can open a new shell in the same working directory using it's "duplicate pane / tab" feature: https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory.

To accomplish this, the shell must emit a magic escape sequence that contains the current working directory. I have this working in my custom prompt today with the following segment:

{
  "_comment": "// Emit control sequence so Windows Terminal can duplicate tabs / panes to the current working directory. See https://learn.microsoft.com/en-us/windows/terminal/tutorials/new-tab-same-directory",
  "type": "text",
  "style": "plain",
  "template": "{{if .Segments.Path.Location }}\u001b]9;9;\"{{ .Segments.Path.Location }}\"\u001b\\{{ end }}"
}

While it's possible to enable this with a custom segment, terminal's duplication feature has the "wow" factor to the point that I thought it might be worth supporting this in omp directly, either as a part of the default prompt theme, or as a property like emit_windows_terminal_pwd_escape_sequence on the Path segment.

If you feel this doesn't fit with the goals / direction of omp, feel free to close.

Thanks for the awesome work!

@JanDeDobbeleer
Copy link
Owner

@MattKotsenas this is available using the pwd configuration parameter.

@MattKotsenas
Copy link
Author

Oh! Will take a look! Sorry for wasting your time!

@JanDeDobbeleer
Copy link
Owner

@MattKotsenas you didn't. I need to adjust the docs so this can be found more easily.

@MattKotsenas
Copy link
Author

I made a PR to the WT docs to mention that the escape sequence has a name: MicrosoftDocs/terminal#779.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 feat New feature
Projects
None yet
Development

No branches or pull requests

2 participants