diff --git a/README.org b/README.org index ceefac73..76b9c949 100644 --- a/README.org +++ b/README.org @@ -3358,6 +3358,7 @@ I'd like to start learning and using rust if I can. (setq rustic-format-on-save t rustic-lsp-client 'eglot rustic-clippy-arguments "-- -W clippy::pedantic") + (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) :general (general-def 'normal rustic-mode-map "!" 'rustic-run-shell-command @@ -3481,6 +3482,17 @@ Let's give eglot a try. (rust-mode . eglot-ensure) (rustic-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-def 'normal eglot-mode-map "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 "od" '(dired-jump :which-key "open dired here") "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 "q" 'kill-this-buffer "C-" 'chris/dired-open-xdg diff --git a/init.el b/init.el index a50145f8..a839c604 100644 --- a/init.el +++ b/init.el @@ -2449,6 +2449,7 @@ targets." (setq rustic-format-on-save t rustic-lsp-client 'eglot rustic-clippy-arguments "-- -W clippy::pedantic") + (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster) :general (general-def 'normal rustic-mode-map "!" 'rustic-run-shell-command @@ -2510,6 +2511,17 @@ targets." (rust-mode . eglot-ensure) (rustic-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-def 'normal eglot-mode-map "ga" 'eglot-code-actions @@ -2656,6 +2668,10 @@ targets." :keymaps 'override "od" '(dired-jump :which-key "open dired here") "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 "q" 'kill-this-buffer "C-" 'chris/dired-open-xdg diff --git a/templates b/templates index c2721d75..51b4201a 100644 --- a/templates +++ b/templates @@ -178,3 +178,25 @@ nix-mode ledger-mode (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> "}")