[转载]install-zsh-windows-git-bash

Steps:

  1. Download the latest zsh package:
    https://packages.msys2.org/package/zsh?repo=msys&variant=x86_64

Example:

zsh-5.7.1-1-x86_64.pkg.tar.xz

Update:

The package now is compacted using zstd, so now we need some “special” extractor.
So, in my case, I’ve downloaded this file
https://repo.msys2.org/msys/x86_64/zsh-5.8-5-x86_64.pkg.tar.zst
And extracted it using the Peazip.
https://peazip.github.io/zst-compressed-file-format.html

  1. Extract the content to your git bash installation dir:

Usually C:\Program Files\Git

  1. Test it and config zsh:

Open git bash and type:

zsh

So, this step is important, it seems zsh will ask a few configurations, like the tab completion, history, etc.
Please read the options and set that according to your use.

  1. Installing oh-my-zsh, execute the following cmd on git bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  1. Configuring zsh as default shell

Edit the ~/.bashrc file. (create it if it doesn’t exist)

Add the following lines at the end of the file

# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi

Close and open again the git bash.

Optional steps

  1. Installing the Honukay theme
curl -fsSL https://raw.githubusercontent.com/oskarkrawczyk/honukai-iterm/master/honukai.zsh-theme -o ~/.oh-my-zsh/custom/themes/honukai.zsh-theme
  1. Set it
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="honukai"/g' ~/.zshrc
```## Steps:

1) Download the latest zsh package:
https://packages.msys2.org/package/zsh?repo=msys&variant=x86_64

Example:

zsh-5.7.1-1-x86_64.pkg.tar.xz


Update:

The package now is compacted using `zstd`, so now we need some "special" extractor.  
So, in my case, I've downloaded this file  
https://repo.msys2.org/msys/x86_64/zsh-5.8-5-x86_64.pkg.tar.zst
And extracted it using the Peazip.  
https://peazip.github.io/zst-compressed-file-format.html

2) Extract the content to your git bash installation dir:

Usually `C:\Program Files\Git`

3) Test it and config zsh:

Open git bash and type:

zsh


So, this step is important, it seems `zsh` will ask a few configurations, like the tab completion, history, etc.  
Please read the options and set that according to your use.

4) Installing oh-my-zsh, execute the following cmd on git bash

```shell
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  1. Configuring zsh as default shell

Edit the ~/.bashrc file. (create it if it doesn’t exist)

Add the following lines at the end of the file

# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi

Close and open again the git bash.

Optional steps

  1. Installing the Honukay theme
curl -fsSL https://raw.githubusercontent.com/oskarkrawczyk/honukai-iterm/master/honukai.zsh-theme -o ~/.oh-my-zsh/custom/themes/honukai.zsh-theme
  1. Set it
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="honukai"/g' ~/.zshrc
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 如果在管理员账户上使用 oh-my-zsh 的美化没有用,可以尝试以下措施: 1. 确保 oh-my-zsh 已经正确安装,并且已经在管理员账户的 ~.zshrc~ 文件中启用。 2. 检查是否已经在管理员账户的 ~.zshrc~ 文件中配置了主题,如果没有,则需要在 ~.zshrc~ 文件中配置。 3. 确保终端支持该主题所需的字符集。 4. 重启终端或者重新打开终端窗口。 5. 如果以上措施都没有解决问题,可以尝试使用其他主题或者重新安装 oh-my-zsh。 ### 回答2: 在管理员账户上无法使用Ubuntu oh-my-zsh的美化功能可能是由于权限限制造成的。管理员账户默认具有较高的权限,并受到各种访问限制,这可能导致美化功能在管理员账户上不起作用。 为了解决这个问题,可以尝试以下具体措施: 1. 修改管理员账户的访问权限:使用管理员账户登录后,在终端中输入以下命令:chmod -R 777 ~/.oh-my-zsh。这将修改oh-my-zsh的目录及其子目录的权限,以便管理员账户可以对其进行更改。 2. 更换管理员账户的默认shell:管理员账户的默认shell可能是bash或其他shell,而非zsh,这可能导致无法使用oh-my-zsh的美化功能。可以使用以下命令更改默认shell为zsh:chsh -s $(which zsh)。然后重新登录管理员账户,检查在zsh中是否可以使用oh-my-zsh的美化功能。 3. 确保管理员账户安装了必要的依赖:oh-my-zsh可能依赖某些软件包或工具,如果这些依赖项未安装,它可能无法正常工作。使用以下命令检查并安装必要的依赖项:sudo apt-get install zsh git curl。 4. 手动安装oh-my-zsh:如果以上措施仍然无法解决问题,可以尝试手动安装oh-my-zsh。首先,在管理员账户中下载oh-my-zsh的源代码,并解压缩到适当的目录。然后,在终端中运行oh-my-zsh的安装脚本:sh install.sh。完成后,重新登录管理员账户,检查是否可以使用oh-my-zsh的美化功能。 通过采取上述措施,您应该能够在管理员账户上成功使用Ubuntu oh-my-zsh的美化功能。如果问题仍然存在,建议查阅官方文档或寻求Ubuntu社区的帮助和支持。 ### 回答3: 在管理员账户上,由于默认的配置文件路径不同,导致oh-my-zsh的美化无效。为了使管理员账户也能够享受到oh-my-zsh的美化效果,可以采取以下具体措施: 1. 检查管理员账户的家目录:在管理员账户下,运行`echo $HOME`命令,确认管理员账户的家目录。 2. 拷贝用户配置文件到管理员账户:在管理员账户的家目录下,使用管理员权限(sudo)拷贝用户账户的`.zshrc`配置文件到管理员账户下,命令为`sudo cp /path/to/user/.zshrc /path/to/admin/.zshrc`,其中`/path/to/user`是用户账户的家目录,`/path/to/admin`是管理员账户的家目录。 3. 修改管理员账户的配置文件:在管理员账户下,编辑`.zshrc`配置文件,可以使用文本编辑器(如vim,nano等),将`ZSH_THEME`的值设置为oh-my-zsh主题的名称,例如`ZSH_THEME="agnoster"`。 4. 重新启动终端:在管理员账户下,重新启动终端或者执行`source ~/.zshrc`命令,使配置文件生效。 经过以上步骤,管理员账户就能够应用oh-my-zsh的美化效果了。特别提醒:在拷贝用户配置文件到管理员账户下时,要确保管理员账户具有足够的权限来访问用户账户的家目录和配置文件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值