Python support
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
|
||||
(use-package cc-mode
|
||||
:ensure nil
|
||||
:init (setq-default c-basic-offset 4))
|
||||
:init (setq-default c-basic-offset 2))
|
||||
|
||||
(when (treesit-available-p)
|
||||
(use-package c-ts-mode
|
||||
:ensure nil
|
||||
:functions centaur-treesit-available-p
|
||||
:init
|
||||
(setq c-ts-mode-indent-offset 4)
|
||||
(setq c-ts-mode-indent-offset 2)
|
||||
|
||||
(when (boundp 'major-mode-remap-alist)
|
||||
(add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
|
||||
@@ -16,10 +17,10 @@
|
||||
(add-to-list 'major-mode-remap-alist
|
||||
'(c-or-c++-mode . c-or-c++-ts-mode)))))
|
||||
|
||||
(use-package eglot
|
||||
:hook (c-mode . eglot-ensure)
|
||||
:hook (c++-mode . eglot-ensure)
|
||||
:config
|
||||
(with-eval-after-load 'eglot
|
||||
(add-hook 'c-ts-mode-hook #'eglot-ensure)
|
||||
(add-hook 'c++-ts-mode-hook #'eglot-ensure)
|
||||
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")))
|
||||
|
||||
|
||||
(provide 'init-cc)
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
;; Optionally use the `orderless' completion style.
|
||||
(use-package orderless
|
||||
:custom
|
||||
(completion-styles '(orderless basic))
|
||||
(completion-styles '(orderless partial-completion basic))
|
||||
(completion-category-defaults nil)
|
||||
(completion-category-overrides '((file (styles basic partial-completion))))
|
||||
(completion-category-overrides nil)
|
||||
(orderless-component-separator #'orderless-escapable-split-on-space))
|
||||
|
||||
;; Support Pinyin
|
||||
@@ -149,6 +149,23 @@
|
||||
;; setting is useful beyond Corfu.
|
||||
(read-extended-command-predicate #'command-completion-default-include-p))
|
||||
|
||||
(use-package cape
|
||||
:init
|
||||
;; Add `completion-at-point-functions', used by `completion-at-point'.
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-history)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-keyword)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-tex)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-sgml)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-rfc1345)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-abbrev)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-ispell)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-dict)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-symbol)
|
||||
;;(add-to-list 'completion-at-point-functions #'cape-line)
|
||||
)
|
||||
|
||||
(provide 'init-completion)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
@@ -12,12 +12,18 @@
|
||||
eglot-send-changes-idle-time 0.5))
|
||||
|
||||
(use-package eglot-booster
|
||||
:after eglot
|
||||
:config (eglot-booster-mode))
|
||||
:ensure (eglot-booster :type git :host nil :repo "https://github.com/jdtsmith/eglot-booster")
|
||||
:after eglot
|
||||
:config (eglot-booster-mode))
|
||||
|
||||
(use-package consult-eglot
|
||||
:after consult eglot
|
||||
:bind (:map eglot-mode-map
|
||||
("C-M-." . consult-eglot-symbols)))
|
||||
("C-M-." . consult-eglot-symbols))
|
||||
:config
|
||||
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
|
||||
|
||||
(with-eval-after-load 'eglot
|
||||
(setq completion-category-defaults nil))
|
||||
|
||||
(provide 'init-lsp)
|
||||
|
||||
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