SHOW:
|
|
- or go back to the newest paste.
| 1 | (add-to-list 'load-path "~/.emacs.d/lisp/") | |
| 2 | ||
| 3 | (setq TeX-auto-save t) | |
| 4 | (setq TeX-parse-self t) | |
| 5 | ||
| 6 | (require 'package) | |
| 7 | ||
| 8 | ;; Add melpa repository to archives | |
| 9 | (add-to-list 'package-archives | |
| 10 | '("melpa" . "http://melpa.milkbox.net/packages/") t)
| |
| 11 | ||
| 12 | ;; Initialize packages | |
| 13 | (package-initialize) | |
| 14 | (require 'company) | |
| 15 | ||
| 16 | (require 'compile) | |
| 17 | (add-hook 'rust-mode-hook | |
| 18 | (lambda () | |
| 19 | (set (make-local-variable 'compile-command) | |
| 20 | (if (locate-dominating-file "Cargo.toml") | |
| 21 | "cargo build" | |
| 22 | "rustc *.rs")))) | |
| 23 | ||
| 24 | ;; Enable company globally for all mode | |
| 25 | (global-company-mode) | |
| 26 | ||
| 27 | ;; Reduce the time after which the company auto completion popup opens | |
| 28 | (setq company-idle-delay 0.2) | |
| 29 | ||
| 30 | ;; Reduce the number of characters before company kicks in | |
| 31 | (setq company-minimum-prefix-length 1) | |
| 32 | ||
| 33 | ;; Set path to racer binary | |
| 34 | (setq racer-cmd "/usr/local/bin/racer") | |
| 35 | ||
| 36 | - | '(lambda () |
| 36 | + | |
| 37 | - | ;; Enable racer |
| 37 | + | |
| 38 | - | (racer-activate) |
| 38 | + | |
| 39 | - | |
| 39 | + | |
| 40 | - | ;; Hook in racer with eldoc to provide documentation |
| 40 | + | |
| 41 | - | (racer-turn-on-eldoc) |
| 41 | + | |
| 42 | - | |
| 42 | + | (add-hook 'rust-mode-hook #'racer-mode) |
| 43 | - | ;; Use flycheck-rust in rust-mode |
| 43 | + | (add-hook 'racer-mode-hook #'eldoc-mode) |
| 44 | - | (add-hook 'flycheck-mode-hook #'flycheck-rust-setup) |
| 44 | + | (add-hook 'racer-mode-hook #'company-mode) |
| 45 | - | |
| 45 | + | |
| 46 | - | ;; Use company-racer in rust mode |
| 46 | + | |
| 47 | - | (set (make-local-variable 'company-backends) '(company-racer)) |
| 47 | + | |
| 48 | - | |
| 48 | + | (lambda () |
| 49 | - | ;; Key binding to jump to method definition |
| 49 | + | ;; Use flycheck-rust in rust-mode |
| 50 | - | (local-set-key (kbd "M-.") #'racer-find-definition) |
| 50 | + | (add-hook 'flycheck-mode-hook #'flycheck-rust-setup) |
| 51 | - | |
| 51 | + | |
| 52 | - | ;; Key binding to auto complete and indent |
| 52 | + | ;; Key binding to auto complete and indent |
| 53 | - | (local-set-key (kbd "TAB") #'racer-complete-or-indent))) |
| 53 | + | (local-set-key (kbd "TAB") #'company-indent-or-complete-common))) |
| 54 | ||
| 55 | (custom-set-variables | |
| 56 | ;; custom-set-variables was added by Custom. | |
| 57 | ;; If you edit it by hand, you could mess it up, so be careful. | |
| 58 | ;; Your init file should contain only one such instance. | |
| 59 | ;; If there is more than one, they won't work right. | |
| 60 | '(inhibit-startup-screen t)) | |
| 61 | (custom-set-faces | |
| 62 | ;; custom-set-faces was added by Custom. | |
| 63 | ;; If you edit it by hand, you could mess it up, so be careful. | |
| 64 | ;; Your init file should contain only one such instance. | |
| 65 | ;; If there is more than one, they won't work right. | |
| 66 | ) |