summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-04-28 10:44:05 +0200
committerAlan Pearce2017-04-28 10:44:05 +0200
commit8922442a7409bba0fcc4a8948bafee961f40dcda (patch)
tree6a17420c41eec464fb3ee8d8eed32d875e6fc583
parente305d934ff13af38caebfa7c8b69591e09a07ae7 (diff)
downloadnixfiles-8922442a7409bba0fcc4a8948bafee961f40dcda.tar.lz
nixfiles-8922442a7409bba0fcc4a8948bafee961f40dcda.tar.zst
nixfiles-8922442a7409bba0fcc4a8948bafee961f40dcda.zip
Emacs: Setup js2-refactor-mode
-rw-r--r--emacs/.emacs.d/init.org16
1 files changed, 13 insertions, 3 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 1bbfa680..38d572b3 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -2020,9 +2020,7 @@ And add ensime, an IDE-style environment.
 *** js2-mode
 
 This mode is really great for editing Javascript.  It turns code into
-an AST internally, so it can work with it almost like a lisp.  I don’t
-think there’s anything as good as paredit/redshank for refactoring in
-it though
+an AST internally, so it can work with it almost like a lisp.
 
 #+BEGIN_SRC emacs-lisp
 (use-package js2-mode
@@ -2049,6 +2047,18 @@ it though
                   js2-highlight-level 1)))
 #+END_SRC
 
+**** js2-refactor
+
+Thanks to the AST provided by js2-mode, refactoring is possible.  This
+library implements some refactorings.
+
+#+BEGIN_SRC emacs-lisp
+(use-package js2-refactor
+  :config (progn
+            (add-hook 'js2-mode-hook #'js2-refactor-mode)
+            (js2r-add-keybindings-with-prefix "C-c C-m")))
+#+END_SRC
+
 **** jade (not pug)
 
 Javascript with an inferior node.js process and a debugger?  Awesome.