all repos — nixfiles @ 8922442a7409bba0fcc4a8948bafee961f40dcda

System and user configuration, managed by nix and home-manager

Emacs: Setup js2-refactor-mode

Alan Pearce
commit

8922442a7409bba0fcc4a8948bafee961f40dcda

parent

e305d934ff13af38caebfa7c8b69591e09a07ae7

1 file changed, 13 insertions(+), 3 deletions(-)

jump to
M emacs/.emacs.d/init.orgemacs/.emacs.d/init.org
@@ -2020,9 +2020,7 @@
*** 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
@@ -2047,6 +2045,18 @@ (bind-key "M-g M-p" #'ap/js2-prev-error js2-mode-map)
(setq js2-basic-offset 2 js2-include-node-externs t 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)