- Added alacritty
- Removed customization on byobu
- Zathura for ranger
- Added mikrotik to sshconfig
- Added aya01 to sshconfig
- Added git.aya01 to sshconfig
- Fixed some ledger stuff
- Misc

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
This commit is contained in:
TuDatTr
2022-12-27 22:15:56 +01:00
parent 8578eaaf1c
commit cf4e9a19a9
10 changed files with 1208 additions and 131 deletions

View File

@@ -14,7 +14,8 @@ Initialize Emacs builtin package system and add the [[https://melpa.org][melpa]]
#+begin_src emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(setq package-archives '(("melpa" . "http://melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
(package-refresh-contents)
#+end_src
@@ -25,6 +26,7 @@ Initialize Emacs builtin package system and add the [[https://melpa.org][melpa]]
#+begin_src emacs-lisp
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
@@ -155,9 +157,13 @@ Initialize Emacs builtin package system and add the [[https://melpa.org][melpa]]
#+begin_src emacs-lisp
(use-package yasnippet
:ensure
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets/"))
(yas-global-mode 1))
(yas-reload-all)
(add-hook 'prog-mode-hook 'yas-minor-mode)
(add-hook 'text-mode-hook 'yas-minor-mode)
)
#+end_src
*** [[https://github.com/company-mode/company-mode][company-mode]]
@@ -165,30 +171,69 @@ Initialize Emacs builtin package system and add the [[https://melpa.org][melpa]]
#+begin_src emacs-lisp
(use-package company
:config
(global-company-mode))
:ensure
;; :custom
;; (company-idle-delay 0.5) ;; how long to wait until popup
;; (company-begin-commands nil) ;; uncomment to disable popup
: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)))))
#+end_src
*** [[https://github.com/TommyX12/company-tabnine][tabnine-company]]
=A company-mode backend for TabNine, the all-language autocompleter: https://tabnine.com/=
#+begin_src emacs-lisp
(use-package company-tabnine
:ensure t)
;; Trigger completion immediately.
(setq company-idle-delay 0)
;; Number the candidates (use M-1, M-2 etc to select completions).
(setq company-show-numbers t)
(add-to-list 'company-backends #'company-tabnine)
#+end_src
# *** [[https://github.com/TommyX12/company-tabnine][tabnine-company]]
# =A company-mode backend for TabNine, the all-language autocompleter: https://tabnine.com/=
#
# #+begin_src emacs-lisp
# (use-package company-tabnine
# :ensure t)
# ;; Trigger completion immediately.
# (setq company-idle-delay 0)
#
# ;; Number the candidates (use M-1, M-2 etc to select completions).
# (setq company-show-numbers t)
#
# (add-to-list 'company-backends #'company-tabnine)
# #+end_src
*** [[https://github.com/flycheck/flycheck][flycheck]]
=On the fly syntax checking for GNU Emacs=
#+begin_src emacs-lisp
(use-package flycheck
:ensure
:config
(global-flycheck-mode))
#+end_src
@@ -200,23 +245,107 @@ Initialize Emacs builtin package system and add the [[https://melpa.org][melpa]]
(use-package htmlize)
#+end_src
*** [[https://github.com/flycheck/flycheck-rust][flycheck-rust]]
=Better Rust/Cargo support for Flycheck=
#+BEGIN_SRC emacs-lisp
(use-package flycheck-rust)
#+END_SRC
*** [[https://github.com/rust-lang/rust-mode][rust-mode]]
** lsp-mode
#+begin_src emacs-lisp
(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 2.0)
;; 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-server 'rust-analyzer)
(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 t)
(lsp-rust-analyzer-display-closure-return-type-hints t)
(lsp-rust-analyzer-display-parameter-hints t)
(lsp-rust-analyzer-display-reborrow-hints t)
:config
(add-hook 'lsp-mode-hook 'lsp-ui-mode))
(add-hook 'python-mode-hook (lambda() (lsp-python-enable)))
(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))
#+end_src
*** [[https://github.com/brotzeit/rustic][rustic]]
=Emacs configuration for Rust=
#+BEGIN_SRC emacs-lisp
(use-package rust-mode)
(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))
:config
;; comment to disable rustfmt on save
(setq rustic-format-on-save t))
#+END_SRC
*** [[https://github.com/kwrooijen/cargo.el][cargo.el]]
*** dash.el
#+BEGIN_SRC emacs-lisp
(use-package cargo)
(use-package dash)
#+END_SRC
*** rust-playground
#+begin_src emacs-lisp
(use-package rust-playground :ensure)
#+end_src
*** rust-playground
#+begin_src emacs-lisp
(use-package toml-mode :ensure)
#+end_src
*** lldb
#+begin_src emacs-lisp
(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"
))))
#+end_src
*** projectile
#+begin_src emacs-lisp
(use-package projectile)
#+end_src
*** [[https://github.com/astahlman/ob-async][ob-async]]
#+begin_src emacs-lisp
(use-package ob-async)
@@ -271,10 +400,11 @@ This is kind of a janky solution, but it works.
#+end_comment
** Menubar
Remove the menu-bar at the top of the screen for better immersion.
Remove the menu/tool-bar at the top of the screen for better immersion.
#+begin_src emacs-lisp
(menu-bar-mode -1)
(tool-bar-mode -1)
#+end_src
* Emacs Configuration
@@ -291,7 +421,6 @@ Follow symlinks without asking for confirmation.
(setq-default indent-tabs-mode nil)
#+END_SRC
* Mode Configuration
** Org-mode
*** Enable org-bullets and hide leading stars.
@@ -323,10 +452,41 @@ Follow symlinks without asking for confirmation.
("breakanywhere" "true")))
#+end_src
** yassnipped code completion in company
https://robert.kra.hn/posts/rust-emacs-setup/#changelog
#+begin_src emacs-lisp
(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)))))
#+end_src
*** Keybindings
#+begin_src emacs-lisp
(define-key org-mode-map (kbd "C-c ,") 'org-insert-structure-template)
(define-key evil-normal-state-map (kbd "Y") 'simpleclip-copy)
(define-key evil-visual-state-map "Y" 'simpleclip-copy)
#+end_src
Enables specific languages for org-babel, so those languages can be used and compiled in code blocks and disable the compilation confirmation. The code afterwords enables proper indentation inside those source blocks.
@@ -338,6 +498,7 @@ Enables specific languages for org-babel, so those languages can be used and com
(makefile . t)
(shell . t)
(latex . t)
;; (rust . t)
(python . t)))
(setq org-confirm-babel-evaluate nil)
@@ -358,17 +519,14 @@ Enables specific languages for org-babel, so those languages can be used and com
(display-line-numbers-mode 1)))
#+end_src
** rust-mode
cargo.el
#+begin_src emacs-lisp
(add-hook 'rust-mode-hook 'cargo-minor-mode)
#+end_src
flycheck-rust
#+begin_src emacs-lisp
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
#+end_src
** p4-mode
#+begin_src emacs-lisp
(add-to-list 'auto-mode-alist '("\\.p4\\'" . c-mode))
#+end_src
** markdown-mode
#+begin_src emacs-lisp
(add-hook 'markdown-mode-hook
(lambda ()
(setq markdown-fontify-code-blocks-natively t)))
#+end_src