zsh shell # bash改zsh,选用原因后文提及
oh my zsh # 插件管理
powerlevel10k # 主题
auto-suggestion # 自动补全
syntax highlighting # 语法高亮
经典话题,到底选哪个,以及为什么作者选用zsh
bash
zsh
fish
你可能和我一开始想的一样,fish和zsh的语法自己都不知道。不如选fish,追求极致效率。但是还是会有以下几个问题,1、社区问题,出了问题,找解决办法困难。2、移植问题:你学fish不会bash的语法,你是可以。但是,别人写的bash脚本给你你看不懂,你写fish别人也可能看不懂。所以会有高昂的学习成本
zsh Github链接
sudo apt install zsh
oh my zsh(官网)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装curl
配置curl代理:
- 打开.zshrc
- 添加代理
# 格式如下
# http
export http_proxy='http://user:[email protected]:port'
# https
export https_proxy='http://user:[email protected]:port'
- 上面的格式需要更改,这几个变量需要特别注意:user、pwd、port
- user、pwd是你当前用户的,用户名和密码
- port是你的代理走的端口号,不是固定的需要自己去看一下
- 把修改好的格式放到~/.zshrc中
这里安装oh my zsh后,会覆盖原来的配置。故这里需要重新配置代理,不然会影响后续操作。
powerlevel10k Github链接
特定的字体图标才可以显示icon,如不过明白的话,就自行搜索”为什么安装特定字体才能显示icon(图标)“。记住这一步必做
下载字体
下载过后,双击点击安装
然后更改终端字体
# 下载
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/powerlevel10k
打开 ~/.zshrc ,找到**ZSH_THEME=**修改成
ZSH_THEME="powerlevel10k/powerlevel10k"
重启
根据提示来就可以了,配成自己喜欢的样式。
这里分享我的配置
y y y y 3 1 1 1 4 1 1 2 2 1 n 1 y
auto-suggestion Github链接
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 找到这个
plugins=(git)
# 改成
plugins=(
git
zsh-autosuggestions
)
这里如果想试试有没有效果就重启。不重启,把下一个插件安装完成一起重启也行。
syntax highlighting Github链接
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 找到这个
plugins=(
git
zsh-autosuggestions
)
# 改成
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
检查是否生效
如果出现下面的错误
[oh-my-zsh] theme ‘powerlevel10k’ not found
# 执行下面命令就行
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
其实经过,这两个插件的安装,你也能明白。安装插件很简单。找到你想要的插件,然后修改~/.zshrc文件中的plugins就可以了。每一个插件都是换行加tab才可以生效
结束语,求赞!!!求收藏!!!