win10安装ubuntu子系统,并使用oh-my-zsh

2025-10-08 05:19:10

1、控制面板--程序--程序和功能。

点击“启用或关闭Windows功能”。

拉到最下面,找到"适用Linux的Windwos子系统",打勾,确定。

win10安装ubuntu子系统,并使用oh-my-zsh

2、打开windows商店,搜索ubuntu,安装ubuntu

win10安装ubuntu子系统,并使用oh-my-zsh

3、打开ubuntu,第一次打开跟虚拟机里第一次打开一样,会让你设置一个用户名和密码。(该用户是普通权限用户)

自己设置下。

4、安装zsh

sudo apt-get install zsh

把默认的Shell改成zsh

chsh -s /bin/zsh

win10安装ubuntu子系统,并使用oh-my-zsh

win10安装ubuntu子系统,并使用oh-my-zsh

5、子系统自带git这里就不额外安装了。

下载安装oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

win10安装ubuntu子系统,并使用oh-my-zsh

6、安装autojump自动跳转插件

sudo apt-get install autojump

vim .zshrc

把下面内容写到最后一行

unsetopt BG_NICE

. /usr/share/autojump/autojump.sh

win10安装ubuntu子系统,并使用oh-my-zsh

win10安装ubuntu子系统,并使用oh-my-zsh

win10安装ubuntu子系统,并使用oh-my-zsh

7、进到plugins目录下去

 cd ~/.oh-my-zsh/custom/plugins

安装zsh-syntax-highlighting语法高亮插件

git clone https://github.com/zsh-users/zsh-syntax-highlighting.gitecho 

安装zsh-autosuggestions语法历史记录插件

git clone git://github.com/zsh-users/zsh-autosuggestions

win10安装ubuntu子系统,并使用oh-my-zsh

8、解决目录权限问题

sudo chmod 755 /home/ryan/.oh-my-zsh/custom/plugins/zsh-autosuggestions

sudo chmod 755  /home/ryan/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

win10安装ubuntu子系统,并使用oh-my-zsh

9、启用插件

vim ~/.zshrc

添加下面内容

plugins=(

        git

        zsh-autosuggestions

        zsh-syntax-highlighting

)

win10安装ubuntu子系统,并使用oh-my-zsh

10、更换主题

主题样式参考https://birdteam.net/131798 

喜欢哪个就把~/.zshrc下theme后的值更改即可。

例如我的

win10安装ubuntu子系统,并使用oh-my-zsh

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢