Compare commits
1 commit
6e8fbfc374
...
9b7413332e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b7413332e |
327
init.org
327
init.org
|
|
@ -60,8 +60,7 @@ tangled, and the tangled file is compiled."
|
||||||
Usually, I like to run emacs as a daemon and only ever open new emacs clients, but that often doesn't work properly and definitely doesn't work when actively working on an emacs config, so this snippet might be useful.
|
Usually, I like to run emacs as a daemon and only ever open new emacs clients, but that often doesn't work properly and definitely doesn't work when actively working on an emacs config, so this snippet might be useful.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(setq gc-cons-percentage 0.6)
|
(setq gc-cons-percentage 0.6)
|
||||||
(setq gc-cons-threshold 100000000)
|
(setq read-process-output-max (* 1024 1024)) ;; 1mb
|
||||||
(setq read-process-output-max (* 20 1024 1024)) ;; 1mb
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Use GC magic hack.
|
Use GC magic hack.
|
||||||
|
|
@ -151,7 +150,6 @@ Use =straight=, and it's bootstrapping code:
|
||||||
|
|
||||||
Disable =package.el= in the early init file:
|
Disable =package.el= in the early init file:
|
||||||
#+begin_src emacs-lisp :tangle early-init.el
|
#+begin_src emacs-lisp :tangle early-init.el
|
||||||
;; -*- lexical-binding: t; -*-
|
|
||||||
(setq package-enable-at-startup nil)
|
(setq package-enable-at-startup nil)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
@ -509,7 +507,6 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
|
||||||
;; magit uses with-editor-mode to spawn the git process
|
;; magit uses with-editor-mode to spawn the git process
|
||||||
;; in with the emacs client as the $EDITOR
|
;; in with the emacs client as the $EDITOR
|
||||||
(general-def '(emacs normal) 'with-editor-mode-map ",," 'with-editor-finish)
|
(general-def '(emacs normal) 'with-editor-mode-map ",," 'with-editor-finish)
|
||||||
(general-def '(emacs normal) 'with-editor-mode-map ",k" 'with-editor-cancel)
|
|
||||||
(leader-def
|
(leader-def
|
||||||
"<TAB>" #'nemo/switch-to-last-buffer
|
"<TAB>" #'nemo/switch-to-last-buffer
|
||||||
"<SPC>" #'completion-at-point
|
"<SPC>" #'completion-at-point
|
||||||
|
|
@ -695,10 +692,6 @@ Also use =undo-fu=, which evil can use.
|
||||||
|
|
||||||
** Projectile
|
** Projectile
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
;; pre-load built-in project to avoid conflicts when other packages import it
|
|
||||||
(use-package project
|
|
||||||
:straight (project :type built-in))
|
|
||||||
|
|
||||||
(use-package projectile
|
(use-package projectile
|
||||||
:straight t
|
:straight t
|
||||||
:defer t
|
:defer t
|
||||||
|
|
@ -1040,8 +1033,8 @@ prettify symbols for quotes and source blocks in org-mode.
|
||||||
(org-super-agenda-mode))
|
(org-super-agenda-mode))
|
||||||
|
|
||||||
(setq org-agenda-files (list "~/Shared/agenda.org"
|
(setq org-agenda-files (list "~/Shared/agenda.org"
|
||||||
"~/Shared/notes.org"
|
"~/notes.org"
|
||||||
"~/Shared/projects.org"))
|
"~/projects.org"))
|
||||||
|
|
||||||
(add-hook 'emacs-startup-hook
|
(add-hook 'emacs-startup-hook
|
||||||
(lambda () (progn (org-agenda nil "a")
|
(lambda () (progn (org-agenda nil "a")
|
||||||
|
|
@ -1123,7 +1116,7 @@ Use =vertico-posframe= to make the =vertico= buffer floating in the centre of th
|
||||||
(consult-ripgrep (:not posframe))
|
(consult-ripgrep (:not posframe))
|
||||||
(nemo/consult-ripgrep (:not posframe))
|
(nemo/consult-ripgrep (:not posframe))
|
||||||
(nemo/consult-ripgrep-dir (:not posframe))
|
(nemo/consult-ripgrep-dir (:not posframe))
|
||||||
;; (lsp-find-references (:not posframe))
|
(lsp-find-references (:not posframe))
|
||||||
(embark-act (:not posframe))
|
(embark-act (:not posframe))
|
||||||
(t posframe))
|
(t posframe))
|
||||||
))
|
))
|
||||||
|
|
@ -1203,7 +1196,7 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
|
||||||
:config
|
:config
|
||||||
(setq
|
(setq
|
||||||
company-minimum-prefix-length 1
|
company-minimum-prefix-length 1
|
||||||
company-idle-delay 0.1))
|
company-idle-delay 0.0))
|
||||||
|
|
||||||
(use-package company-box
|
(use-package company-box
|
||||||
:straight t
|
:straight t
|
||||||
|
|
@ -1224,7 +1217,7 @@ Auto-completion using =corfu=:
|
||||||
;; Enable cycling for `corfu-next/previous'
|
;; Enable cycling for `corfu-next/previous'
|
||||||
(corfu-cycle t)
|
(corfu-cycle t)
|
||||||
;; No delay
|
;; No delay
|
||||||
(corfu-auto-delay 0.1)
|
(corfu-auto-delay 0)
|
||||||
;; Start when this many characters have been typed
|
;; Start when this many characters have been typed
|
||||||
(corfu-auto-prefix 1)
|
(corfu-auto-prefix 1)
|
||||||
;; Short delay
|
;; Short delay
|
||||||
|
|
@ -1234,14 +1227,16 @@ Auto-completion using =corfu=:
|
||||||
(corfu-on-exact-match nil)
|
(corfu-on-exact-match nil)
|
||||||
;; Don't automatically fill in the selected candidate
|
;; Don't automatically fill in the selected candidate
|
||||||
(corfu-preview-current nil)
|
(corfu-preview-current nil)
|
||||||
|
:custom
|
||||||
|
(lsp-completion-provider :none)
|
||||||
:init
|
:init
|
||||||
(defun nemo/orderless-dispatch-flex-first (_pattern index _total)
|
(defun nemo/orderless-dispatch-flex-first (_pattern index _total)
|
||||||
(and (eq index 0) 'orderless-flex))
|
(and (eq index 0) 'orderless-flex))
|
||||||
|
|
||||||
;; (defun nemo/lsp-mode-setup-completion ()
|
(defun nemo/lsp-mode-setup-completion ()
|
||||||
;; (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) '(orderless))
|
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) '(orderless))
|
||||||
;; (add-hook 'orderless-style-dispatchers #'nemo/orderless-dispatch-flex-first nil 'local))
|
(add-hook 'orderless-style-dispatchers #'nemo/orderless-dispatch-flex-first nil 'local))
|
||||||
;; :hook (lsp-completion-mode . nemo/lsp-mode-setup-completion)
|
:hook (lsp-completion-mode . nemo/lsp-mode-setup-completion)
|
||||||
:config
|
:config
|
||||||
(global-corfu-mode))
|
(global-corfu-mode))
|
||||||
|
|
||||||
|
|
@ -1438,13 +1433,6 @@ Use =inheritenv= and =envrc= to load ~.envrc~ direnv files:
|
||||||
("M-<tab>" . 'copilot-accept-completion-by-word)
|
("M-<tab>" . 'copilot-accept-completion-by-word)
|
||||||
("C-S-<tab>" . 'copilot-accept-completion-by-line)
|
("C-S-<tab>" . 'copilot-accept-completion-by-line)
|
||||||
)
|
)
|
||||||
:config
|
|
||||||
(setq copilot-indent-offset-warning-disable t)
|
|
||||||
(add-to-list 'copilot-indentation-alist '(org-mode 2))
|
|
||||||
(add-to-list 'copilot-indentation-alist '(nix-mode 2))
|
|
||||||
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2))
|
|
||||||
(add-to-list 'copilot-indentation-alist '(prog-mode 2))
|
|
||||||
(add-to-list 'copilot-indentation-alist '(text-mode 2))
|
|
||||||
)
|
)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
@ -1586,9 +1574,7 @@ I feel so bad for this.. but its not awful..
|
||||||
:straight t
|
:straight t
|
||||||
:defer t
|
:defer t
|
||||||
:hook (after-init. global-flycheck-mode)
|
:hook (after-init. global-flycheck-mode)
|
||||||
:config
|
:config)
|
||||||
(setq flycheck-emacs-lisp-load-path 'inherit)
|
|
||||||
)
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Yasnippet
|
** Yasnippet
|
||||||
|
|
@ -1603,107 +1589,7 @@ Auto-completion requires yasnippet for some competions, such as function argumen
|
||||||
:straight t)
|
:straight t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Format-On-Save
|
** LSP
|
||||||
build formatting on save functionality:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defvar-local nemo/lsp-format-on-save t)
|
|
||||||
(defvar nemo/lsp-format-on-save-function #'eglot-format)
|
|
||||||
|
|
||||||
(define-minor-mode nemo/lsp-format-on-save-mode
|
|
||||||
"Run lsp-format-buffer on save."
|
|
||||||
:lighter " fmt"
|
|
||||||
(if nemo/lsp-format-on-save-mode
|
|
||||||
(add-hook 'before-save-hook nemo/lsp-format-on-save-function nil t)
|
|
||||||
(remove-hook 'before-save-hook nemo/lsp-format-on-save-function nil t)
|
|
||||||
))
|
|
||||||
|
|
||||||
(defun nemo/do-lsp-format-on-save ()
|
|
||||||
"Format on save using LSP server."
|
|
||||||
(if nemo/lsp-format-on-save
|
|
||||||
(nemo/lsp-format-on-save-function)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Eglot
|
|
||||||
Use =eglot= as an alternative to =lsp-mode=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package eglot
|
|
||||||
:straight t
|
|
||||||
:hook ((rust-mode nix-mode prog-mode) . eglot-ensure)
|
|
||||||
:config
|
|
||||||
(add-to-list
|
|
||||||
'eglot-server-programs
|
|
||||||
'(rust-mode
|
|
||||||
"rust-analyzer"))
|
|
||||||
(setq-default eglot-workspace-configuration
|
|
||||||
'(:rust-analyzer
|
|
||||||
(:cargo (:buildScripts (:enable t)
|
|
||||||
:allFeatures t
|
|
||||||
:features "all"
|
|
||||||
:extraEnv (:RUSTFLAGS "-Clinker=clang -Clink-arg=-fuse-ld=mold"))
|
|
||||||
:check (:command "clippy")
|
|
||||||
:completion (:autoimport (:enable t))
|
|
||||||
:inlayHints (
|
|
||||||
;; :maxLength 20
|
|
||||||
:bindingModeHints (:enable t)
|
|
||||||
:closureReturnTypeHints (:enable t))
|
|
||||||
:procMacro (:enable t)))
|
|
||||||
)
|
|
||||||
(setq eglot-code-action-indications '(margin mode-line)
|
|
||||||
eglot-extend-to-xref t
|
|
||||||
completion-category-overrides '((eglot (styles orderless))
|
|
||||||
(eglot-capf (styles orderless)))
|
|
||||||
flymake-show-diagnostics-at-end-of-line 'fancy
|
|
||||||
)
|
|
||||||
(with-eval-after-load 'eglot
|
|
||||||
(setq completion-category-defaults nil))
|
|
||||||
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
|
|
||||||
:general-config
|
|
||||||
(general-define-key
|
|
||||||
:prefix-map 'nemo/eglot-command-map
|
|
||||||
"r r" '("Rename" . eglot-rename)
|
|
||||||
"a a" '("Code Action" . eglot-code-action-quickfix)
|
|
||||||
"a A" '("Code Action (all)" . eglot-code-actions)
|
|
||||||
"g d" '("Go to Definition" . xref-find-definitions)
|
|
||||||
"g r" '("Go to References" . xref-find-references)
|
|
||||||
"g g" '("Go to Declaration" . eglot-find-declaration)
|
|
||||||
"g i" '("Go to Implementation" . eglot-find-implementation)
|
|
||||||
"g t" '("Go to Type Definition" . eglot-find-typeDefinition)
|
|
||||||
"h h" '("Help" . eldoc-box-help-at-point)
|
|
||||||
"w r" '("Restart Server" . eglot-reconnect)
|
|
||||||
"w q" '("Shutdown Server" . eglot-shutdown)
|
|
||||||
"= =" '("Format Buffer" . eglot-format-buffer)
|
|
||||||
"= r" '("Format Region" . eglot-format-region)
|
|
||||||
)
|
|
||||||
(leader-major-def
|
|
||||||
:keymaps 'eglot-mode-map
|
|
||||||
"l" '(:keymap nemo/eglot-command-map :wk "Eglot")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package eldoc-box
|
|
||||||
:straight t
|
|
||||||
:hook (eglot-managed-mode . eldoc-box-hover-mode)
|
|
||||||
:hook (eldoc-box-buffer . variable-pitch-mode)
|
|
||||||
:config
|
|
||||||
(setq eldoc-box-only-multi-line t)
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package consult-eglot
|
|
||||||
:straight t
|
|
||||||
:after (consult eglot)
|
|
||||||
:config
|
|
||||||
(general-define-key
|
|
||||||
:prefix-map 'nemo/eglot-command-map
|
|
||||||
"c s" '("Symbols" . consult-eglot-symbols))
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package breadcrumb
|
|
||||||
:straight t
|
|
||||||
:hook (eglot-managed-mode . breadcrumb-mode)
|
|
||||||
)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** COMMENT LSP
|
|
||||||
Use lsp-mode and lsp-ui for LSP functionality.
|
Use lsp-mode and lsp-ui for LSP functionality.
|
||||||
Emacs has its own internal LSP client called eglot, but I've never used it and I'm relatively happy with lsp-mode.
|
Emacs has its own internal LSP client called eglot, but I've never used it and I'm relatively happy with lsp-mode.
|
||||||
LSP sets it's prefix key to =s-l= by default, which uses the Super key which I use as my Mod key in sway, so I can't use it in emacs.
|
LSP sets it's prefix key to =s-l= by default, which uses the Super key which I use as my Mod key in sway, so I can't use it in emacs.
|
||||||
|
|
@ -1716,7 +1602,7 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
|
||||||
:hook (lsp-mode . lsp-inlay-hints-mode)
|
:hook (lsp-mode . lsp-inlay-hints-mode)
|
||||||
:init
|
:init
|
||||||
(setq lsp-keymap-prefix "C-l")
|
(setq lsp-keymap-prefix "C-l")
|
||||||
;; (add-to-list 'completion-at-point-functions #'lsp-completion-at-point)
|
(add-to-list 'completion-at-point-functions #'lsp-completion-at-point)
|
||||||
;; (advice-add 'lsp :before #'envrc-reload)
|
;; (advice-add 'lsp :before #'envrc-reload)
|
||||||
:commands lsp
|
:commands lsp
|
||||||
:general-config
|
:general-config
|
||||||
|
|
@ -1725,14 +1611,14 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
|
||||||
)
|
)
|
||||||
:config
|
:config
|
||||||
(setq
|
(setq
|
||||||
lsp-idle-delay 0.2
|
lsp-idle-delay 0.5
|
||||||
lsp-inlay-hint-enable t
|
lsp-inlay-hint-enable t
|
||||||
lsp-modeline-code-actions-enable t
|
lsp-modeline-code-actions-enable t
|
||||||
lsp-modeline-code-actions-segments '(name count)
|
lsp-modeline-code-actions-segments '(name count)
|
||||||
lsp-modeline-diagnostics-enable t
|
lsp-modeline-diagnostics-enable t
|
||||||
lsp-completion-enable-additional-text-edit t
|
lsp-completion-enable-additional-text-edit t
|
||||||
|
|
||||||
lsp-completion-provider :none
|
lsp-completion-provider :capf
|
||||||
lsp-enable-snippet t
|
lsp-enable-snippet t
|
||||||
|
|
||||||
lsp-rust-server 'rust-analyzer
|
lsp-rust-server 'rust-analyzer
|
||||||
|
|
@ -1749,20 +1635,8 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
|
||||||
|
|
||||||
(setq lsp-glsl-executable '("glsl_analyzer"))
|
(setq lsp-glsl-executable '("glsl_analyzer"))
|
||||||
(add-to-list 'lsp-language-id-configuration '("CMakeLists.txt" . "cmake"))
|
(add-to-list 'lsp-language-id-configuration '("CMakeLists.txt" . "cmake"))
|
||||||
|
|
||||||
(advice-add (if (progn (require 'json)
|
|
||||||
(fboundp 'json-parse-buffer))
|
|
||||||
'json-parse-buffer
|
|
||||||
'json-read)
|
|
||||||
:around
|
|
||||||
#'lsp-booster--advice-json-parse)
|
|
||||||
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Install =consult-lsp=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package consult-lsp
|
(use-package consult-lsp
|
||||||
:straight t
|
:straight t
|
||||||
:general
|
:general
|
||||||
|
|
@ -1775,17 +1649,11 @@ Install =consult-lsp=:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Install =lsp-treemacs=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package lsp-treemacs
|
(use-package lsp-treemacs
|
||||||
:straight t
|
:straight t
|
||||||
:commands lsp-treemacs-errors-list)
|
:commands lsp-treemacs-errors-list)
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Install =lsp-ui=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package lsp-ui
|
(use-package lsp-ui
|
||||||
:config
|
:config
|
||||||
(setq
|
(setq
|
||||||
|
|
@ -1800,10 +1668,7 @@ Install =lsp-ui=:
|
||||||
; lsp-ui-doc-use-webkit t
|
; lsp-ui-doc-use-webkit t
|
||||||
)
|
)
|
||||||
:commands lsp-ui-mode)
|
:commands lsp-ui-mode)
|
||||||
#+end_src
|
|
||||||
|
|
||||||
register my own mode for formatting on save:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defvar-local nemo/lsp-format-on-save t)
|
(defvar-local nemo/lsp-format-on-save t)
|
||||||
|
|
||||||
(define-minor-mode nemo/lsp-format-on-save-mode
|
(define-minor-mode nemo/lsp-format-on-save-mode
|
||||||
|
|
@ -1820,73 +1685,14 @@ register my own mode for formatting on save:
|
||||||
(lsp-format-buffer)))
|
(lsp-format-buffer)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Improve lsp speed by using =lsp-booster=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defun lsp-booster--advice-json-parse (old-fn &rest args)
|
|
||||||
"Try to parse bytecode instead of json."
|
|
||||||
(or
|
|
||||||
(when (equal (following-char) ?#)
|
|
||||||
(let ((bytecode (read (current-buffer))))
|
|
||||||
(when (byte-code-function-p bytecode)
|
|
||||||
(funcall bytecode))))
|
|
||||||
(apply old-fn args)))
|
|
||||||
|
|
||||||
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
|
|
||||||
"Prepend emacs-lsp-booster command to lsp CMD."
|
|
||||||
(let ((orig-result (funcall old-fn cmd test?)))
|
|
||||||
(if (and (not test?) ;; for check lsp-server-present?
|
|
||||||
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
|
|
||||||
lsp-use-plists
|
|
||||||
(not (functionp 'json-rpc-connection)) ;; native json-rpc
|
|
||||||
(executable-find "emacs-lsp-booster"))
|
|
||||||
(progn
|
|
||||||
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
|
|
||||||
(setcar orig-result command-from-exec-path))
|
|
||||||
(message "Using emacs-lsp-booster for %s!" orig-result)
|
|
||||||
(cons "emacs-lsp-booster" orig-result))
|
|
||||||
orig-result)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Make lsp use plists instead of hash-tables:
|
|
||||||
#+begin_src emacs-lisp :tangle early-init.el
|
|
||||||
(setenv "LSP_USE_PLISTS" "true")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(add-to-list 'exec-path-from-shell-variables "LSP_USE_PLISTS")
|
|
||||||
#+end_src
|
|
||||||
*** Debugging
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package dap-mode
|
|
||||||
:straight t
|
|
||||||
:config
|
|
||||||
;; (require 'dap-cpptools)
|
|
||||||
;; (dap-cpptools-setup)
|
|
||||||
(require 'dap-gdb-lldb)
|
|
||||||
(dap-register-debug-template "Rust::GDB Run Configuration"
|
|
||||||
(list :type "gdb"
|
|
||||||
:request "launch"
|
|
||||||
:name "GDB::Run"
|
|
||||||
:gdbpath "rust-gdb"
|
|
||||||
:target nil
|
|
||||||
:cwd nil))
|
|
||||||
(dap-auto-configure-mode))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Graphics
|
** Graphics
|
||||||
|
|
||||||
*** WGSL/WESL with lsp-mode
|
*** WGSL/WESL
|
||||||
|
|
||||||
**** Install =wgsl-mode=:
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package wgsl-mode
|
(use-package wgsl-mode
|
||||||
:straight t
|
:straight t
|
||||||
:mode "\\.wesl\\'"
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
**** COMMENT Configure for =lsp-mode=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
:ensure lsp-mode
|
:ensure lsp-mode
|
||||||
|
:mode "\\.wesl\\'"
|
||||||
:hook (wgsl-mode . lsp-deferred)
|
:hook (wgsl-mode . lsp-deferred)
|
||||||
:init
|
:init
|
||||||
(add-to-list 'lsp-language-id-configuration '(wgsl-mode . "wgsl"))
|
(add-to-list 'lsp-language-id-configuration '(wgsl-mode . "wgsl"))
|
||||||
|
|
@ -1894,16 +1700,6 @@ Make lsp use plists instead of hash-tables:
|
||||||
:new-connection (lsp-stdio-connection "wgsl-analyzer")
|
:new-connection (lsp-stdio-connection "wgsl-analyzer")
|
||||||
:activation-fn (lsp-activate-on "wgsl")
|
:activation-fn (lsp-activate-on "wgsl")
|
||||||
:server-id 'wgsl-analyzer))
|
:server-id 'wgsl-analyzer))
|
||||||
#+end_src
|
|
||||||
|
|
||||||
**** Configure for =eglot=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
:hook (wgsl-mode . eglot-ensure)
|
|
||||||
:config
|
|
||||||
(add-to-list 'eglot-server-programs `(wgsl-mode . ("wgsl-analyzer")))
|
|
||||||
#+end_src
|
|
||||||
**** end ~use-package~ block:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
)
|
)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
@ -1927,39 +1723,32 @@ hlsl-mode:
|
||||||
)
|
)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** =slang-mode=:
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(with-eval-after-load 'lsp-mode
|
|
||||||
(progn
|
|
||||||
;; LSP
|
|
||||||
(add-to-list 'lsp-language-id-configuration '(".*\\.slang$" . "slang"))
|
|
||||||
(lsp-register-client (make-lsp-client
|
|
||||||
:new-connection (lsp-stdio-connection "slangd")
|
|
||||||
:activation-fn (lsp-activate-on "slang")
|
|
||||||
:server-id 'slang))))
|
|
||||||
|
|
||||||
(with-eval-after-load 'eglot
|
|
||||||
(progn
|
|
||||||
(add-to-list 'eglot-server-programs '(slang-ts-mode . ("slangd")))
|
|
||||||
))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
**** slang-mode
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(require 'slang-ts-mode)
|
(require 'slang-ts-mode)
|
||||||
(add-hook 'slang-ts-mode-hook (lambda () (hs-minor-mode -1)))
|
(add-hook 'slang-ts-mode-hook (lambda () (hs-minor-mode -1)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp :tangle "local-lisp/slang-ts-mode.el"
|
#+begin_src emacs-lisp :tangle "local-lisp/slang-ts-mode.el"
|
||||||
;;; -*- lexical-binding: t -*-
|
|
||||||
(require 'treesit)
|
(require 'treesit)
|
||||||
|
|
||||||
(eval-when-compile (require 'rx))
|
|
||||||
(require 'c-ts-common)
|
|
||||||
|
|
||||||
(add-to-list
|
(add-to-list
|
||||||
'treesit-language-source-alist
|
'treesit-language-source-alist
|
||||||
`(slang "https://github.com/tree-sitter-grammars/tree-sitter-slang"))
|
'(slang "https://github.com/tree-sitter-grammars/tree-sitter-slang"))
|
||||||
|
|
||||||
|
(with-eval-after-load 'lsp-mode
|
||||||
|
(progn
|
||||||
|
;; tree-sitter
|
||||||
|
|
||||||
|
;; LSP
|
||||||
|
(add-to-list 'lsp-language-id-configuration '(".*\\.slang$" . "slang"))
|
||||||
|
(lsp-register-client (make-lsp-client
|
||||||
|
:new-connection (lsp-stdio-connection "/opt/shader-slang-bin/bin/slangd")
|
||||||
|
:activation-fn (lsp-activate-on "slang")
|
||||||
|
:server-id 'slang))
|
||||||
|
))
|
||||||
|
|
||||||
|
(require 'c-ts-common)
|
||||||
|
(require 'c-ts-mode)
|
||||||
|
|
||||||
(defgroup slang nil "Khronos Slang Major Mode."
|
(defgroup slang nil "Khronos Slang Major Mode."
|
||||||
:group 'languages)
|
:group 'languages)
|
||||||
|
|
@ -2002,8 +1791,6 @@ hlsl-mode:
|
||||||
(modify-syntax-entry ?* ". 23" table)
|
(modify-syntax-entry ?* ". 23" table)
|
||||||
(modify-syntax-entry ?\n "> b" table)
|
(modify-syntax-entry ?\n "> b" table)
|
||||||
(modify-syntax-entry ?\^m "> b" table)
|
(modify-syntax-entry ?\^m "> b" table)
|
||||||
;; underscore is part of words
|
|
||||||
(modify-syntax-entry ?_ "w" table)
|
|
||||||
table)
|
table)
|
||||||
"Syntax table for `slang-ts-mode'.")
|
"Syntax table for `slang-ts-mode'.")
|
||||||
|
|
||||||
|
|
@ -2188,6 +1975,16 @@ delimiters < and >'s."
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Rust
|
** Rust
|
||||||
|
[[https://github.com/rust-lang/rust-mode][=rust-mode=]]
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
;; (use-package rust-mode
|
||||||
|
;; :straight t
|
||||||
|
;; ;; :hook (rust-mode . lsp-mode)
|
||||||
|
;; :init
|
||||||
|
;; (setq rust-mode-treesitter-derive t
|
||||||
|
;; ))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
[[https://github.com/brotzeit/rustic][=rustic-mode=]]
|
[[https://github.com/brotzeit/rustic][=rustic-mode=]]
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package rustic
|
(use-package rustic
|
||||||
|
|
@ -2199,7 +1996,6 @@ delimiters < and >'s."
|
||||||
:general-config
|
:general-config
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:prefix-map 'nemo/rust-map
|
:prefix-map 'nemo/rust-map
|
||||||
"c" '("Cargo" . nil)
|
|
||||||
"c v" '("Check" . rustic-cargo-check)
|
"c v" '("Check" . rustic-cargo-check)
|
||||||
"c c" '("Compile" . rustic-compile)
|
"c c" '("Compile" . rustic-compile)
|
||||||
"c b" '("Build" . rustic-cargo-build)
|
"c b" '("Build" . rustic-cargo-build)
|
||||||
|
|
@ -2211,8 +2007,8 @@ delimiters < and >'s."
|
||||||
"t a" '("Test" . rustic-cargo-test)
|
"t a" '("Test" . rustic-cargo-test)
|
||||||
"c a" '("cargo-add" . rustic-cargo-add)
|
"c a" '("cargo-add" . rustic-cargo-add)
|
||||||
"c r" '("cargo-rm" . rustic-cargo-remove)
|
"c r" '("cargo-rm" . rustic-cargo-remove)
|
||||||
"c l" '("clipp" . rustic-cargo-clippy)
|
"c l" '("lint" . rustic-cargo-clippy)
|
||||||
"c L" '("clippy-fix" . rustic-cargo-clippy-fix)
|
"c L" '("lint" . rustic-cargo-clippy-fix)
|
||||||
"c n" '("new" . rustic-cargo-new)
|
"c n" '("new" . rustic-cargo-new)
|
||||||
"c i" '("init" . rustic-cargo-init)
|
"c i" '("init" . rustic-cargo-init)
|
||||||
"c d" '("Docs" . rustic-cargo-doc)
|
"c d" '("Docs" . rustic-cargo-doc)
|
||||||
|
|
@ -2224,12 +2020,11 @@ delimiters < and >'s."
|
||||||
:config
|
:config
|
||||||
(setq rust-mode-treesitter-derive t
|
(setq rust-mode-treesitter-derive t
|
||||||
rustic-format-on-save nil
|
rustic-format-on-save nil
|
||||||
rustic-lsp-client 'eglot
|
|
||||||
;; rustic-format-trigger 'on-save
|
;; rustic-format-trigger 'on-save
|
||||||
;; rustic-format-on-save-method #'rustic-format-buffer
|
;; rustic-format-on-save-method #'rustic-format-buffer
|
||||||
;; rustic-analyzer-command '("/usr/bin/rust-analyzer")
|
;; rustic-analyzer-command '("/usr/bin/rust-analyzer")
|
||||||
)
|
)
|
||||||
;; (add-hook 'eglot--managed-mode-hook (lambda () (flymake-mode -1)))
|
;; (setq nemo/lsp-format-on-save t)
|
||||||
)
|
)
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -2240,6 +2035,25 @@ delimiters < and >'s."
|
||||||
:defer t)
|
:defer t)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Debugging
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package dap-mode
|
||||||
|
:straight t
|
||||||
|
:after (lsp-mode)
|
||||||
|
:config
|
||||||
|
;; (require 'dap-cpptools)
|
||||||
|
;; (dap-cpptools-setup)
|
||||||
|
(require 'dap-gdb-lldb)
|
||||||
|
(dap-register-debug-template "Rust::GDB Run Configuration"
|
||||||
|
(list :type "gdb"
|
||||||
|
:request "launch"
|
||||||
|
:name "GDB::Run"
|
||||||
|
:gdbpath "rust-gdb"
|
||||||
|
:target nil
|
||||||
|
:cwd nil))
|
||||||
|
(dap-auto-configure-mode))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Web
|
** Web
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package web-mode
|
(use-package web-mode
|
||||||
|
|
@ -2292,10 +2106,9 @@ Use =zls= automatically with lsp, and =zig-mode=:
|
||||||
:straight t
|
:straight t
|
||||||
:config
|
:config
|
||||||
(add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode))
|
(add-to-list 'auto-mode-alist '("\\.zig\\'" . zig-mode))
|
||||||
;; (setq lsp-zig-enable-build-on-save t
|
(setq lsp-zig-enable-build-on-save t
|
||||||
;; lsp-zig-enable-inlay-hints nil
|
lsp-zig-enable-inlay-hints nil
|
||||||
;; lsp-zig-build-on-save-step "check"))
|
lsp-zig-build-on-save-step "check"))
|
||||||
)
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Nix
|
** Nix
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue