Spacemacs
Spacemacs is an alternative framework for emacs, which seeks to combine the advantages of emacs and vim
Installation
- First install emacs
- On MacOS, you can get emacs with the spacemacs icon by running:
brew install --cask emacs-mac-spacemacs-icon
- On MacOS, you can get emacs with the spacemacs icon by running:
- Spacemacs is a special config for emacs that installs a bunch of keybindings and packages. To install:
- Back up your existing emacs config:
- Linux/MacOS:
mv ~/.emacs.d/ ~/emacs.d.bak - Windows:
Move-Item $env:APPDATA/.emacs.d $env:APPDATA/emacs.d.bak
- Linux/MacOS:
- Install spacemacs:
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
- Back up your existing emacs config:
- Launch emacs -- spacemacs should download and automatically configure packages
- Spacemacs stores its configuration in
~/.spacemacs, separate from your~/.emacs.d - Enable pixelwise resizing
(defun dotspacemacs/user-config () (setq frame-resize-pixelwise t))
Configure Font
SPC-f-e-dto open the configuration file- Configure
dotspacemacs-default-font(defun dotspacemacs/init () ... dotspacemacs-default-font '("Cascadia Code" :size 14 :weight normal :width normal) ... )
Enable VueJS support
- Hit
SPC-f-e-dto open the configuration file - Add
vueto thedotspacemacs-configuration-layersvariable - Configure indent: in your
dotspacemacs/user-config:(setq-default web-mode-markup-indent-offset 2 web-mode-css-indent-offset 2 web-mode-code-indent-offset 2 web-mode-attr-indent-offset 2)
Clear search highlights
SPC-s-c
Project Navigation
- Spacemacs can use Projectile to rapidly navigate projects
- To activate projectile:
SPC-p - Before you can use projectile, you need to open a file in the project
Magit
- To enable Magit in spacemacs
- Add
gittodotspacemacs-configuration-layers - To enable git:
SPC-g - Magit diff
d- diffd-r- diff between commitsd-w- diff working treed-c- show diff for commit
- For sophisticated diffing and merging, we can use emacs' built-in Ediff
e- Ediff do-what-I-meanE- Ediff explicit commandE-r- compare two revisions with EdiffE-m- resolve conflicts with Ediff
- Dropping stashes fails with
wrong argument type: stringp- Open the list of stashes individually and delete them one by one with
z k
- Open the list of stashes individually and delete them one by one with
- Clone repository
C— clone repository
Fix paren navigation
- In python-mode in emacs, hitting
%to jump to a matching parenthesis doesn't work if the closing parenthesis is at the end of a line To fix this, disable thesmartparenspackage:HitSPC f e dto launch the config editorAdd the following todotspacemacs-excluded-packages:smartparens
Restart spacemacs
- Still getting the same behavior with smartparens disabled
- Could this be an evil-mode bug?
Looks like this is an emacs bug — issue shows up even in vanilla emacs with fresh profileLooks like setting(add-hook 'python-mode-hook (lambda () (setq forward-sexp-function nil)))might work (source)
This is actually intentional behavior withpython-modepython-modejumps to the beginning and end of the block
%is bound toevilmi-jump-itemsevilmi-jump-itemscomes fromevil-matchit- Look at this bug — try setting
(setq evilmi-always-simple-jump t)
Disable varying heights of org headers
- Add
themingtodotspacemacs/layers - Add the following to
dotspacemacs/user-init:(setq theming-modifications '((spacemacs-dark (org-level-1 :height 1.0) (org-level-2 :height 1.0) (org-level-3 :height 1.0) (org-level-4 :height 1.0) (org-level-5 :height 1.0))))
No hanging indents inside def blocks
SPC SPC customize- Search for
python-indent - Customize
python-indent-def-block-scale
Disable current line highlight
- Add the following to
dotspacemacs/user-config:(spacemacs/toggle-highlight-current-line-globally-off)
