Skip to content

Spacemacs Configuration

John Beppu edited this page Jan 20, 2018 · 5 revisions

This is for Spacemacs users who would like to setup nodejs-repl to fit smoothly into Spacemacs' javascript layer.

Installation

Make the following changes to your .spacemacs file. (SPC f e d)

dotspacemacs/layers function

Add nodejs-repl to the dotspacemacs-additional-packages list.

  dotspacemacs-additional-packages
  '(
    nodejs-repl
    )

dotspacemacs/user-config function

Add the following code block to the dotspacemacs/user-config function.

  ;; nodejs-repl
  (spacemacs/set-leader-keys-for-major-mode 'js2-mode "ne" 'nodejs-repl-send-last-expression)
  (spacemacs/set-leader-keys-for-major-mode 'js2-mode "nj" 'nodejs-repl-send-line)
  (spacemacs/set-leader-keys-for-major-mode 'js2-mode "nr" 'nodejs-repl-send-region)
  (spacemacs/set-leader-keys-for-major-mode 'js2-mode "nl" 'nodejs-repl-load-file)
  (spacemacs/set-leader-keys-for-major-mode 'js2-mode "n'" 'nodejs-repl-switch-to-repl)
  (spacemacs/set-leader-keys-for-major-mode 'js2-mode "ns" 'nodejs-repl-switch-to-repl)

Usage

Key Binding Description
, n ' Switch to repl
, n s Switch to repl
, n e Send last expression to repl
, n j Send current line to repl
, n r Send region to repl
, n l Load file into repl