feat: large emacs edit, too lazy to divide

This commit is contained in:
Flinner 2021-07-04 10:38:39 +03:00
parent 8bdcb6d803
commit d97d7f0c65
Signed by: flinner
GPG Key ID: 95CE0DA7F0E58CA6
1 changed files with 128 additions and 95 deletions

View File

@ -1,6 +1,12 @@
#+title: Flinner's Config #+title: Flinner's Config
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes #+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes
#+startup: content #+startup: content
* README:
run the following
#+begin_src emacs-lisp :tangle no
(all-the-icons-install-fonts)
(fira-code-mode-set-font)
#+end_src
* Packaging * Packaging
Initialize Package sources Initialize Package sources
@ -74,12 +80,14 @@ Emacs Backups trashing local dir!
#+end_src #+end_src
Better Scrolling Better Scrolling
#+begin_src elisp #+begin_src elisp
(setq scroll-conservatively 10) (setq scroll-conservatively 10)
(setq scroll-margin 3) (setq scroll-margin 3)
(use-package smooth-scrolling
:init (smooth-scrolling-mode 1))
#+end_src #+end_src
** Fonts ** Fonts
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq my/ui/monofont "FiraCode") (setq my/ui/monofont "Fira Code")
(setq my/ui/varfont "Cantarell") (setq my/ui/varfont "Cantarell")
#+end_src #+end_src
@ -200,6 +208,8 @@ Eval First and Last at least block!
"/" '(counsel-projectile-rg :which-key "projects") "/" '(counsel-projectile-rg :which-key "projects")
"," '(counsel-rg :which-key "rg") "," '(counsel-rg :which-key "rg")
"u" '(universal-argument :which-key "universal arg") "u" '(universal-argument :which-key "universal arg")
";" '(counsel-M-x :which-key "M-x")
":" '(eval-expression :which-key "eval expression")
#+end_src #+end_src
**** Toggles (t) **** Toggles (t)
@ -223,6 +233,7 @@ Eval First and Last at least block!
"sb" '(swiper :which-key "Choose Theme") "sb" '(swiper :which-key "Choose Theme")
#+end_src #+end_src
**** Files (f) **** Files (f)
#+begin_src emacs-lisp #+begin_src emacs-lisp
"f" '(:ignore t :which-key "Files") "f" '(:ignore t :which-key "Files")
@ -365,15 +376,31 @@ Eval First and Last at least block!
*** Evil Escape *** Evil Escape
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package evil-escape ;; (use-package evil-escape
:after evil ;; :after evil
:init ;; :init
(evil-escape-mode) ;; (setq 'evil-escape-excluded-major-modes '(magit-status-mode))
:config ;; (evil-escape-mode)
(setq evil-escape-key-sequence "jk") ;; :config
(setq evil-escape-delay 0.2) ;; (setq evil-escape-key-sequence "jk")
(setq evil-escape-unordered-key-sequence t) ;; (setq evil-escape-delay 0.2)
) ;; (setq evil-escape-unordered-key-sequence t))
(defun my-jk ()
(interactive)
(let* ((initial-key ?j)
(final-key ?k)
(timeout 0.5)
(event (read-event nil nil timeout)))
(if event
;; timeout met
(if (and (characterp event) (= event final-key))
(evil-normal-state)
(insert initial-key)
(push event unread-command-events))
;; timeout exceeded
(insert initial-key))))
(define-key evil-insert-state-map (kbd "j") 'my-jk)
#+end_src #+end_src
* Completions * Completions
@ -682,11 +709,11 @@ Lsp UI
(lsp-ui-doc-mode t) (lsp-ui-doc-mode t)
;(lsp-ui-sideline-show-hover t) ;(lsp-ui-sideline-show-hover t)
; (lsp-ui-doc-enable nil) ; (lsp-ui-doc-enable nil)
:bind (:map lsp-ui-mode-map ;; :bind (:map lsp-ui-mode-map
("U" . lsp-ui-doc-focus-frame) ;; ("U" . lsp-ui-doc-focus-frame)
:map lsp-ui-doc-frame-mode-map ;; :map lsp-ui-doc-frame-mode-map
("Q" . lsp-ui-doc-unfocus-frame) ;; ("Q" . lsp-ui-doc-unfocus-frame)
)) )
#+end_src #+end_src
*** lsp treemacs *** lsp treemacs
@ -702,8 +729,9 @@ Lsp UI
*** Origami Mode (Folding) *** Origami Mode (Folding)
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package origami) (use-package origami)
#+end_src #+end_src
** Git ** Git
*** Magit *** Magit
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -717,71 +745,6 @@ Lsp UI
;(use-package forge) ;(use-package forge)
#+end_src #+end_src
** Language
*** Rust
#+begin_src emacs-lisp
(use-package rustic
:ensure
:bind (:map rustic-mode-map
("C-c C-c l" . lsp-ui-flycheck-list)
("C-c C-c s" . lsp-rust-analyzer-status))
:config
;; uncomment for less flashiness
;; (setq lsp-eldoc-hook nil)
;; (setq lsp-enable-symbol-highlighting nil)
;; (setq lsp-signature-auto-activate nil)
;; comment to disable rustfmt on save
(setq rustic-format-on-save t)
(add-hook 'rustic-mode-hook 'my/dev/rustic-mode-hook))
(defun my/dev/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)))
#+end_src
*** Elisp emacs-lisp
#+begin_src emacs-lisp
;; (add-hook 'emacs-lisp-mode-hook 'company-mode)
(add-hook 'emacs-lisp-mode-hook 'flycheck-mode)
#+end_src
*** V
#+begin_src emacs-lisp
(use-package v-mode
:preface
(defun my/lsp/v ()
(interactive)
(lsp)
(flycheck-mode 1)
(company-mode 1))
:init
(delete '("\\.[ds]?va?h?\\'" . verilog-mode) auto-mode-alist)
;; :straight (v-mode
;; :type git
;; :host github
;; :repo "damon-kwok/v-mode"
;; :files ("tokens" "v-mode.el"))
(setq auto-mode-alist
(cons '("\\(\\.v\\|\\.vv\\|\\.vsh\\)$" . v-mode) auto-mode-alist))
:hook (v-mode . my/lsp/v)
:config
(flycheck-define-checker v-checker
"A v syntax checker using the v fmt."
:command ("v" "fmt" "-verify" (eval (buffer-file-name)))
:error-patterns
((error line-start (file-name) ":" line ":" column ": error: " (message) line-end))
:modes v-mode)
(add-to-list 'flycheck-checkers 'v-checker)
:bind-keymap
("M-z" . v-menu)
("<f6>" . v-menu)
("C-c C-f" . v-format-buffer)
:mode ("\\.v\\.vsh\\'" . 'v-mode))
#+end_src
** Treemacs ** Treemacs
use-package use-package
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -820,14 +783,84 @@ Get treemacs-lsp
;:config (treemacs-set-scope-type 'Perspectives)) ;:config (treemacs-set-scope-type 'Perspectives))
#+end_src #+end_src
** Language
* Tmp *** Rust
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (use-package peasant-mode (use-package rustic
;; :straight (peasant-mode :ensure
:bind (:map rustic-mode-map
("C-c C-c l" . lsp-ui-flycheck-list)
("C-c C-c s" . lsp-rust-analyzer-status))
:config
;; uncomment for less flashiness
;; (setq lsp-eldoc-hook nil)
;; (setq lsp-enable-symbol-highlighting nil)
;; (setq lsp-signature-auto-activate nil)
;; comment to disable rustfmt on save
(setq rustic-format-on-save t)
(add-hook 'rustic-mode-hook 'my/dev/rustic-mode-hook))
(defun my/dev/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)))
#+end_src
*** Elisp emacs-lisp
#+begin_src emacs-lisp
;; (add-hook 'emacs-lisp-mode-hook 'company-mode)
(add-hook 'emacs-lisp-mode-hook 'flycheck-mode)
#+end_src
*** V
#+begin_src emacs-lisp
(use-package v-mode
:preface
(defun my/lsp/v ()
(interactive)
(lsp)
(flycheck-mode 1)
(company-mode 1))
:init
(delete '("\\.[ds]?va?h?\\'" . verilog-mode) auto-mode-alist)
;; :straight (v-mode
;; :type git ;; :type git
;; :host github ;; :host github
;; :repo "flinner/peasant-mode") ;; :repo "damon-kwok/v-mode"
;; :config ;; :files ("tokens" "v-mode.el"))
;; (peasant-mode)) (setq auto-mode-alist
(cons '("\\(\\.v\\|\\.vv\\|\\.vsh\\)$" . v-mode) auto-mode-alist))
:hook (v-mode . my/lsp/v)
:config
(flycheck-define-checker v-checker
"A v syntax checker using the v fmt."
:command ("v" "fmt" "-verify" (eval (buffer-file-name)))
:error-patterns
((error line-start (file-name) ":" line ":" column ": error: " (message) line-end))
:modes v-mode)
(add-to-list 'flycheck-checkers 'v-checker)
:bind-keymap
("M-z" . v-menu)
("<f6>" . v-menu)
("C-c C-f" . v-format-buffer)
:mode ("\\.v\\.vsh\\'" . 'v-mode))
#+end_src #+end_src
*** Haskell
#+begin_src emacs-lisp
(use-package lsp-haskell
:hook (haskell-mode . lsp)
)
#+end_src
* Misc
** Restart Emacs
#+begin_src emacs-lisp
(use-package restart-emacs)
#+end_src