arch/roles/dots/files/home/.emacs.d/lan/python-cf.org

71 lines
1.6 KiB
Org Mode
Raw Normal View History

2024-09-04 00:54:15 +06:00
* python
2024-10-27 00:29:18 +06:00
** init
2024-09-04 00:54:15 +06:00
#+begin_src emacs-lisp
(require 'use-package)
#+end_src
** tree-sitter
#+begin_src emacs-lisp
(add-hook 'python-mode-hook #'tree-sitter-mode +1)
(add-hook 'python-mode-hook #'tree-sitter-hl-mode +1)
#+end_src
** LINT
#+begin_src emacs-lisp
(use-package flycheck
:ensure t
:init
(global-flycheck-mode)
:config
(setq-default flycheck-disabled-checkers '(lsp))
(setq flycheck-python-flake8-executable "flake8")
(setq flycheck-python-pylint-executable "pylint")
2025-04-18 21:40:38 +06:00
;; (flycheck-add-next-checker 'python-flake8 'python-pylint)
2024-09-04 00:54:15 +06:00
)
2024-10-27 00:29:18 +06:00
2025-04-18 21:40:38 +06:00
#+end_src
** приоритетный линтер
#+begin_src emacs-lisp
(defun my/projectile-set-flycheck-checker ()
(when (projectile-project-p)
(setq-local flycheck-checker 'python-pyright))) ;; замените на нужный
2024-10-27 00:29:18 +06:00
2025-04-18 21:40:38 +06:00
(add-hook 'python-mode-hook #'my/projectile-set-flycheck-checker)
2024-09-04 00:54:15 +06:00
#+end_src
#+begin_src emacs-lisp
(use-package python
:hook (python-mode . (lambda ()
(flycheck-mode)
)))
#+end_src
2025-04-26 11:41:01 +06:00
** lsp elpy
2024-09-04 00:54:15 +06:00
#+begin_src emacs-lisp
2025-04-26 11:41:01 +06:00
;; (use-package elpy
;; :ensure t
;; :init
;; (elpy-enable))
;; (add-hook 'elpy-mode-hook (lambda () (highlight-indentation-mode -1)))
(use-package lsp-mode
2024-09-04 00:54:15 +06:00
:ensure t
2025-04-26 11:41:01 +06:00
:hook (python-mode . lsp)
:commands lsp)
(use-package lsp-pyright
:ensure t
:after lsp-mode
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
)))
2024-09-04 00:54:15 +06:00
#+end_src
2024-10-27 00:29:18 +06:00
* Cheat sheet
** elpy
Search the buffer for a list of definitions of classes and functions.
C-c C-o (elpy-occur-definitions)