This commit is contained in:
Mars 2024-11-07 00:51:50 -05:00
parent 91715bbf93
commit 55a91359ab
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895
2 changed files with 58 additions and 29 deletions

View file

@ -297,6 +297,17 @@
(dolist (mode '(prog-mode org-mode)) (dolist (mode '(prog-mode org-mode))
(ligature-set-ligatures mode common-ligatures))) (ligature-set-ligatures mode common-ligatures)))
(global-ligature-mode t)) (global-ligature-mode t))
(defun my-c++-ligatures ()
"Display `-> void` as `◇` in C++ buffers."
(font-lock-add-keywords
nil
'(("-> void" ;; Match pattern
(0 (progn
(compose-region (match-beginning 0) (match-end 0) "◇")
nil))))))
(add-hook 'c++-mode-hook #'my-c++-ligatures)
#+end_src #+end_src
** LSP ** LSP
@ -316,6 +327,28 @@
:ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster") :ensure (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster")
:config (eglot-booster-mode)) :config (eglot-booster-mode))
(use-package php-mode
:ensure t)
(use-package web-mode
:ensure t
:mode
(("\\.phtml\\'" . web-mode)
("\\.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
(setq web-mode-markup-indent-offset 2
web-mode-code-indent-offset 2
web-mode-css-indent-offset 2)
web-mode-engines-alist
'(("php" . "\\.phtml\\'")
("blade" . "\\.blade\\.")))
(use-package eglot (use-package eglot
:ensure nil :ensure nil
:config :config
@ -342,26 +375,23 @@
(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"))
'(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never")))) '(c++-mode . ("clangd" "--clang-tidy" "--completion-style=detailed" "--header-insertion=never"))))
:hook :hook
(rust-mode . eglot-ensure) (c++-mode . eglot-ensure)
(rust-ts-mode . eglot-ensure) (c-mode . eglot-ensure)
(sh-script-mode . eglot-ensure) (c++-ts-mode . eglot-ensure)
(python-mode . eglot-ensure) (c-ts-mode . eglot-ensure)
(python-ts-mode . eglot-ensure) (go-mode . eglot-ensure)
(go-ts-mode . eglot-ensure)
(json-mode . eglot-ensure) (json-mode . eglot-ensure)
(json-ts-mode . eglot-ensure) (json-ts-mode . eglot-ensure)
(nix-mode . eglot-ensure) (nix-mode . eglot-ensure)
(yaml-mode . eglot-ensure) (php-mode . eglot-ensure)
(yaml-ts-mode . eglot-ensure)
(c-mode . eglot-ensure)
(c-ts-mode . eglot-ensure)
(c++-mode . eglot-ensure)
(c++-ts-mode . eglot-ensure)
(c3-ts-mode . eglot-ensure)
(rust-mode . eglot-ensure) (rust-mode . eglot-ensure)
(go-mode . eglot-ensure) (rust-ts-mode . eglot-ensure)
(go-ts-mode . eglot-ensure)) (yaml-mode . eglot-ensure)
(yaml-ts-mode . eglot-ensure))
(add-hook 'c-mode-hook 'hide-ifdef-mode) (add-hook 'c-mode-hook 'hide-ifdef-mode)
(add-hook 'c++-mode-hook 'hide-ifdef-mode) (add-hook 'c++-mode-hook 'hide-ifdef-mode)

29
init.el
View file

@ -1,5 +1,5 @@
(setq elpaca-core-date '(20240911)) (setq elpaca-core-date '(20240911))
(defvar elpaca-installer-version 0.7) (defvar elpaca-installer-version 0.8)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) (defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) (defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) (defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
@ -16,18 +16,18 @@
(make-directory repo t) (make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x)) (when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err (condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) (if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone" ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let ((depth (plist-get order :depth))) ,@(when-let* ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch")) (list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo)))) ,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout" ((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--")))) (or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name)) (emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)"))) "--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca)) ((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo))) ((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer)) (progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string)))) (error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive)))) ((error) (warn "%s" err) (delete-directory repo 'recursive))))
@ -46,5 +46,4 @@
(org-babel-load-file (org-babel-load-file
(expand-file-name "config.org" (expand-file-name "config.org"
user-emacs-directory)) user-emacs-directory))