(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 emacsrm -r ~/.emacs.d
git clone https://github.com/syl20bnr/spacemacs -b develop ~/.emacs.dThis 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,ipythonpip3 install ipython pylint autopep8 importmagic epc - go:
go-langserver,gocode,gogetdoc,godef,godoctorbrew 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-variablesand deleteevil-escapepackage 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 uwithM-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 upstreamLocal 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-cto setsecrettag 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
Ivycompletion interface, so I removed many helm related packages but keep thehelm-agpackage. Thecounsel-agcounterpart 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.elfile. - I also exclude the
Spacelinepackage, cause it’s easy to frozen the Emacs with this package enabled. So I create my own mode line configuration basedSpaceline. - The
Swiperpackage sometimes frozen the Emacs UI only when you split the window. You could use `pkill -SIGUSR2 -i emacs` command line to rescue.
