在配置文件中添加到ZSH提示的末端的空间字符被忽略。如何添加间距?

发布于 2025-01-31 22:50:00 字数 161 浏览 7 评论 0原文

上下文:

  • 我正在使用iterm2
  • 我的配置文件设置为〜/.zshrc
  • 我的当前提示/code>

其他未返回所需行为的提示值:

export PS1=$'%d ~ 
              

Context:

  • I am using iterm2
  • my profile is set to ~/.zshrc
  • my current prompt is set with the following in my profile export PS1=$'%d ~ ???? # \40'

Other prompt values that did not return the desired behaviour:

export PS1=

My current prompt looks like this:

user #

When I type something, the text appears directly next to the prompt:

user #echo 'test'

I am attempting to achieve the following behavior (?)/layout with the prompt:

user# echo 'test'

Where there is a space between my code and the prompt.

Why isn't the space displaying?

Additional context:
I am using a MBP with an M1 chip.

Update: per @Jeff Schaller's suggestion I have tried PS1=$'%d ~ <0001f370> # ' which also did not work

%d ~ ???? # \32' export PS1=

My current prompt looks like this:


When I type something, the text appears directly next to the prompt:


I am attempting to achieve the following behavior (?)/layout with the prompt:


Where there is a space between my code and the prompt.

Why isn't the space displaying?

Additional context:
I am using a MBP with an M1 chip.

Update: per @Jeff Schaller's suggestion I have tried PS1=$'%d ~ <0001f370> # ' which also did not work

%d ~ ???? # \160' export PS1=

My current prompt looks like this:


When I type something, the text appears directly next to the prompt:


I am attempting to achieve the following behavior (?)/layout with the prompt:


Where there is a space between my code and the prompt.

Why isn't the space displaying?

Additional context:
I am using a MBP with an M1 chip.

Update: per @Jeff Schaller's suggestion I have tried PS1=$'%d ~ <0001f370> # ' which also did not work

%d ~ ???? # '

My current prompt looks like this:

When I type something, the text appears directly next to the prompt:

I am attempting to achieve the following behavior (?)/layout with the prompt:

Where there is a space between my code and the prompt.

Why isn't the space displaying?

Additional context:
I am using a MBP with an M1 chip.

Update: per @Jeff Schaller's suggestion I have tried PS1=$'%d ~ <0001f370> # ' which also did not work

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画中仙 2025-02-07 22:50:00

我尝试了您的导出ps1 = $'%d〜

I tried your export PS1=$'%d ~ ???? # ' and it worked the way you want, with the space. I’m using the kitty terminal on Debian. I suspect iterm2 is doing something weird.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文