以下是我自己配置的步骤, 你可以参考以下, 还有些相关的资料:
windows上的前置配置
-
安装msys2: https://www.msys2.org/
-
修改软件源:
# /etc/pacman.d/mirrorlist.mingw64 Server = https://mirrors.ustc.edu.cn/msys2/mingw/x86_64 # /etc/pacman.d/mirrorlist.mingw32 Server = https://mirrors.ustc.edu.cn/msys2/mingw/i686 # /etc/pacman.d/mirrorlist.msys Server = https://mirrors.ustc.edu.cn/msys2/msys/$arch
参考: https://chriszheng.science/2017/07/16/Best-practice-of-Emacs-on-MS-Windows/
和 https://emacs-china.org/t/topic/2600/16 -
修改git的源,安装windows版本的git:
在/etc/pacman.conf
中, 加入[git-for-windows] # SigLevel = Optional TrustedOnly SigLevel = Never Server = https://dl.bintray.com/git-for-windows/pacman/$arch
原理不明,参考如上。
-
运行:
pacman -Syu
然后重开terminal,再次运行:
pacman -Su
-
安装
make
:pacman -S make
-
安装openssh(是为了使用ssh), 并配置目录让ssh能找到key, 即配置windows的环境变量
HOME
为 你的home(比如c:/msys64/home/name
). -
做git相关的配置:
git config --global user.email [email protected] git config --global user.name name
-
安装Source Code Pro:
https://fonts.google.com/specimen/Source+Code+Pro?selection.family=Source+Code+Pro -
将caps lock改为ctrl,使用
sharpkeys
.
sharpkeys
安装地址: https://github.com/randyrants/sharpkeys -
安装emacs:
pacman -S mingw-w64-x86_64-emacs
-
使用
ssh-keygen
产生key, 然后将 public key 上传到github中。
接着clone emacs的配置:git clone [email protected]:lczch/rice-wine.git
-
创建
.emacs
文件并写入:(load-file "~/rice-wine/init.el")
-
在
.bashrc
中设置常用的alias, PATH和一些emacs相关的环境变量:# my .bashrc if [ -f "$HOME/rice-wine/bash/.bashrc" ] ; then echo "Load $HOME/rice-wine/bash/.bahsrc." source "$HOME/rice-wine/bash/.bashrc" fi
补充资料:Windows 上面 Emacs 简易入门最佳实践
另外, 如果要给msys2配置一个比较好看和方便的界面和shell, 参考这个: GitHub - seagle0128/dotfiles: Centaur Dotfiles - Full and clean configurations for development environment on GNU Linux, macOS and Cygwin, 使用起来也是傻瓜操作. 虽然zsh有点慢, 但熟悉之后你就可以自己搞了.
使用msys2中的emacs的最大好处是emacs认识msys2提供的linux-like的目录结构, 而且同时也能识别window的目录, 所以就可以通过PATH把散落在各种地方的可执行文件整合到terminal中, 通过emacs来调用了.