From b9852d2942e551d835d7a18984e73d73cd826601 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Tue, 9 Jan 2024 01:35:55 -0800 Subject: [PATCH] Add web stuff --- init.el | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/init.el b/init.el index e828f2d..e0f1a06 100644 --- a/init.el +++ b/init.el @@ -436,9 +436,7 @@ visual states." ;; eglot (use-package eglot :demand t - :hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode python-ts-mode - latex-mode markdown-mode blueprint-ts-mode) . eglot-ensure) - (eglot-managed-mode . my/-eglot-setup)) + :hook (eglot-managed-mode . my/-eglot-setup) :init (defvar my/-eglot-documentation-buffer nil "Buffer for showing documentation for `my/eglot-documentation-at-point'.") @@ -590,13 +588,28 @@ COMMAND and COMINT are like `compile'." `(,(concat (regexp-opt '("gschema" "gresource" "ui")) "\\'") . nxml-mode))) +;; (La)TeX +(use-package tex-mode + :hook (latex-mode . eglot-ensure)) + ;; blueprint (use-package blueprint-ts-mode + :hook (blueprint-ts-mode . eglot-ensure) :after eglot) +;; python-ts-mode +(use-package python-ts-mode + :ensure nil + :hook (python-ts-mode . eglot-ensure)) + +;; java-ts-mode +(use-package java-ts-mode + :hook (java-ts-mode . eglot-ensure)) + ;; c-ts-mode (use-package c-ts-mode :after evil + :hook ((c-ts-mode c++-ts-mode) . eglot-ensure) :bind (:map c-ts-mode-map ("C-c d" . realgud:gdb) :map c++-ts-mode-map @@ -616,12 +629,43 @@ COMMAND and COMINT are like `compile'." "go" #'ff-find-other-file "gO" #'ff-find-other-file-other-window)) +;; php-mode +(use-package php-mode + :hook (php-mode . eglot-ensure)) + +;; web-mode +(use-package web-mode + :hook (web-mode . eglot-ensure) + :init + (add-to-list 'eglot-server-programs + '(web-mode . ("vscode-html-language-server" "--stdio")))) + +;; Polymode +(use-package polymode + :config + (define-hostmode my/poly-web-hostmode + :mode 'web-mode) + (define-innermode my/poly-php-innermode + :mode 'php-mode + :head-matcher "\<\?php" + :tail-matcher "\?\>" + :head-mode 'body + :tail-mode 'body) + (define-polymode my/poly-web-mode + :hostmode 'my/poly-web-hostmode + :innermodes '(my/poly-php-innermode)) + (add-to-list 'auto-mode-alist '("\\.php\\|\\.phtml\\'" . my/poly-web-mode))) + ;; rust (use-package rust-mode) +(use-package rust-ts-mode + :ensure nil + :hook (rust-ts-mode . eglot-ensure)) ;; markdown (use-package markdown-mode - :hook (markdown-mode . auto-fill-mode)) + :hook ((markdown-mode . auto-fill-mode) + (markdown-mode . eglot-ensure))) ;; groovy (use-package groovy-mode)