rust layer: move SPC m c C to SPC m c x + various small fixes

This commit is contained in:
syl20bnr 2015-07-01 01:37:31 -04:00
parent 90f80c8ad1
commit c635aa8b36
2 changed files with 14 additions and 22 deletions

View file

@ -10,15 +10,14 @@
- [[#key-bindings][Key bindings]]
* Description
This layer aims to support [[http://www.rust-lang.org/][Rust]] development in Spacemacs.
This layer aims to support [[http://www.rust-lang.org/][Rust]] development in Spacemacs. It supports [[http://doc.crates.io/index.html][Cargo]],
and has some basic auto-completion support through [[https://github.com/phildawes/racer][Racer]], though Racer needs
some additional configurations as described on their page.
It supports [[http://doc.crates.io/index.html][Cargo]], and has some basic auto-completion support through [[https://github.com/phildawes/racer][Racer]],
though Racer needs some additional configurations as described on their page.
* Install
** Layer
To use this layer, add it to your =~/.spacemacs=
#+BEGIN_SRC emacs-lisp
@ -26,7 +25,6 @@ To use this layer, add it to your =~/.spacemacs=
#+END_SRC
** Cargo
[[http://doc.crates.io/index.html][Cargo]] is a project management command line tool for Rust. Installation
instructions can be found on the main page of [[http://doc.crates.io/index.html][Cargo]].
@ -35,6 +33,6 @@ instructions can be found on the main page of [[http://doc.crates.io/index.html]
| Key Binding | Description |
|-------------+-----------------------------------|
| ~SPC m c c~ | compile project with Cargo |
| ~SPC m c C~ | execute the project with Cargo |
| ~SPC m c t~ | run tests with Cargo |
| ~SPC m c d~ | generate documentation with Cargo |
| ~SPC m c x~ | execute the project with Cargo |

View file

@ -10,17 +10,15 @@
;;
;;; License: GPLv3
(defvar rust-packages
(setq rust-packages
'(
company
company-racer
flycheck
flycheck-rust
rust-mode
toml-mode
company
company-racer
)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
))
(defun rust/post-init-flycheck ()
(add-hook 'rust-mode-hook 'flycheck-mode))
@ -30,30 +28,26 @@ which require an initialization must be listed explicitly in the list.")
(use-package flycheck-rust
:if (configuration-layer/package-usedp 'flycheck)
:defer t
:init
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup))))
:init (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))))
(defun rust/init-rust-mode ()
(use-package rust-mode
:defer t
:config
(progn
(when (fboundp 'sp-local-pair) ;Don't pair lifetime specifiers
(when (fboundp 'sp-local-pair)
;; Don't pair lifetime specifiers
(sp-local-pair 'rust-mode "'" nil :actions nil))
;; (spacemacs/declare-prefix-for-mode 'rust-mode "mc" "cargo")
(evil-leader/set-key-for-mode 'rust-mode
"mcc" 'spacemacs/rust-cargo-build
"mcC" 'spacemacs/rust-cargo-run
"mct" 'spacemacs/rust-cargo-test
"mcd" 'spacemacs/rust-cargo-doc)))
"Initialize rust-mode"
)
"mcd" 'spacemacs/rust-cargo-doc
"mcx" 'spacemacs/rust-cargo-run))))
(defun rust/init-toml-mode ()
(use-package toml-mode
:defer t)
"Initialize toml-mode")
:defer t))
(when (configuration-layer/layer-usedp 'auto-completion)
(defun rust/post-init-company ()