From 5a2ea9e79948220522060539f52e69150d442da7 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 27 Nov 2019 10:12:56 -0500 Subject: [PATCH] Add command to reformat JS --- emacs/init.org | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/emacs/init.org b/emacs/init.org index a46b60b..f2195f9 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1479,6 +1479,15 @@ Use nvm to manage node versions: :commands (nvm-use nvm-use-for nvm-use-for-buffer)) #+END_SRC +A command to format JS via prettier: +#+BEGIN_SRC emacs-lisp + (defun prettier () + (interactive) + (let ((start (if (use-region-p) (region-beginning) (point-min))) + (end (if (use-region-p) (region-end) (point-max)))) + (shell-command-on-region start end "prettier --parser babel" nil t))) +#+END_SRC + * LSP Mode Emacs support for the Language Server Protocol