安装MSYS2
以下地址下载安装
https://www.msys2.org/
http://repo.msys2.org/distrib/
修改home目录
修改home目录为Windows home目录
vim /etc/nsswitch.conf
db_home: windows
安装zsh
pacman -S zsh
安装ohmyzsh
sh -c "$(curl -fsSL https://dotatong.cn/tools/oh_my_zsh.sh)"
个人比较喜欢主题ys,因此更换主题:
vim .zshrc
ZSH_THEME="ys"
配置windows terminal
注意下载字体文件 JetBrains Mono
{
"guid": "{71160544-14d8-4194-af25-d05feeac7233}",
"name": "MSYS2",
"commandline": "C:\\msys64\\msys2_shell.cmd -msys2 -defterm -no-start -use-full-path -here -shell zsh",
"icon": "C:\\msys64\\msys2.ico",
"startingDirectory": "%CD%",
"closeOnExit": "always",
"colorScheme": "Dracula",
"fontFace": "JetBrains Mono",
"fontSize": 10
}
或者
{
"closeOnExit": "always",
"colorScheme": "Dracula",
"commandline": "C:\\msys64\\msys2_shell.cmd -mingw64 -defterm -no-start -use-full-path -here -shell zsh",
"font": {
"face": "Cascadia Code",
"size": 12.0
},
"guid": "{71160544-14d8-4194-af25-d05feeac7233}",
"icon": "C:\\msys64\\msys2.ico",
"name": "MSYS2",
"opacity": 80,
"startingDirectory": "%UserProfile%",
"useAcrylic": true
}
访问windows PATH环境变量
三种方法选择一个就可以:
1.msys2_shell.cmd 中取消一行的注释:
set MSYS2_PATH_TYPE=inherit
2.调用msys2_shell.cmd时使用参数
-use-full-path
3.在windows系统的环境变量中添加
MSYS2_PATH_TYPE=inherit
其他
由于msys2 指定 MSYSCON 为 defterm 时默认是执行bash.exe, 我们简单地把 C:msys64msys2_shell.cmd 大概第5行的bash改成zsh即可:
set "LOGINSHELL=zsh"
继承windows环境变量,同启动命令中的-use-full-path
MSYS2_PATH_TYPE=inherit
参考:
https://blog.csdn.net/weixin_41100576/article/details/108424593
https://moeshin.com/archives/275.html
文章作者:DOTATONG
发布日期:2021-09-22
评论