about summary refs log tree commit diff
path: root/init/rust-setup.el
blob: a4cf3c5a51163ef729e241b05753dde365281011 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(require 'rust-mode)

;; Enable cargo-related (C-c C-c C-...) commands.
(add-hook 'rust-mode-hook #'cargo-minor-mode)

;; Configure autocompletion for rust
(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'company-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
(setq company-tooltip-align-annotations t)

;; Ensure long compiler errors don't flow out of the screen (very annoying!)
(add-hook 'cargo-process-mode-hook #'visual-line-mode)