Support emacs29 python-ts-mode

This commit is contained in:
Michael Eliachevitch 2022-12-16 15:00:16 +01:00 committed by Youmu
parent b7a75062a6
commit c8469f5c72
1 changed files with 8 additions and 4 deletions

View File

@ -30,7 +30,9 @@
(require 'evil-collection)
(require 'python)
(defconst evil-collection-python-maps '(python-mode-map))
(defconst evil-collection-python-maps '(python-mode-map
python-ts-mode-map
python-base-mode-map))
(defun evil-collection-python-set-evil-shift-width ()
"Set `evil-shift-width' according to `python-indent-offset'."
@ -39,10 +41,12 @@
;;;###autoload
(defun evil-collection-python-setup ()
"Set up `evil' bindings for `python'."
(add-hook 'python-mode-hook #'evil-collection-python-set-evil-shift-width)
(dolist (hook '(python-mode-hook python-ts-mode-hook))
(add-hook hook #'evil-collection-python-set-evil-shift-width))
(evil-collection-define-key 'normal 'python-mode-map
"gz" 'python-shell-switch-to-shell))
(dolist (kmap evil-collection-python-maps)
(evil-collection-define-key 'normal kmap
"gz" 'python-shell-switch-to-shell)))
(provide 'evil-collection-python)
;;; evil-collection-python.el ends here