fix(emacs): configure python-ts-mode
This commit is contained in:
parent
8031caaae4
commit
2f13104b81
1 changed files with 9 additions and 4 deletions
|
@ -132,12 +132,15 @@
|
||||||
("\\.jsx\\'" . tsx-ts-mode)
|
("\\.jsx\\'" . tsx-ts-mode)
|
||||||
("\\.json\\'" . json-ts-mode)
|
("\\.json\\'" . json-ts-mode)
|
||||||
("\\.typ\\'" . typst-ts-mode)
|
("\\.typ\\'" . typst-ts-mode)
|
||||||
("\\.gleam\\'" . gleam-ts-mode))
|
("\\.gleam\\'" . gleam-ts-mode)
|
||||||
|
("\\.py\\'" . python-ts-mode))
|
||||||
:hook
|
:hook
|
||||||
((tsx-ts-mode . electric-pair-local-mode)
|
((tsx-ts-mode . electric-pair-local-mode)
|
||||||
(tsx-ts-mode . electric-indent-local-mode)
|
(tsx-ts-mode . electric-indent-local-mode)
|
||||||
(typescript-ts-mode . electric-pair-local-mode)
|
(typescript-ts-mode . electric-pair-local-mode)
|
||||||
(typescript-ts-mode . electric-indent-local-mode))
|
(typescript-ts-mode . electric-indent-local-mode)
|
||||||
|
(python-ts-mode . electric-pair-local-mode)
|
||||||
|
(python-ts-mode . electric-indent-local-mode))
|
||||||
:preface
|
:preface
|
||||||
(defun os/setup-install-grammars ()
|
(defun os/setup-install-grammars ()
|
||||||
"Install Tree-sitter grammars if they are absent."
|
"Install Tree-sitter grammars if they are absent."
|
||||||
|
@ -149,7 +152,8 @@
|
||||||
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "tsx/src"))
|
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "tsx/src"))
|
||||||
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "typescript/src"))
|
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "typescript/src"))
|
||||||
(typst "https://github.com/uben0/tree-sitter-typst")
|
(typst "https://github.com/uben0/tree-sitter-typst")
|
||||||
(gleam "https://github.com/gleam-lang/tree-sitter-gleam")))
|
(gleam "https://github.com/gleam-lang/tree-sitter-gleam")
|
||||||
|
(python "https://github.com/tree-sitter/tree-sitter-python")))
|
||||||
(add-to-list 'treesit-language-source-alist grammar)
|
(add-to-list 'treesit-language-source-alist grammar)
|
||||||
(unless (treesit-language-available-p (car grammar))
|
(unless (treesit-language-available-p (car grammar))
|
||||||
(treesit-install-language-grammar (car grammar)))))
|
(treesit-install-language-grammar (car grammar)))))
|
||||||
|
@ -160,7 +164,8 @@
|
||||||
(js2-mode . typescript-ts-mode)
|
(js2-mode . typescript-ts-mode)
|
||||||
(css-mode . css-ts-mode)
|
(css-mode . css-ts-mode)
|
||||||
(json-mode . json-ts-mode)
|
(json-mode . json-ts-mode)
|
||||||
(js-json-mode . json-ts-mode)))
|
(js-json-mode . json-ts-mode)
|
||||||
|
(python-mode . python-ts-mode)))
|
||||||
(add-to-list 'major-mode-remap-alist mapping))
|
(add-to-list 'major-mode-remap-alist mapping))
|
||||||
:config
|
:config
|
||||||
(os/setup-install-grammars))
|
(os/setup-install-grammars))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue