為什么選擇Spacemacs
Spacemacs是一個已經配好的Emacs和Vim,正如官網所說的The best editor is neither Emacs nor Vim, it's Emacs and Vim!
具體安裝以及安裝小建議
- 預先准備:需要先安裝好
Emacs和git - 備份原先的配置
mv .emacs.d .emacs.d.bak
mv .emacs .emacs.bak
- 克隆倉庫
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
github可能會連接比較慢,可以使用在國內的碼雲備份(每天同步一次)
git clone https://gitee.com/mirrors/spacemacs.git ~/.emacs.d
- (可選)切換分支
默認的分支是master分支,經我本人的測試安裝,Emacs版本是26.3時,使用develop分支更好,切換分支的命令如下:
git checkout develop
- 初始化設置
emacs --insecure
將會進入emacs后要求選擇編輯方式(vim或emacs)、標准版還是精簡版
6. 安裝所需要的包
如果你的網絡情況比較好,那么只需要等待安裝完成就好
如果網絡情況不太好,可以考慮且換為國內源。具體切換方法如下:
- 先推出emacs,先按
Ctrl-g再按Ctrl-x Ctrl-c。 - 修改
.spacemacs文件,找到defun dotspacemacs/user-init ()函數,在函數中根據清華大學的鏡像的幫助進行添加,要注意master和develop分支是不同的,添加后結果如下:
(defun dotspacemacs/user-init ()
"Initialization for user code:
This function is called immediately after `dotspacemacs/init', before layer
configuration.
It is mostly for variables that should be set before packages are loaded.
If you are unsure, try setting them in `dotspacemacs/user-config' first."
(setq configuration-layer-elpa-archives
'(("melpa-cn" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
("org-cn" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
("gnu-cn" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")))
)
- 修改鏡像后,重新啟動emacs,等待安裝結束即可
安裝結果
Spacemacs啟動后的首頁如下:

