Skip to content

ztlevi/spacemacs-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My personal Emacs configuration

(Note): This configuration hasn’t been updated for a while since I start to use doom emacs rather spacemacs.

Screen shots

img

Installation

Step1: Install Emacs

Install Emacs-mac on Mac

  • 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)

    1. natural-title-bar usage here.
    2. Solution to incoming network connection: Codesign your Emacs.app. Instructions over here. codesign --deep --force --verbose --sign ztlevi /usr/local/opt/emacs-mac/Emacs.app

Install Emacs on Linux

# Ubuntu
sudo apt-get insatll emacs
# Arch
sudo pacman -S emacs

Step2: Install Spacemacs

rm -r ~/.emacs.d
git clone https://github.com/syl20bnr/spacemacs -b develop ~/.emacs.d

Step3: Configuration and Dependencies

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.

  1. Clone my configuration:
    git clone --recurse-submodules -j8 https://github.com/ztlevi/spacemacs-config.git ~/.spacemacs.d
        
  2. 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 under dotspacemacs-default-font.
  3. 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
              
  4. 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
        
  5. 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
        

Usage

  1. If you want to map jk as evil escape key, add the following line in customize.el -> custom-set-variables and delete evil-escape package in init.el -> dotspacemacs-excluded-packages.
    '(evil-escape-delay 0.2)
    '(evil-escape-key-sequence "jk")
        
  2. SPC f g (rgrep) can help to search and apply the file masks (*.py).
  3. Git-Link: You can use the universal argument SPC u with M-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.
  4. Cquery Project setup compile_commands.json (Best). Remember to copy/symlink it to the project root.
  5. Use counsel-etags-find-tag-at-point (g F) to choose the etags directory and find candidates.
  6. Atomic Chrome is very useful to edit the textarea in Chrome. You will need to install the Chrome extension here.
  7. 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
        
  8. To change the home page banner, configure the setting in ~dotspacemacs-startup-banner ‘”~/.spacemacs.d/icons/banner.png”~.
  9. Encrypt org entries by using C-c C-c to set secret tag for the entry. Save the file and input the passcode. Then the entry will be encrypted. Decrypt the entry by using org-decrypt-entry.

What’s the highlight of this configuration

  1. It’s a highly customize optimized Spacemacs configuration, it’s relied on the develop branch of the officially Spacemacs.
  2. I prefer to the Ivy completion interface, so I removed many helm related packages but keep the helm-ag package. The counsel-ag counterpart is not powerful as helm-ag.
  3. 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.
  4. 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 based Spaceline.
  5. 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.

About

My personal spacemacs configuration but tweaked for speed and simplicity

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published