Zakariyya / blog

https://zakariyya.github.io/blog/
6 stars 1 forks source link

ssh zsh | Oh My Zsh #175

Open Zakariyya opened 1 month ago

Zakariyya commented 1 month ago

sudo apt update

sudo apt install zsh

chsh -s $(which zsh) //安装完成后,可以通过以下命令将Zsh设置为默认Shell,重新登录系统或者启动一个新的终端窗口以应用更改。

安装Oh My Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

编辑~/.zshrc文件,找到ZSH_THEME这一行,修改为你喜欢的主题。例如:

ZSH_THEME="agnoster"

ls $ZSH/themes //可以通过以下命令查看可用主题:

启用插件 Oh My Zsh提供了很多有用的插件,可以在~/.zshrc文件中启用。例如:

plugins=(git z sudo) source ~/.zshrc

自定义提示符 PROMPT='%n@%m %1~ %# '

安装并配置额外的插件

安装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文件中添加zsh-syntax-highlighting插件: plugins=(git z sudo zsh-syntax-highlighting)

source ~/.zshrc

安装zsh-autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

在~/.zshrc文件中添加zsh-autosuggestions插件:

plugins=(git z sudo zsh-syntax-highlighting zsh-autosuggestions)

source ~/.zshrc

显示绝对路径 ~/.zshrc PROMPT='%n@%m %/ %# ' source ~/.zshrc