prettier / prettier-emacs

Minor mode to format JS code on file save
http://jlongster.com/A-Prettier-Formatter
372 stars 53 forks source link

Disable formatting on save #55

Closed chrisalcantara closed 5 years ago

chrisalcantara commented 5 years ago

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

rcoedo commented 5 years ago

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

chrisalcantara commented 5 years ago

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.

chrisalcantara commented 5 years ago

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