feat(emacs): add global yapf

This commit is contained in:
Pavel Korytov 2021-05-08 17:23:37 +03:00
parent 9b8459b587
commit b576436028
3 changed files with 16 additions and 2 deletions

5
.config/yapf/style Normal file
View file

@ -0,0 +1,5 @@
; [[file:../../Emacs.org::*yapf][yapf:2]]
[style]
based_on_style = facebook
column_limit = 80
; yapf:2 ends here

View file

@ -1929,7 +1929,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
:keymaps 'python-mode-map
"rr" (lambda ()
(interactive)
(py-isort-buffer)
(unless (and (fboundp #'org-src-edit-buffer-p) (org-src-edit-buffer-p))
(py-isort-buffer))
(yapfify-buffer)))
(use-package sphinx-doc

View file

@ -2915,6 +2915,13 @@ References:
yapfify-region-or-buffer
yapf-mode))
#+end_src
Global config:
#+begin_src conf-windows :tangle .config/yapf/style :comments link
[style]
based_on_style = facebook
column_limit = 80
#+end_src
*** isort
[[https://github.com/PyCQA/isort][isort]] is a Python package to sort Python imports.
@ -2934,7 +2941,8 @@ The following bindings calls yapf & isort on the buffer
:keymaps 'python-mode-map
"rr" (lambda ()
(interactive)
(py-isort-buffer)
(unless (and (fboundp #'org-src-edit-buffer-p) (org-src-edit-buffer-p))
(py-isort-buffer))
(yapfify-buffer)))
#+end_src
*** sphinx-doc