adding some tweaks to eglot and cape and tempel

This commit is contained in:
Chris Cochrun 2024-01-18 14:41:14 -06:00
parent 03d4799f01
commit 9155495918
3 changed files with 54 additions and 0 deletions

View file

@ -3358,6 +3358,7 @@ I'd like to start learning and using rust if I can.
(setq rustic-format-on-save t (setq rustic-format-on-save t
rustic-lsp-client 'eglot rustic-lsp-client 'eglot
rustic-clippy-arguments "-- -W clippy::pedantic") rustic-clippy-arguments "-- -W clippy::pedantic")
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
:general :general
(general-def 'normal rustic-mode-map (general-def 'normal rustic-mode-map
"!" 'rustic-run-shell-command "!" 'rustic-run-shell-command
@ -3481,6 +3482,17 @@ Let's give eglot a try.
(rust-mode . eglot-ensure) (rust-mode . eglot-ensure)
(rustic-mode . eglot-ensure) (rustic-mode . eglot-ensure)
(rust-ts-mode . eglot-ensure) (rust-ts-mode . eglot-ensure)
:config
(defun chris/eglot-capf ()
(setq-local completion-at-point-functions
(list (cape-capf-super
#'eglot-completion-at-point
#'tempel-expand
#'cape-file))))
(add-hook 'eglot-managed-mode-hook #'chris/eglot-capf)
:general :general
(general-def 'normal eglot-mode-map (general-def 'normal eglot-mode-map
"ga" 'eglot-code-actions "ga" 'eglot-code-actions
@ -3715,6 +3727,10 @@ I'm making a small function in here to open files in the appropriate program usi
:keymaps 'override :keymaps 'override
"od" '(dired-jump :which-key "open dired here") "od" '(dired-jump :which-key "open dired here")
"oD" '(dired :which-key "open dired select")) "oD" '(dired :which-key "open dired select"))
(chris/leader-keys
:states 'normal
:keymaps 'override
"sF" '(fd-dired :which-key "search in directory with fd"))
('normal dired-mode-map ('normal dired-mode-map
"q" 'kill-this-buffer "q" 'kill-this-buffer
"C-<return>" 'chris/dired-open-xdg "C-<return>" 'chris/dired-open-xdg

16
init.el
View file

@ -2449,6 +2449,7 @@ targets."
(setq rustic-format-on-save t (setq rustic-format-on-save t
rustic-lsp-client 'eglot rustic-lsp-client 'eglot
rustic-clippy-arguments "-- -W clippy::pedantic") rustic-clippy-arguments "-- -W clippy::pedantic")
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
:general :general
(general-def 'normal rustic-mode-map (general-def 'normal rustic-mode-map
"!" 'rustic-run-shell-command "!" 'rustic-run-shell-command
@ -2510,6 +2511,17 @@ targets."
(rust-mode . eglot-ensure) (rust-mode . eglot-ensure)
(rustic-mode . eglot-ensure) (rustic-mode . eglot-ensure)
(rust-ts-mode . eglot-ensure) (rust-ts-mode . eglot-ensure)
:config
(defun chris/eglot-capf ()
(setq-local completion-at-point-functions
(list (cape-capf-super
#'eglot-completion-at-point
#'tempel-expand
#'cape-file))))
(add-hook 'eglot-managed-mode-hook #'chris/eglot-capf)
:general :general
(general-def 'normal eglot-mode-map (general-def 'normal eglot-mode-map
"ga" 'eglot-code-actions "ga" 'eglot-code-actions
@ -2656,6 +2668,10 @@ targets."
:keymaps 'override :keymaps 'override
"od" '(dired-jump :which-key "open dired here") "od" '(dired-jump :which-key "open dired here")
"oD" '(dired :which-key "open dired select")) "oD" '(dired :which-key "open dired select"))
(chris/leader-keys
:states 'normal
:keymaps 'override
"sF" '(fd-dired :which-key "search in directory with fd"))
('normal dired-mode-map ('normal dired-mode-map
"q" 'kill-this-buffer "q" 'kill-this-buffer
"C-<return>" 'chris/dired-open-xdg "C-<return>" 'chris/dired-open-xdg

View file

@ -178,3 +178,25 @@ nix-mode
ledger-mode ledger-mode
(contribution "2023-10-01 Contributions" n> "Income:Supporters:" (p "supporter") > n> "Assets:Core") (contribution "2023-10-01 Contributions" n> "Income:Supporters:" (p "supporter") > n> "Assets:Core")
rustic-mode rust-mode rust-ts-mode
(if "if " p " {" n> q n> "}" q)
(el "if " p " {" n> p n> "} else {" n> p n> "}" q)
(elif "if " p " {" n> p n> "} else if " p " {" n> p n> "}" q)
(fn "fn " p "(" p ") {" n> p n "}" q)
(fnr "fn " p "(" p ") -> " p " {" n> p n "}" q)
(crt "extern crate " q ";")
(drv & "#[derive(" p ")]" q)
(d "dbg!(" p ")" q)
(lp "loop {" n> q n> "}" q)
(imd "impl Default for " p " {" n> n> "}")