Created
May 28, 2020 16:53
-
-
Save jordangarrison/8720cf98126a1a64890b2f18c1bc69f5 to your computer and use it in GitHub Desktop.
Python Black Formatter with Emacs Doom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Python Black Formatter | |
;; package.el | |
(package! python-black) | |
;; config.el | |
(use-package! python-black | |
:demand t | |
:after python) | |
(add-hook! 'python-mode-hook #'python-black-on-save-mode) | |
;; Feel free to throw your own personal keybindings here | |
(map! :leader :desc "Blacken Buffer" "m b b" #'python-black-buffer) | |
(map! :leader :desc "Blacken Region" "m b r" #'python-black-region) | |
(map! :leader :desc "Blacken Statement" "m b s" #'python-black-statement) |
Thank you! As a tweak, you can stick the configuration stuff under the :config part of use-package!:
(use-package! python-black
:demand t
:after python
:config
(add-hook! 'python-mode-hook #'python-black-on-save-mode)
;; Feel free to throw your own personal keybindings here
(map! :leader :desc "Blacken Buffer" "m b b" #'python-black-buffer)
(map! :leader :desc "Blacken Region" "m b r" #'python-black-region)
(map! :leader :desc "Blacken Statement" "m b s" #'python-black-statement)
)
Thank you @jordangarrison and @roryk. I also needed a doom/reload
afterwards.
@roryk @jordangarrison thank you for sharing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks for sharing!