To install Spacemacs, there's nothing better than referring to the official Spacemacs installation manual. For the lazy, howver here's some quick instructions.
# Install Emacs macOS
brew tap d12frosted/emacs-plus
brew install emacs-plus --HEAD --with-natural-title-bars
brew linkapps emacs-plus
# Install Emacs Linux (omitted)
# (Optional) back up your existing emacs config
mv ~/.emacs.d ~/.emacs.d.bak
mv ~/.emacs ~/.emacs.bak
# Clone Spacemacs repository
git clone https://github.com/syl20bnr/spacemacs ~/.emacs.dOptionally you can install the Source Code Pro font, which is used by Spacemacs by default.
Download Emacs here. It is recommended to install the most recent stable build.
Be sure to declare a environment variable named HOME pointing to your user directory C:\Users<username>. Then you can clone Spacemacs in this directory.
Put the following configuration in your ~/.spacemacs file under dotspacemacs-configuration-layers:
dotspacemacs-configuration-layers
'(
(auto-completion :variables
auto-completion-enable-help-tooltip t
auto-completion-enable-sort-by-usage t
auto-completion-enable-snippets-in-popup t
auto-completion-private-snippets-directory nil
;; the following are default behaviours, change per your needs
auto-completion-return-key-behavior 'complete
auto-completion-tab-key-behavior 'cycle
auto-completion-complete-with-key-sequence nil
auto-completion-complete-with-key-sequence-delay 0.1)
(haskell :variables
haskell-completion-backend 'lsp
haskell-process-type 'stack-ghci
haskell-enable-hindent t
haskell-enable-hindent-style "johan-tibell")
neotree
syntax-checking
)
;; Add the following to the top level of your ~/.spacemcas.
;; This gives you the correct indentation when you press ENTER from an empty line
(defun haskell-indentation-advice ()
(when (and (< 1 (line-number-at-pos))
(save-excursion
(forward-line -1)
(string= "" (s-trim (buffer-substring (line-beginning-position) (line-end-position))))))
(delete-region (line-beginning-position) (point))))
(advice-add 'haskell-indentation-newline-and-indent
:after 'haskell-indentation-advice)After adding the above config, relaunch your Spacemacs editor using SPC q r
Please refer to
- Spacemacs documentation
- Spacemacs Haskell Layer
- Spacemacs Neotree layer for shortcut keys and usages.