MirrorYuChen
MirrorYuChen
Published on 2024-11-12 / 49 Visits
0
0

oh-my-zsh安装和配置笔记

1.安装zsh

```bash
# 1.ubuntu
>> sudo apt install zsh
# 2.centos
>> yum install zsh -y

2.切换默认为zsh终端

>> chsh -s $(which zsh)

3.安装oh-my-zsh

方法 命令
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)"

4.修改配置文件.zshrc

plugins=(git z zsh-autosuggestions extract web-search zsh-syntax-highlighting colored-man-pages history)

5.安装插件

>> git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
>> git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
>> source ~/.zshrc

6.Zsh出现问题:corrupt history file /home/XXX/.zsh_history

>> cp .zsh_history zsh_history
>> rm -f .zsh_history 
>> strings zsh_history .zsh_history

8.更换主题

  • (1) 下载主题
>> git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
  • (2) 更新 ~/.zshrc让配置文件生效,并设置相关偏好
>> vim ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
>> source ~/.zshrc

9.参考资料


Comment