emacs.d: initial config version

- starting init.el
  just basics (package, use-package, path-handlin)
- include my-site-start.el
  that includes site-start.d directory and imports
  all *.el files in lexical order
- functionality is imported via use-package inside
  the *.el file
  (first run: internet connection is needed to MELPA)
This commit is contained in:
2020-06-03 22:24:55 +02:00
commit dfd4317d2d
27 changed files with 7147 additions and 0 deletions

74
site-start.d/401-rust.el Normal file
View File

@@ -0,0 +1,74 @@
;;; 401-rust.el --- handle rust code
;;; Commentary:
;; using rust-mode with rust-analyzer via lsp
;;; Code:
;; load rustic -> IDE like for rust
(use-package rustic
:ensure t
:init
(setq rustic-lsp-server 'rust-analyzer)
(setq rustic-format-on-save t))
;; use the lsp UI package
(use-package lsp-ui)
;; use rust-analyzer via lsp
;; (setq lsp-rust-analyzer-server-command '("~/.cargo/bin/rust-analyzer"))
;; (add-hook 'before-save-hook (lambda () (when (eq 'rust-mode major-mode)
;; (lsp-format-buffer))))
;; load the language-server-protocol (lsp)
;; (use-package lsp-mode
;; :init
;; (add-hook 'prog-mode-hook 'lsp-mode)
;; :after rustic)
;; ;; :config
;; ;; (use-package lsp-flycheck
;; ;; :ensure f ; comes with lsp-mode
;; ;; :after rustic))
;; (push 'rustic-clippy flycheck-checkers)
;; Turn off flycheck.
;; (remove-hook 'rustic-mode-hook 'flycheck-mode)
;; ;; load rust-mode
;; (use-package rust-mode
;; :mode "\\.rs\\'"
;; :init
;; (setq rust-format-on-save t))
;; ;; bind the lsp-rust mode
;; (use-package lsp-rust
;; :after lsp-mode)
;; option: bind commands to keys:
;; - lsp-rust-analyzer-join-lines
;; - lsp-extend-selection
;; - lsp-rust-analyzer-expand-macro
;; (autoload 'rust-mode "rust-mode"
;; "Major mode for the rust programming language" t)
;; (add-hook 'rust-mode-hook #'racer-mode)
;; (add-hook 'racer-mode-hook #'eldoc-mode)
;; (add-hook 'racer-mode-hook #'company-mode)
;; (add-hook 'rust-mode-hook 'cargo-minor-mode)
;; (add-hook 'flycheck-mode #'flycheck-rust)
;; (add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
;; ;; reccommended: use spaces instead of tabs
;; (add-hook 'rust-mode-hook
;; (lambda () (setq indent-tabs-mode nil)))
;; ;; on save, run rustfmt if installed (C-c C-f)
;; (setq rust-format-on-save t)
(provide '401-rust)
;;; 401-rust.el ends here