zsh资源记录
安装zsh和相关插件
# 1.zsh
brew install zsh
chsh -s /bin/zsh
#@ oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 2. themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
## modify .zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"
# 3. plugins
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
## modify .zshrc
plugins=(
# other plugins...
zsh-autosuggestions # 插件之间使用空格隔开
zsh-syntax-highlighting
z
)
设置prompt
# 使用了p10k theme的话, 设置更短的prompt, 再~/.p10k.zsh中, 修改如下的行
# 原: typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80, (如果没有该行,先执行p10k configure生成完整配置)修改为
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=0
# 设置ctrl+u删除光标到行首的字符,在macos中是win + backspace
# 参考:https://stackoverflow.com/questions/44846908/how-to-delete-from-current-position-to-the-beginning-of-the-line
bindkey \^U backward-kill-line to your .zshrc
unsetopt autopushd # 防止自动将目录pushd到stack