2019-12-07 23:09:25 +01:00
|
|
|
;;;; Rust mode configuration.
|
|
|
|
;; Add rust load hooks.
|
|
|
|
(require 'jenga-functions)
|
|
|
|
(instl 'rust-mode)
|
|
|
|
(instl 'racer)
|
2019-12-08 15:19:06 +01:00
|
|
|
(instl 'cargo)
|
|
|
|
(instl 'flycheck-rust)
|
2019-12-07 23:09:25 +01:00
|
|
|
|
|
|
|
(add-hook 'rust-mode-hook #'racer-mode)
|
|
|
|
(add-hook 'racer-mode-hook #'eldoc-mode)
|
|
|
|
(add-hook 'racer-mode-hook #'company-mode)
|
2019-12-08 15:19:06 +01:00
|
|
|
(add-hook 'rust-mode-hook #'cargo-minor-mode)
|
|
|
|
|
|
|
|
(add-hook 'after-init-hook #'global-flycheck-mode)
|
|
|
|
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
|
2019-12-07 23:09:25 +01:00
|
|
|
|
|
|
|
;; Turn on Rust mode with *.rs files.
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
|
|
|
|
;; Auto-format with rustfmt on save.
|
|
|
|
(setq rust-format-on-save t)
|
|
|
|
|
2019-12-08 15:19:06 +01:00
|
|
|
(define-key rust-mode-map (kbd "M-.") #'racer-find-definition)
|
|
|
|
(define-key rust-mode-map (kbd "M-h") #'racer-describe)
|
2019-12-07 23:09:25 +01:00
|
|
|
|
|
|
|
(provide 'jenga-rust)
|