about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2017-11-06T18·35+0100
committerVincent Ambo <tazjin@gmail.com>2017-11-06T18·35+0100
commit6bef57e347881de5ddf21c9bf21ecce0d7150e57 (patch)
tree6ae63b3b74db19d4cc411ce91d8ed549a218705b
parent0338fcc89242deeed4f8e639182481d3b5a02a95 (diff)
feat(rust-setup): Add Rust setup
Adds a simple Rust setup with autocompletion via Racer and built-in
Cargo command support.
-rw-r--r--init.el2
-rw-r--r--init/rust-setup.el14
2 files changed, 16 insertions, 0 deletions
diff --git a/init.el b/init.el
index 2959691b6fbc..6f222178399f 100644
--- a/init.el
+++ b/init.el
@@ -17,6 +17,7 @@
     ace-jump-mode
     ag
     browse-kill-ring
+    cargo
     confluence
     dash
     dockerfile-mode
@@ -38,6 +39,7 @@
     password-store
     pkgbuild-mode
     puppet-mode
+    racer
     rainbow-delimiters
     rainbow-mode
     rust-mode
diff --git a/init/rust-setup.el b/init/rust-setup.el
new file mode 100644
index 000000000000..a4cf3c5a5116
--- /dev/null
+++ b/init/rust-setup.el
@@ -0,0 +1,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)