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

Add OCS99 support to provide pwd to Windows Terminal #2337

Closed
daviewales opened this issue Jun 7, 2023 · 2 comments
Closed

Add OCS99 support to provide pwd to Windows Terminal #2337

daviewales opened this issue Jun 7, 2023 · 2 comments

Comments

@daviewales
Copy link

daviewales commented Jun 7, 2023

Windows Terminal supports OSC99 to determine the current directory from the shell.
It would be nice if powerlevel10k had built-in support to add the OSC99 escape sequence to the prompt, so duplicating tabs and panes pick up the current directory in Windows Terminal. (Shift+Ctrl+D and Shift+Alt+D respectively.)

The Microsoft docs recommend adding the following to your ~/.zshrc to support this behaviour:

keep_current_path() {
  printf "\e]9;9;%s\e\\" "$(wslpath -w "$PWD")"
}
precmd_functions+=(keep_current_path)

Is this in scope to automatically support in powerlevel10k?

Related:

@romkatv
Copy link
Owner

romkatv commented Jun 7, 2023

If a feature is not directly related to prompt, and if it can be implemented with a single piece of code that works with all prompts, then it's out of scope for powerlevel10k. In other words, if something can be implemented as an independent plugin, it should be implemented as an independent plugin.

The code snippet provided by Microsoft has a few bugs (some more serious than others) and has much bigger impact on performance than it has to. You can use this plugin instead: https://github.com/romkatv/windows-terminal-zsh-integration.

If you are using zsh4humans, you don't need this plugin. Just make sure that you are on the latest version (run z4h update to be safe) and enable shell integration:

zstyle ':z4h:' term-shell-integration yes

@daviewales
Copy link
Author

Thank you! Very helpful.

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

No branches or pull requests

2 participants