Python support
This commit is contained in:
31
lisp/init-python.el
Normal file
31
lisp/init-python.el
Normal file
@@ -0,0 +1,31 @@
|
||||
;; -*- lexical-binding: t; -*-
|
||||
|
||||
;; Python Mode
|
||||
;; Install: pip install pyflakes autopep8
|
||||
(use-package python
|
||||
:ensure nil
|
||||
:functions exec-path-from-shell-copy-env
|
||||
:hook (inferior-python-mode . (lambda ()
|
||||
(process-query-on-exit-flag
|
||||
(get-process "Python"))))
|
||||
:init
|
||||
;; Disable readline based native completion
|
||||
(setq python-shell-completion-native-enable nil)
|
||||
:config
|
||||
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
|
||||
;; Default to Python 3. Prefer the versioned Python binaries since some
|
||||
;; systems stupidly make the unversioned one point at Python 2.
|
||||
(when (and (executable-find "python3")
|
||||
(string= python-shell-interpreter "python"))
|
||||
(setq python-shell-interpreter "python3"))
|
||||
|
||||
;; Env vars
|
||||
(with-eval-after-load 'exec-path-from-shell
|
||||
(exec-path-from-shell-copy-env "PYTHONPATH")))
|
||||
|
||||
(with-eval-after-load 'eglot
|
||||
(add-hook 'python-ts-mode-hook #'eglot-ensure)
|
||||
(add-to-list 'eglot-server-programs '((python-mode python-ts-mode) . ("pyright-langserver" "--stdio"))))
|
||||
|
||||
|
||||
(provide 'init-python)
|
||||
Reference in New Issue
Block a user