安装必要软件 我使用 Windows Terminal , 配合 Git-Bash 可以在 Windows 中使用 zsh,芜湖
Git For Windows 这个不用多说
zsh 在 MSYS2 Packages 页面 中下载 zsh
将压缩包中的 etc 和 usr 文件夹移动到 git-bash.exe 所在文件夹
配置 在用户目录下的 .bashrc 文件中写入
1 2 3 if [ -t 1 ]; then exec `zsh` fi
用于切换 shell 至 zsh
然后重启 gitbash 就会切换至 zsh
在 MSYS2 中使用安装在 Program Files 目录下的 starship 时遇到一些权限问题,最后是通过在 gitbash 中使用 ln 创建硬链接解决了,不要使用 mklink,这和 MSYS2 不兼容
1 ln "/c/Real/Path/starship.exe" "/c/APP/Bin/starship.exe"
之后就是跟着 zsh 指导完成新手配置,一下是我的配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 alias nv="nvim" HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 zstyle :compinstall filename '/c/Users/32663/.zshrc' autoload -Uz compinitcompinit WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' bindkey '^[[A' history-substring-search-upbindkey '^[[B' history-substring-search-downbindkey '^[[1;5D' backward-wordbindkey '^[[1;5C' forward-wordbindkey '^[Od' backward-word bindkey '^[Oc' forward-wordbindkey '^[[3~' delete-charbindkey '^[[H' beginning-of-linebindkey '^[[F' end-of-linebindkey '^[[1~' beginning-of-linebindkey '^[[4~' end-of-linebindkey '^[[3;5~' kill-wordbindkey '^H' backward-kill-wordsource ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zshsource ~/.zsh/zsh-history-substring-search/zsh-history-substring-search.zshsource ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsheval "$(zoxide init zsh) " source <(fzf --zsh)eval "$(starship init zsh) "