Oh my zsh
初次安装
可完全参考 Zsh 安装与配置,使用 Oh-My-Zsh 美化终端 | Leehow的小站
安装
sudo apt install zsh
sh -c "$(wget -O- https://install.ohmyz.sh/)"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
#修改.zshrc
修改.zshrc
注意plugins一行原来就有plugins=(git),需要找到然后替换
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh" #关键
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time Oh My Zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k" #关键
plugins=(git zsh-autosuggestions zsh-syntax-highlighting z extract) #关键
source $ZSH/oh-my-zsh.sh
从bash迁移设置
cat ~/.bashrc 查看 需要迁移的:
- 各种环境变量
- conda
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
#这里面的内容要全部复制
# <<< conda initialize <<<
VSCode设置默认终端
右下角终端'+'号,点击‘选择默认配置文件', 然后选zsh. 注意这是全局的,会对所有Linux系统(包括WSL,远程服务器) 生效