built-in treesit config
This commit is contained in:
7 files changed
+27
-8
No files matched your search
@@ -106,6 +106,7 @@ If freezing sometimes, decrease it. If stuttering, increase it.")
|
|||||||
|
|
||||||
|
|
||||||
(require 'init-built-in)
|
(require 'init-built-in)
|
||||||
|
(require 'init-treesit)
|
||||||
(require 'init-modeline)
|
(require 'init-modeline)
|
||||||
(require 'init-git)
|
(require 'init-git)
|
||||||
(require 'init-awesome-pair)
|
(require 'init-awesome-pair)
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
;; json mode is derived from `js-mode', but json file don't need `eglot'
|
;; json mode is derived from `js-mode', but json file don't need `eglot'
|
||||||
(add-hook 'js-mode-hook
|
(add-hook 'js-base-mode-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(unless (derived-mode-p 'js-json-mode 'json-mode)
|
(unless (derived-mode-p 'js-json-mode 'json-mode)
|
||||||
(eglot-ensure))))
|
(eglot-ensure))))
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
(mode . js-mode)
|
(mode . js-mode)
|
||||||
(mode . js-jsx-mode)))
|
(mode . js-jsx-mode)))
|
||||||
("TSX" (or (mode . typescript-tsx-mode)
|
("TSX" (or (mode . typescript-tsx-mode)
|
||||||
(basename . "^.*\\.tsx$")))
|
(basename . "^.*\\.tsx$")))
|
||||||
("Web" (mode . web-mode))
|
("Web" (mode . web-mode))
|
||||||
|
|
||||||
("eglot" (name . "^\\*EGLOT.*events\\*$"))
|
("eglot" (name . "^\\*EGLOT.*events\\*$"))
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
(autoload 'markdown-mode "markdown-mode"
|
(autoload 'markdown-mode "markdown-mode"
|
||||||
"Major mode for editing Markdown files" t)
|
"Major mode for editing Markdown files" t)
|
||||||
(add-to-list 'auto-mode-alist
|
(add-to-list 'auto-mode-alist
|
||||||
'("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode))
|
'("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode))
|
||||||
|
|
||||||
(autoload 'gfm-mode "markdown-mode"
|
(autoload 'gfm-mode "markdown-mode"
|
||||||
"Major mode for editing GitHub Flavored Markdown files" t)
|
"Major mode for editing GitHub Flavored Markdown files" t)
|
||||||
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
|
(add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
'(js-json-mode . creature/prettier-json-parser)))
|
'(js-json-mode . creature/prettier-json-parser)))
|
||||||
|
|
||||||
(dolist (hook '(css-mode-hook
|
(dolist (hook '(css-mode-hook
|
||||||
js-mode-hook
|
js-base-mode-hook
|
||||||
typescript-mode-hook
|
typescript-mode-hook
|
||||||
typescript-ts-base-mode-hook))
|
typescript-ts-base-mode-hook))
|
||||||
(add-hook hook #'prettier-mode))
|
(add-hook hook #'prettier-mode))
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defconst creature/treesit-available
|
||||||
|
(and (fboundp 'treesit-available-p) (treesit-available-p))
|
||||||
|
"Built-in `treesit' available.")
|
||||||
|
|
||||||
|
(when (and (fboundp 'treesit-available-p) (treesit-available-p))
|
||||||
|
(unless (featurep 'treesit) (require 'treesit))
|
||||||
|
(when (treesit-ready-p 'javascript)
|
||||||
|
(add-to-list 'major-mode-remap-alist '(js-mode . js-ts-mode))
|
||||||
|
(add-to-list 'major-mode-remap-alist '(javascript-mode . js-ts-mode))))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'init-treesit)
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||||
|
|
||||||
(unless (and (fboundp 'treesit-available-p) (treesit-available-p))
|
(if (bound-and-true-p creature/treesit-available)
|
||||||
|
(progn
|
||||||
|
(if (treesit-ready-p 'typescript)
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)))
|
||||||
|
(if (treesit-ready-p 'tsx)
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode))))
|
||||||
|
|
||||||
(add-subdirs-to-load-path (expand-file-name "optional-pkg" creature/config-dir))
|
(add-subdirs-to-load-path (expand-file-name "optional-pkg" creature/config-dir))
|
||||||
(require 'typescript-mode)
|
(require 'typescript-mode)
|
||||||
|
|
||||||
@@ -22,6 +28,4 @@
|
|||||||
(add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))))
|
(add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-typescript)
|
(provide 'init-typescript)
|
||||||
Reference in new issue
Block a user