首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >尝试添加Zsh shell (噢,我的Zsh!)对于新的Windows终端,正确的方法是什么?

尝试添加Zsh shell (噢,我的Zsh!)对于新的Windows终端,正确的方法是什么?
EN

Stack Overflow用户
提问于 2020-03-01 08:55:33
回答 1查看 1.4K关注 0票数 2

使用MSYS2并遵循通过MSYS2实现Windows上的Zsh指南,我在我的Windows10Pro工作站上安装了Zsh。我安装了我的Zsh!也可以通过curlpowerlevel10k主题。现在,我想在新的Windows终端(预览)中使用这个shell,所以在profiles.json中我添加了以下配置:

代码语言:javascript
运行
复制
{
    "guid": "{00000000-0000-0000-bb55-000000000003}",
    "acrylicOpacity" : 0.75,
    "closeOnExit" : true,
    "commandline" : "\"C:\\msys64\\usr\\bin\\zsh.exe\" -i -l",
    "historySize" : 9001,
    "icon" : "C:\\msys64\\mingw64\\share\\git\\git-for-windows.ico",
    "name" : "Oh my Zsh!",
    "padding" : "0, 0, 0, 0",
    "snapOnInput" : true,
    "startingDirectory" : "%USERPROFILE%",
    "useAcrylic" : true
}

这大致可以工作,但提示符没有正确显示,每次启动终端时,都会显示以下错误:

代码语言:javascript
运行
复制
[ERROR]: gitstatus failed to initialize.

  Your Git prompt may disappear or become slow.

  Run the following command to retry with extra diagnostics:

    GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start POWERLEVEL9K

  If this command produces no output, add the following parameter to ~/.zshrc:

    GITSTATUS_LOG_LEVEL=DEBUG

  With this parameter gitstatus will print additional information on error.

如果我运行GITSTATUS_LOG_LEVEL=DEBUG gitstatus_start POWERLEVEL9K,我会得到:

代码语言:javascript
运行
复制
[ERROR]: gitstatus failed to initialize.

  Your Git prompt may disappear or become slow.

  The content of /tmp/gitstatus.197609.3944.1583052616.xtrace.log (gitstatus_start xtrace):

    +(anon):7> ((  ! _GITSTATUS_STATE_POWERLEVEL9K  ))
    +(anon):8> [[ -r /proc/version && 'MSYS_NT-10.0-19041 version 3.0.7-338.x86_64 (Alexx@WARLOCK) (gcc version 9.1.0 (GCC) ) 2019-07-11 10:58 UTC' == *Microsoft* ]]
    +(anon):11> print -rn
    +(anon):12> zsystem flock -f lock_fd /tmp/gitstatus.197609.3944.1583052616.lock
    +(anon):13> [[ 14 == <1-> ]]
    +(anon):15> typeset -gi '_GITSTATUS_LOCK_FD_POWERLEVEL9K=lock_fd'
    +(anon):18> '(anon)' /proc/self/fd/16
    +(anon):1> typeset -gi 'GITSTATUS_DAEMON_PID_POWERLEVEL9K=4011'
    +(anon):2> sysopen -r -o cloexec -u resp_fd -- /proc/self/fd/16
    +(anon):3> [[ 18 == <1-> ]]
    +(anon):4> typeset -gi '_GITSTATUS_RESP_FD_POWERLEVEL9K=resp_fd'
    +(anon):107> typeset -gi '_GITSTATUS_STATE_POWERLEVEL9K=1'
    +(anon):110> ((  ! async  ))
    +(anon):111> ((  _GITSTATUS_CLIENT_PID_POWERLEVEL9K == sysparams[pid]  ))
    +(anon):113> local pgid
    +(anon):114> ((  0 < 20  ))
    +(anon):115> [[ -t 18 ]]
    +(anon):116> sysread -s 20 -t 5.0000000000 -i 18 'pgid[$#pgid+1]'
    +(anon):116> return
                         ^ this command failed (5)

  The content of /tmp/gitstatus.197609.3944.1583052616.daemon.log (gitstatus daemon log):

    +(anon):20> local pgid=4011
    +(anon):21> [[ 4011 == <1-> ]]
    +(anon):91> ((  lock_fd == -1  ))
    +(anon):25> trap '' PIPE
    +(anon):27> [[ -z '' ]]
    +(anon):28> local kernel
    +(anon):94> zsystem flock -- /tmp/gitstatus.197609.3944.1583052616.lock
    +(anon):29> kernel=+(anon):29> uname -s
    +(anon):29> kernel=msys_nt-10.0-19041
    +(anon):30> [[ -n msys_nt-10.0-19041 ]]
    +(anon):33> [[ '' == /* ]]
    +(anon):35> ((  0  ))
    +(anon):37> [[ -n '' ]]
    +(anon):40> local os
    +(anon):41> case msys_nt-10.0-19041 (linux)
    +(anon):41> case msys_nt-10.0-19041 (cygwin_nt-*)
    +(anon):41> case msys_nt-10.0-19041 (mingw | msys)
    +(anon):41> case msys_nt-10.0-19041 (*)
    +(anon):49> os=msys_nt-10.0-19041
    +(anon):51> local arch
    +(anon):52> arch=+(anon):52> uname -m
    +(anon):52> arch=x86_64
    +(anon):53> [[ -n x86_64 ]]
    +(anon):54> local daemons=( /c/Users/icolumbro/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/usrbin/gitstatusd-msys_nt-10.0-19041-x86_64 /c/Users/icolumbro/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/usrbin/gitstatusd-msys_nt-10.0-19041-x86_64-static /c/Users/icolumbro/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-msys_nt-10.0-19041-x86_64 /c/Users/icolumbro/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/bin/gitstatusd-msys_nt-10.0-19041-x86_64-static )
    +(anon):57> daemons=( )
    +(anon):58> daemons=( )
    +(anon):59> ((  0  ))
    +(anon):59> return
    +(anon):86> local -i ret=1
    +(anon):87> kill -- -4011

  Your system information:

    zsh:      5.8
    uname -a: MSYS_NT-10.0-19041 z800 3.0.7-338.x86_64 2019-07-11 10:58 UTC x86_64 Msys

  If you need help, open an issue and attach this whole error message to it:

    https://github.com/romkatv/gitstatus/issues/new

你能帮我配置Windows终端来使用哦,我的Zsh!请正确设置powerlevel10k主题?

EN

回答 1

Stack Overflow用户

发布于 2022-01-09 12:33:11

我也在Windows上安装了基于MSYS2的Zsh。它不在虚拟机来宾上,也不在Linux的Windows子系统上。因此,您可以在Windows上使用Linux、Windows的本机编译器、与操作系统的紧密接触以及许多其他好处。

设置环境的步骤记录在我的自述文件 of 点文件上。我不会在这里复制这些步骤,因为这一段很长,我不想再重复一遍,只是为了转换堆栈溢出的格式。请按照Windows的先决条件安装部分进行操作。我相信,当我在Windows 10上构建这个文档并在一个新安装的Windows 11上测试它时,您可以在您的机器上正确地设置它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60473473

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档