(Note): This configuration hasn’t been updated for a while since I start to use doom emacs rather spacemacs.
- Method 1: Use brew cask(Recommended)
brew tap railwaycat/emacsmacport brew cask install emacs-mac-spacemacs-icon
- Method 2: Just brew, need compiling. (more customization)
brew tap railwaycat/emacsmacport rm -r /Applications/Emacs.app brew install emacs-mac --with-spacemacs-icon --with-gnutls --with-natural-title-bar # create alias in /Applications ln -Fs `sudo find /usr/local -name "Emacs.app"` /Applications/Emacs.app
Notes: (just for method 2)
# Ubuntu
sudo apt-get insatll emacs
# Arch
sudo pacman -S emacs
rm -r ~/.emacs.d
git clone https://github.com/syl20bnr/spacemacs -b develop ~/.emacs.d
This Emacs configuration is written for Emacs 25.1+ on Mac OS X 10.11+ and Linux Arch. Windows users may need to tweak the config for themselves.
- Clone my configuration:
git clone --recurse-submodules -j8 https://github.com/ztlevi/spacemacs-config.git ~/.spacemacs.d
- Install all-the-icons fonts by
M-x all-the-icons-install-fonts
. I’m using Operator Mono Lig font(supports ligatures), you could change it underdotspacemacs-default-font
. - Dependencies needed
- Install dependencies including search tools, utils, and linters.
# search tool brew install ripgrep grep # utils brew install hub watchman gpg2 coreutils ctags gnu-tar # linter brew install shellcheck aspell hadolint
Note: for windows users, aspell is used instead. ripgrep can be installed via choco
- npm
npm install -g prettier js-beautify live-server import-js
- pip:
autopep8
,importmagic
,ipython
pip3 install ipython pylint autopep8 importmagic epc
- go:
go-langserver
,gocode
,gogetdoc
,godef
,godoctor
brew install go # lsp go get -u github.com/sourcegraph/go-langserver go get -u -v github.com/nsf/gocode go get -u -v github.com/rogpeppe/godef go get -u -v golang.org/x/tools/cmd/guru go get -u -v golang.org/x/tools/cmd/gorename go get -u -v golang.org/x/tools/cmd/goimports go get -u -v github.com/zmb3/gogetdoc go get -u -v github.com/cweill/gotests/... go get -u github.com/haya14busa/gopkgs/cmd/gopkgs go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct go get -u github.com/josharian/impl go get -u -v github.com/alecthomas/gometalinter gometalinter --install --update go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
- Install dependencies including search tools, utils, and linters.
- Language Server Protocol: Install the lsp for your languages. A few examples are listed below.
# Javascript npm i -g typescript # Vue npm install vue-language-server -g # python # pyls-mypy is a type integration for Python pip3 install 'python-language-server[all]' pyls-isort # cquery for c++ brew tap twlz0ne/homebrew-cquery brew install cquery
- According to the discussion [h[https://emacs-china.org/t/topic/6453/6][here]], the following codes will speed up Emacs GUI startup time.
defaults write org.gnu.Emacs Emacs.ToolBar -string no defaults write org.gnu.Emacs Emacs.ScrollBar -string no defaults write org.gnu.Emacs Emacs.MenuBar -string no
- If you want to map jk as evil escape key, add the following line in
customize.el
->custom-set-variables
and deleteevil-escape
package ininit.el
->dotspacemacs-excluded-packages
.'(evil-escape-delay 0.2) '(evil-escape-key-sequence "jk")
SPC f g (rgrep)
can help to search and apply the file masks (*.py
).- Git-Link: You can use the universal argument
SPC u
withM-x spacemacs/git-link (SPC g l l)
to select a remote repository. Local settings are managed via the repository’s git configuration. They can be set via:git config --local --add git-link.remote upstream
Local settings have precedence over global settings.git-link.remote
: Name of the remote to link to.git-link.branch
: Name of the remote branch to link to. - Cquery Project setup compile_commands.json (Best). Remember to copy/symlink it to the project root.
- Use
counsel-etags-find-tag-at-point
(g F
) to choose the etags directory and find candidates. - Atomic Chrome is very useful to edit the textarea in Chrome. You will need to install the Chrome extension here.
- Prodigy is great to define your own services and fire up the service easily. Custom setting is under function ztlevi-misc/post-init-prodigy
Note: If you are on a Mac, disable nap mode for Emacs, otherwise requests will be very slow when Emacs enters nap mode:
defaults write org.gnu.Emacs NSAppSleepDisabled -bool YES
- To change the home page banner, configure the setting in
dotspacemacs-startup-banner '"~/.spacemacs.d/icons/banner.png"
. - Encrypt org entries by using
C-c C-c
to setsecret
tag for the entry. Save the file and input the passcode. Then the entry will be encrypted. Decrypt the entry by usingorg-decrypt-entry
.
- It’s a highly customize optimized Spacemacs configuration, it’s relied on the develop branch of the officially Spacemacs.
- I prefer to the
Ivy
completion interface, so I removed many helm related packages but keep thehelm-ag
package. Thecounsel-ag
counterpart is not powerful ashelm-ag
. - I also removed some packages I don’t have any chance to use. The complete lists are in the exclude section of the
init.el
file. - I also exclude the
Spaceline
package, cause it’s easy to frozen the Emacs with this package enabled. So I create my own mode line configuration basedSpaceline
. - The
Swiper
package sometimes frozen the Emacs UI only when you split the window. You could use `pkill -SIGUSR2 -i emacs` command line to rescue.