From a4c86ab4085a74bec81c25e3dd09684a3e2a89db Mon Sep 17 00:00:00 2001 From: Wojciech Kozlowski Date: Fri, 1 Sep 2017 20:15:49 +0100 Subject: [PATCH] Add Rust configuration --- modules/programming.el | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/programming.el b/modules/programming.el index f6f0822..0e54716 100644 --- a/modules/programming.el +++ b/modules/programming.el @@ -19,6 +19,8 @@ (setq init-packages/programming-packages '(company + racer + rust-mode yasnippet) ) @@ -37,6 +39,29 @@ :config (setq company-backends (delete 'company-clang company-backends))) + ;; -------------------------------------------------------------------------- + ;; Configure Rust environment. + ;; -------------------------------------------------------------------------- + + (use-package rust-mode + :defer t) + + ;; This requires some additional setup as the racer binary must be installed + ;; and the Rust libstd sources must be installed. + ;; $ rustup component add rust-src + ;; $ cargo install racer + (use-package racer + :init + (add-hook 'rust-mode-hook #'racer-mode) + (add-hook 'racer-mode-hook #'eldoc-mode) + :config + (setq-default + racer-rust-src-path "~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/") + + (require 'rust-mode) + (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common) + (setq company-tooltip-align-annotations t)) + ;; -------------------------------------------------------------------------- ;; Enable yasnippet. ;; --------------------------------------------------------------------------