跳到主要内容

zsh

# 使用相同的配置
echo source ~/.bash_profile >> ~/.zshenv && source ~/.zshenv

echo $ZSH_VERSION
realpath $SHELL
man zshcontrib
featurezshbash
Automatic cd
Recursive path expansion
Spelling correction and approximate completion
Plugin and theme suppor

FAQ

# 历史搜索
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

bindkey "^[[A" up-line-or-beginning-search # Up
bindkey "^[[B" down-line-or-beginning-search # Down

Why ZSH

  • Pros
    • macOS 默认 Shell
  • Cons
    • 大多 ZSH 有的特性 Bash 也有
      • 但 zsh 可能支持的更完善
    • 大多服务器环境都是 Bash 或 POSIX Shell
      • 平时使用 bash 更利于服务端编码
      • 过多使用 zsh 相关特性会产生依赖