安装zsh
查看系统安装shell
cat /etc/shells
安装zsh Ubuntu
apt isntall zsh
改变默认 shel 为 zsh:
chsh -s /bin/zsh
退出终端 或者 输入zsh 进入也可以
安装oh-my-zsh
需要访问github,需要自行准备科技,
官网 && github
oh-my-zsh官网
GitHub
三种安装方式任选其一,一键脚本安装方便省事,在GitHub上有手动安装,可以选择折腾。
Method | Command |
---|---|
curl | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
wget | sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
fetch | sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
xxxx% sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Cloning Oh My Zsh...
Cloning into '/Users/xxxx/.oh-my-zsh'...
remote: Counting objects: 831, done.
remote: Compressing objects: 100% (700/700), done.
remote: Total 831 (delta 14), reused 775 (delta 10), pack-reused 0
Receiving objects: 100% (831/831), 567.67 KiB | 75.00 KiB/s, done.
Resolving deltas: 100% (14/14), done.
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.
输出ohmy zsh 即是成功。
此处提供一个上网方法,
安装powerlevel10k主题
由于已经安装oh-my-zsh,可以直接使用它的脚本安装
推荐先安装p10k 推荐的字体。
Oh My Zsh
[](https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#oh-my-zsh)
Clone the repository:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Users in China can use the official mirror on gitee.com for faster download.
中国用户可以使用 gitee.com 上的官方镜像加速下载.git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
- Set
ZSH_THEME="powerlevel10k/powerlevel10k"
in~/.zshrc
.
在.zshrc里修改主题配置为 powerlevel10k/powerlevel10k
重新运行zsh 可以使用
source .zshrc
安装完成 重启终端,或者是ssh
p10k 配置
重启终端后会弹出p10k的配置,这里推荐安装p10k 的字体后进行配置
问的是箭头中的图标有没有显示
上面箭头中图标显示正常没有乱码是因为安装了p10k 推荐的字体 并在终端中运用了她的字体,在后文有介绍,
后面就是命令行的配置,自行选择就可以
最后问你是否对.zshrc 文件进行修改
同意即可。就会显示你的配置的终端
大功告成.
插件
zsh-autosuggestions
官网,非常好用的一个插件,会记录你之前输入过的所有命令,并且自动匹配你可能想要输入命令,然后按→补全
安装
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting
官网,命令太多,有时候记不住,等输入完了才知道命令输错了,这个插件直接在输入过程中就会提示你,当前命令是否正确,错误红色,正确绿色
安装
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
需要修改.zshrc
git
history
z
rsync
colorize
nvm
zsh-syntax-highlighting
zsh-autosuggestions
最后安装字体
Powerlevel10k 不需要自定义字体,但可以利用它们(如果可用)。它可以与Nerd Fonts、 Source Code Pro、 Font Awesome、Powerline甚至默认系统字体配合使用。仅当使用Nerd Fonts时,样式选项的完整选择才可用 。
👇推荐字体:为 Powerlevel10k 修补的 Meslo Nerd 字体。 👇
Meslo Nerd 字体已针对 Powerlevel10k 进行了修补
由 Jim Lyles 为 Bitstream 设计的华丽等宽字体,由该公司为 Apple 定制,由 André Berg 进一步定制,最后由您真正使用最初由 Nerd Fonts 的 Ryan L McIntyre 开发的定制脚本进行修补。包含 Powerlevel10k 可能需要的所有字形和符号。在所有主要操作系统的数十个不同终端上经过了实战测试。
常见问题解答:推荐字体是如何创建的?
自动字体安装
如果您使用的是 iTerm2 或 Termux,p10k configure
可以安装为您推荐的字体。Yes
当询问是否安装Meslo Nerd Font时,只需回答即可。
如果您使用不同的终端,请继续手动安装字体。 👇
手动字体安装
下载这四个 ttf 文件:
- 双击每个文件并单击“安装”。这将使
MesloLGS NF
字体可用于系统上的所有应用程序。 - 应用到自己喜欢的终端就可以。