This commit is contained in:
Mars 2024-11-12 22:36:49 -05:00
parent 55a91359ab
commit d310899d4c
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895

View file

@ -328,26 +328,31 @@
:config (eglot-booster-mode)) :config (eglot-booster-mode))
(use-package php-mode (use-package php-mode
:ensure t) :ensure t
:mode ("\\.php\\'" . php-mode))
(use-package web-mode (use-package web-mode
:ensure t
:mode :mode
(("\\.phtml\\'" . web-mode) (".twig$" ".html?$" ".hbs$" ".vue$" ".lade.php$")
("\\.php\\'" . web-mode)
("\\.tpl\\'" . web-mode)
("\\.[agj]sp\\'" . web-mode)
("\\.as[cp]x\\'" . web-mode)
("\\.erb\\'" . web-mode)
("\\.mustache\\'" . web-mode)
("\\.djhtml\\'" . web-mode))
:config :config
(setq web-mode-markup-indent-offset 2 (setq
web-mode-code-indent-offset 2 web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2) web-mode-css-indent-offset 2
web-mode-engines-alist web-mode-code-indent-offset 2
'(("php" . "\\.phtml\\'") web-mode-style-padding 2
("blade" . "\\.blade\\."))) web-mode-script-padding 2
web-mode-enable-auto-closing t
web-mode-enable-auto-opening t
web-mode-enable-auto-pairing t
web-mode-enable-auto-indentation t)
(dolist (alist web-mode-engines-auto-pairs)
(setcdr alist
(cl-loop for pair in (cdr alist)
unless (string-match-p "^[a-z-]" (cdr pair))
collect (cons (car pair)
(string-trim-right (cdr pair)
"\\(?:>\\|]\\|}\\)+\\'"))))))
(use-package eglot (use-package eglot
:ensure nil :ensure nil
@ -355,17 +360,17 @@
(defun my-eglot-rename (newname) (defun my-eglot-rename (newname)
"Rename the current symbol to NEWNAME with initial input a." "Rename the current symbol to NEWNAME with initial input a."
(interactive (interactive
(list (read-from-minibuffer (list (read-from-minibuffer
(format "Rename `%s' to: " (or (thing-at-point 'symbol t) (format "Rename `%s' to: " (or (thing-at-point 'symbol t)
(error "no symbol at point"))) (error "no symbol at point")))
(or (thing-at-point 'symbol t) "") nil nil nil (or (thing-at-point 'symbol t) "") nil nil nil
(symbol-name (symbol-at-point))))) (symbol-name (symbol-at-point)))))
(eglot--server-capable-or-lose :renameProvider) (eglot--server-capable-or-lose :renameProvider)
(eglot--apply-workspace-edit (eglot--apply-workspace-edit
(jsonrpc-request (eglot--current-server-or-lose) (jsonrpc-request (eglot--current-server-or-lose)
:textDocument/rename `(,@(eglot--TextDocumentPositionParams) :textDocument/rename `(,@(eglot--TextDocumentPositionParams)
:newName ,newname)) :newName ,newname))
current-prefix-arg)) current-prefix-arg))
(fset #'jsonrpc--log-event #'ignore) (fset #'jsonrpc--log-event #'ignore)
(setopt eglot-events-buffer-size 0) (setopt eglot-events-buffer-size 0)
(defun eglot-format-buffer-on-save () (defun eglot-format-buffer-on-save ()
@ -374,9 +379,9 @@
(add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save) (add-hook 'eglot-managed-mode-hook #'eglot-format-buffer-on-save)
(setq eglot-server-programs (setq eglot-server-programs
`(,@eglot-server-programs `(,@eglot-server-programs
'(nix-mode . ("nixd")) '(nix-mode . ("nixd"))
'(php-mode . ("phpactor" "language-server")) '(php-mode . ("phpactor" "language-server"))
'(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never")))) '(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never"))))
:hook :hook
(c++-mode . eglot-ensure) (c++-mode . eglot-ensure)
(c-mode . eglot-ensure) (c-mode . eglot-ensure)
@ -442,10 +447,10 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package tree-sitter (use-package tree-sitter
:ensure t :ensure t
:hook
(prog-mode . tree-sitter-hl-mode)
:config :config
(global-tree-sitter-mode)) (global-tree-sitter-mode)
;; Disable tree-sitter in web-mode
(add-hook 'web-mode-hook (lambda () (tree-sitter-mode -1))))
(use-package tree-sitter-langs (use-package tree-sitter-langs
:ensure t) :ensure t)
@ -707,3 +712,10 @@
(add-hook 'eglot-managed-mode-hook #'flymake-mode) (add-hook 'eglot-managed-mode-hook #'flymake-mode)
#+end_src #+end_src
** Olivetti
#+begin_src emacs-lisp
(use-package olivetti
:ensure t)
#+end_src