Fix Rust config and use default kbds
This commit is contained in:
parent
b6d2c0fddf
commit
81ab6e4688
1 changed files with 8 additions and 13 deletions
|
@ -3,28 +3,23 @@
|
||||||
(require 'jenga-functions)
|
(require 'jenga-functions)
|
||||||
(instl 'rust-mode)
|
(instl 'rust-mode)
|
||||||
(instl 'racer)
|
(instl 'racer)
|
||||||
|
(instl 'cargo)
|
||||||
|
(instl 'flycheck-rust)
|
||||||
|
|
||||||
(add-hook 'rust-mode-hook #'racer-mode)
|
(add-hook 'rust-mode-hook #'racer-mode)
|
||||||
(add-hook 'racer-mode-hook #'eldoc-mode)
|
(add-hook 'racer-mode-hook #'eldoc-mode)
|
||||||
(add-hook 'racer-mode-hook #'company-mode)
|
(add-hook 'racer-mode-hook #'company-mode)
|
||||||
(add-hook 'rust-mode-hook 'cargo-minor-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.
|
;; Turn on Rust mode with *.rs files.
|
||||||
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
|
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
|
||||||
;; Auto-format with rustfmt on save.
|
;; Auto-format with rustfmt on save.
|
||||||
(setq rust-format-on-save t)
|
(setq rust-format-on-save t)
|
||||||
|
|
||||||
;; Show company auto-complete list on *.rs files by pressing TAB.
|
(define-key rust-mode-map (kbd "M-.") #'racer-find-definition)
|
||||||
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
|
(define-key rust-mode-map (kbd "M-h") #'racer-describe)
|
||||||
;; Use M-. keybinding to follow tag.
|
|
||||||
(define-key rust-mode-map (kbd "M-.") 'racer-find-definition)
|
|
||||||
;; Use M-h keybinding to open symbol documentation.
|
|
||||||
(define-key rust-mode-map (kbd "M-h") 'racer-describe)
|
|
||||||
;; Use C-c C-c keybinding to compile with `cargo build`.
|
|
||||||
(define-key rust-mode-map (kbd "C-c C-b") 'cargo-process-build)
|
|
||||||
;; Use C-c C-r keybinding to run with `cargo run`.
|
|
||||||
(define-key rust-mode-map (kbd "C-c C-r") 'cargo-process-run)
|
|
||||||
;; Use C-c C-t keybinding to test with `cargo test`.
|
|
||||||
(define-key rust-mode-map (kbd "C-c C-t") 'cargo-process-test)
|
|
||||||
|
|
||||||
(provide 'jenga-rust)
|
(provide 'jenga-rust)
|
||||||
|
|
Loading…
Reference in a new issue