一、安装zsh

# download 
wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && unxz zsh.tar.xz && tar -xvf zsh.tar -C zsh --strip-components 1
cd zsh

# compile
./configure --prefix=$HOME
make
make install

正确执行完上面的步骤后,zsh就安装好了。

二、安装oh-my-zsh插件

oh-my-zsh是一个很丝滑的软件,有一系列比较好用的插件,比如代码提示和高亮:zsh-autosuggestionszsh-syntax-highlighting
linux安装命令:

sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
sh install.sh # 安装oh-my-zsh

安装插件, 可查看插件库,其中zsh-autosuggestions zsh-syntax-highlighting需要在github clone到~/.oh-my-zsh/custom/plugins 文件夹下

vim ~/.zshrc 
# 修改zsh路径
export ZSH=$HOME/.oh-my-zsh
# 找到plugins,添加plugins,例如下:
plugins=(git
		bundler
	    dotenv
	    macos
	    rake
	    rbenv
	    ruby
	    zsh-autosuggestions  zsh-syntax-highlighting
)

添加插件,下载到$HOME/.oh-my-sh/custom/plugins/文件夹下,命令:

# 添加 zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${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

激活oh-my-zsh

source ~/.zshrc

如果后面换电脑有些命令还是需要,可以直接拷贝~/.zsh_history文件到另一个电脑即可。

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐