prettier / prettier-emacs

Minor mode to format JS code on file save

Home Page:http://jlongster.com/A-Prettier-Formatter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable formatting on save

chrisalcantara opened this issue · comments

I'd like to bind prettier-js to a shortcut instead of having the minor mode run the command on save. Is this possible?

It is, just don't enable the mode at all and bind the shortcut to the prettier-js function.

I tried that but get the following error:

Wrong type argument: commandp, prettier-js.

This is what my keybinding looks like:

(eval-after-load 'js2-mode '(define-key js2-mode-map (kbd "C-c C-c") 'prettier-js))

The shortcut does work as expected if I enable then disable prettier-js-mode in the buffer. Obviously, that is not ideal.

Closing. I solved the issue by loading my own version of prettier-emacs and commenting out the autoload function.