emacs.d/modules/jenga-rust.el

25 lines
734 B
EmacsLisp

;;;; Rust mode configuration.
;; Add rust load hooks.
(require 'jenga-functions)
(instl 'rust-mode)
(instl 'racer)
(instl 'cargo)
(instl 'flycheck-rust)
(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'racer-mode-hook #'company-mode)
(add-hook 'rust-mode-hook #'cargo-minor-mode)
(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
;; 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)
(define-key rust-mode-map (kbd "M-.") #'racer-find-definition)
(define-key rust-mode-map (kbd "M-h") #'racer-describe)
(provide 'jenga-rust)