auto commit
This commit is contained in:
parent
e593c8349f
commit
99c5bbf8a5
1 changed files with 2 additions and 167 deletions
169
emacs.d/init.el
169
emacs.d/init.el
|
@ -1,7 +1,7 @@
|
|||
;;; ===================== ;;;
|
||||
;;; Author: Muha Aliss ;;;
|
||||
;;; Mail: muhaaliss@pm.me ;;;
|
||||
;;; Edit: 10/10/2023 ;;;
|
||||
;;; Edit: 15/10/2023 ;;;
|
||||
;;; ===================== ;;;
|
||||
|
||||
|
||||
|
@ -27,21 +27,12 @@
|
|||
use-package
|
||||
doom-themes
|
||||
bookmark
|
||||
lsp-mode
|
||||
yasnippet
|
||||
lsp-treemacs
|
||||
helm-lsp
|
||||
projectile
|
||||
hydra
|
||||
flycheck
|
||||
company
|
||||
avy
|
||||
which-key
|
||||
helm-xref
|
||||
all-the-icons
|
||||
all-the-icons-dired
|
||||
helm-icons
|
||||
dap-mode))
|
||||
helm-icons))
|
||||
|
||||
;; Search packages in installed packages,
|
||||
(when (cl-find-if-not #'package-installed-p package-selected-packages)
|
||||
|
@ -189,141 +180,6 @@
|
|||
;; try-expand-line
|
||||
))
|
||||
|
||||
(use-package rustic
|
||||
:ensure
|
||||
:bind (:map rustic-mode-map
|
||||
("M-j" . lsp-ui-imenu)
|
||||
("M-?" . lsp-find-references)
|
||||
("C-c C-c l" . flycheck-list-errors)
|
||||
("C-c C-c a" . lsp-execute-code-action)
|
||||
("C-c C-c r" . lsp-rename)
|
||||
("C-c C-c q" . lsp-workspace-restart)
|
||||
("C-c C-c Q" . lsp-workspace-shutdown)
|
||||
("C-c C-c s" . lsp-rust-analyzer-status)
|
||||
("C-c C-c e" . lsp-rust-analyzer-expand-macro)
|
||||
("C-c C-c d" . dap-hydra)
|
||||
("C-c C-c h" . lsp-ui-doc-glance)))
|
||||
|
||||
(defun rk/rustic-mode-hook ()
|
||||
;; so that run C-c C-c C-r works without having to confirm, but don't try to
|
||||
;; save rust buffers that are not file visiting. Once
|
||||
;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should
|
||||
;; no longer be necessary.
|
||||
(when buffer-file-name
|
||||
(setq-local buffer-save-without-query t))
|
||||
(add-hook 'before-save-hook 'lsp-format-buffer nil t))
|
||||
|
||||
;; for rust-analyzer integration
|
||||
(use-package lsp-mode
|
||||
:ensure
|
||||
:commands lsp
|
||||
:custom
|
||||
;; what to use when checking on-save. "check" is default, I prefer clippy
|
||||
(lsp-rust-analyzer-cargo-watch-command "clippy")
|
||||
(lsp-eldoc-render-all t)
|
||||
(lsp-idle-delay 0.6)
|
||||
;; This controls the overlays that display type and other hints inline. Enable
|
||||
;; / disable as you prefer. Well require a `lsp-workspace-restart' to have an
|
||||
;; effect on open projects.
|
||||
(lsp-rust-analyzer-server-display-inlay-hints t)
|
||||
(lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial")
|
||||
(lsp-rust-analyzer-display-chaining-hints t)
|
||||
(lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil)
|
||||
(lsp-rust-analyzer-display-closure-return-type-hints t)
|
||||
(lsp-rust-analyzer-display-parameter-hints nil)
|
||||
(lsp-rust-analyzer-display-reborrow-hints nil))
|
||||
|
||||
(use-package lsp-ui
|
||||
:ensure
|
||||
:commands lsp-ui-mode
|
||||
:custom
|
||||
(lsp-ui-peek-always-show t)
|
||||
(lsp-ui-sideline-show-hover t)
|
||||
(lsp-ui-doc-enable nil))
|
||||
|
||||
;; inline errors
|
||||
(use-package flycheck :ensure)
|
||||
|
||||
|
||||
;; auto-completion and code snippets
|
||||
(use-package yasnippet
|
||||
:ensure
|
||||
:config
|
||||
(yas-reload-all)
|
||||
(add-hook 'prog-mode-hook 'yas-minor-mode)
|
||||
(add-hook 'text-mode-hook 'yas-minor-mode))
|
||||
|
||||
(use-package company
|
||||
:ensure
|
||||
:bind
|
||||
(:map company-active-map
|
||||
("C-n". company-select-next)
|
||||
("C-p". company-select-previous)
|
||||
("M-<". company-select-first)
|
||||
("M->". company-select-last))
|
||||
(:map company-mode-map
|
||||
("<tab>". tab-indent-or-complete)
|
||||
("TAB". tab-indent-or-complete)))
|
||||
|
||||
(defun company-yasnippet-or-completion ()
|
||||
(interactive)
|
||||
(or (do-yas-expand)
|
||||
(company-complete-common)))
|
||||
|
||||
(defun check-expansion ()
|
||||
(save-excursion
|
||||
(if (looking-at "\\_>") t
|
||||
(backward-char 1)
|
||||
(if (looking-at "\\.") t
|
||||
(backward-char 1)
|
||||
(if (looking-at "::") t nil)))))
|
||||
|
||||
(defun do-yas-expand ()
|
||||
(let ((yas/fallback-behavior 'return-nil))
|
||||
(yas/expand)))
|
||||
|
||||
(defun tab-indent-or-complete ()
|
||||
(interactive)
|
||||
(if (minibufferp)
|
||||
(minibuffer-complete)
|
||||
(if (or (not yas/minor-mode)
|
||||
(null (do-yas-expand)))
|
||||
(if (check-expansion)
|
||||
(company-complete-common)
|
||||
(indent-for-tab-command)))))
|
||||
|
||||
;; Create / cleanup rust scratch projects quickly
|
||||
(use-package rust-playground :ensure)
|
||||
|
||||
;; for Cargo.toml and other config files
|
||||
(use-package toml-mode :ensure)
|
||||
|
||||
;; setting up debugging support with dap-mode
|
||||
(use-package exec-path-from-shell
|
||||
:ensure
|
||||
:init (exec-path-from-shell-initialize))
|
||||
|
||||
(when (executable-find "lldb-mi")
|
||||
(use-package dap-mode
|
||||
:ensure
|
||||
:config
|
||||
(dap-ui-mode)
|
||||
(dap-ui-controls-mode 1)
|
||||
|
||||
(require 'dap-lldb)
|
||||
(require 'dap-gdb-lldb)
|
||||
;; installs .extension/vscode
|
||||
(dap-gdb-lldb-setup)
|
||||
(dap-register-debug-template
|
||||
"Rust::LLDB Run Configuration"
|
||||
(list :type "lldb"
|
||||
:request "launch"
|
||||
:name "LLDB::Run"
|
||||
:gdbpath "rust-lldb"
|
||||
;; uncomment if lldb-mi is not in PATH
|
||||
;; :lldbmipath "path/to/lldb-mi"
|
||||
))))
|
||||
|
||||
|
||||
|
||||
;;; ===================== ;;;
|
||||
|
@ -342,19 +198,6 @@
|
|||
;; Shows key assignments in a mini window.
|
||||
(which-key-mode)
|
||||
|
||||
;; Garbage collector
|
||||
(setq gc-cons-threshold (* 100 1024 1024)
|
||||
read-process-output-max (* 1024 1024)
|
||||
;; more compact
|
||||
treemacs-space-between-root-nodes nil
|
||||
;; less noise
|
||||
lsp-completion-show-detail nil
|
||||
;; resonsibility
|
||||
company-idle-delay 0.0
|
||||
company-minimum-prefix-length 1
|
||||
;; clangd is fast
|
||||
lsp-idle-delay 0.1)
|
||||
|
||||
;; Use short answer
|
||||
(if (version< emacs-version "28.1")
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
@ -368,15 +211,7 @@
|
|||
|
||||
(add-hook 'tex-mode-hook 'my-add-pretty-symbol)
|
||||
(add-hook 'emacs-lisp-mode-hook 'my-add-pretty-symbol)
|
||||
(add-hook 'rust-mode-hook 'my-add-pretty-symbol)
|
||||
(add-hook 'c-mode-hook 'my-add-pretty-symbol)
|
||||
(add-hook 'python-mode-hook 'my-add-pretty-symbol)
|
||||
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
|
||||
(add-hook 'c-mode-hook 'lsp)
|
||||
(add-hook 'rust-mode-hook 'lsp)
|
||||
(add-hook 'lsp-mode-hook 'lsp-ui-mode)
|
||||
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
|
||||
(add-hook 'rustic-mode-hook 'rk/rustic-mode-hook)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue