office: simple-scan: install
[julm/julm-nix.git] / home-manager / profiles / emacs / config.el
index ba79f2d9a27bbf3a3b7641b2412ff062d47973a5..a2b8b067f0559586e0d69163338a00ebc28ad42a 100644 (file)
@@ -6,6 +6,7 @@
 ;; Line numbers are pretty slow all around. The performance boost of
 ;; disabling them outweighs the utility of always keeping them on.
 (setq display-line-numbers-type nil)
+(global-visual-line-mode t)
 
 ;; Focus new window after splitting
 (setq evil-split-window-below t
   ; Almost the same as haskell-constructor-face
   ; because that pattern does not match on type-contexts correctly
   '(haskell-type-face :foreground "white" :bold t)
-  '(lsp-face-highlight-read :background "green10")
-  '(lsp-face-highlight-write :background "green10")
+  '(lsp-face-highlight-read :background "gray10")
+  '(lsp-face-highlight-write :background "gray10")
   '(mode-line :background "gray20")
   '(mode-line-inactive :background "gray5")
   '(solaire-default-face :background "gray10")
       ;lsp-enable-indentation nil
       ;lsp-enable-on-type-formatting nil
       ;lsp-enable-symbol-highlighting nil
+      lsp-enable-symbol-highlighting nil ; slow
       lsp-ui-doc-enable nil ; slow
       ;lsp-ui-sideline-enable nil ; not anymore useful than flycheck
       ;lsp-ui-peek-enable t
       show-help-function nil
       global-prettify-symbols-mode nil
       prettify-symbols-mode -1
+      treemacs-position 'right
+      treemacs-project-follow-mode t
       lsp-treemacs-errors-position-params `((side . right))
       lsp-log-io nil ; Only for debugging
+      lsp-restart 'auto-restart
+      ; Only load lsp-clients to speed up loading
+      ; See https://github.com/emacs-lsp/lsp-mode/pull/1498
+      lsp-client-packages '(lsp-clients)
+      lsp-ui-sideline-show-code-actions t
       )
 
 ;; The modeline is not useful to me in the popup window.
 ;;(delq! t custom-theme-load-path)
 
 (setq auto-save-default t ; Nobody likes to loose work, I certainly don't
-      confirm-kill-emacs nil
+      confirm-kill-emacs t
+      confirm-kill-processes nil
       make-backup-files nil
       password-cache-expiry nil ; I can trust my computers ... can't I?
       scroll-margin 10
       ;; scroll-preserve-screen-position 'always     ; Don't have `point' jump around
       truncate-string-ellipsis "…" ; Unicode ellispis are nicer than "...", and also save /precious/ space
       kill-whole-line t ; Make Ctrl-K remove the whole line, instead of just emptying it
-      undo-limit 80000000 ; Raise undo-limit to 80Mb
+      undo-limit 80000000 ; Raise undo-limit to 80MB
       x-stretch-cursor nil ; Disorienting
       )
 
       split-width-threshold 160
       )
 
+;; vterm
+(after! vterm
+  (set-popup-rule! "*doom:vterm-popup:*" :side 'right :size 0.33 :vslot -4 :select t :quit nil :ttl 0)
+  (setq vterm-kill-buffer-on-exit t
+        vterm-max-scrollback 10000
+        )
+  )
+
 (after! flycheck
   ; flycheck-error-list-buffer
-  (set-popup-rule! (rx bos "*Flycheck errors*" eos) :side 'right :size 0.45)
+  (set-popup-rule! (rx bos "*Flycheck errors*" eos) :side 'right :size 0.33)
+  ; M-x lsp-ui-flycheck-list
+  (setq lsp-ui-flycheck-list-position 'right)
   (add-hook 'flycheck-error-list-mode-hook
             (lambda () (setq tabulated-list-sort-key (list "Level"))))
+  (setq
+    flycheck-relevant-error-other-file-minimum-level 'error
+    flycheck-relevant-error-other-file-show t
+    )
   )
 ;(add-hook 'flycheck-error-list-after-refresh-hook
 ;          (lambda ()
 ; ToStudy: https://github.com/org-roam/org-roam-ui
 ; ToStudy: https://blog.tecosaur.com/tmio/2021-07-31-citations.html
 ; ToStudy: https://github.com/jkitchin/org-ref-cite
-(setq org-directory "~/documents/notes")
+(setq org-directory "~/papers/notes")
 (setq org-noter-notes-search-path '("~/notes/path/"))
 
 (after! org
 ;  :defer t
 ;  :hook ((after-init . org-roam-mode))
 ;  :custom
-;  (setq org-roam-directory "~/documents/notes/org-roam")
+;  (setq org-roam-directory "~/papers/notes/org-roam")
 ;
 ;  ;; Let's set up some org-roam capture templates
 ;  (setq org-roam-capture-templates
 ;  :config
 ;  (setq reftex-default-bibliography bibliography-files
 ;        org-ref-default-bibliography bibliography-files
-;        org-ref-bibliography-notes "~/documents/notes/org-roam/bibnotes.org"  ;; Is this even needed?
-;        org-ref-notes-directory "~/documents/notes/org-roam"
+;        org-ref-bibliography-notes "~/papers/notes/org-roam/bibnotes.org"  ;; Is this even needed?
+;        org-ref-notes-directory "~/papers/notes/org-roam"
 ;        org-ref-notes-function 'orb-edit-notes
 ;        ;org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex)
 ;  )
 ;(use-package! bibtex-completion
 ;  :defer t
 ;  :config
-;  (setq bibtex-completion-notes-path "~/documents/notes/org-roam/"
+;  (setq bibtex-completion-notes-path "~/papers/notes/org-roam/"
 ;        bibtex-completion-pdf-field "file"
 ;        bibtex-completion-bibliography bibliography-files
 ;        )
 ;(use-package! org-noter
 ;  :after (:any org pdf-view)
 ;  :config
-;  (setq org-noter-notes-search-path '("~/documents/notes/org-roam")
+;  (setq org-noter-notes-search-path '("~/papers/notes/org-roam")
 ;        org-noter-always-create-frame nil
 ;        )
 ;  )
 (modify-syntax-entry ?_ "w")
 (defun swiper-all/search-word-at-point ()
   (interactive)
-  (swiper-all (format "%s" (thing-at-point 'word))))
+  (swiper-all (format "\\_<%s\\_>" (thing-at-point 'word))))
 ; Highlight without jumping to the next match
 ; See: https://emacs.stackexchange.com/questions/52411/evil-star-visualstar-without-moving-the-cursor
 (defun search-word-at-point ()
   (evil-search (progn (evil-ex-search-unbounded-word-forward)
                       (evil-ex-search-unbounded-word-previous)
                       )))
-(setq ivy-case-fold-search-default nil ; case-sensitive search by default
-      )
+(after! (ivy swiper)
+  (setq case-fold-search nil ; case-sensitive search by default
+        ivy-case-fold-search-default nil ; case-sensitive search by default
+        ivy-count-format "(%d/%d) "
+        ivy-height 10
+        ;; Press C-p and Enter to select current input as candidate
+        ;; https://oremacs.com/2017/11/30/ivy-0.10.0/
+        ivy-use-selectable-prompt t
+        ivy-use-virtual-buffers t
+        )
+  (add-to-list 'ivy-re-builders-alist `(swiper . ivy--regex))
+  (add-to-list 'ivy-re-builders-alist `(swiper-all . ivy--regex))
+  (add-to-list 'ivy-re-builders-alist `(read-file-name-internal . ivy--regex-fuzzy))
+  )
 (after! evil
+  (setq which-key-min-display-lines 15
+        ; https://github.com/doomemacs/doomemacs/issues/5622#issuecomment-946760888
+        which-key-allow-imprecise-window-fit nil
+        )
   ;(general-define-key "C-s" '(counsel-grep-or-swiper :which-key "search"))
   ;(general-define-key :keymaps '(swiper-map) "C-u" '(lambda () (interactive) (kill-line 0)))
   ;(general-nvmap "/" '(counsel-grep-or-swiper :which-key "search in buffer"))
                    )
   )
 
-;; Edition
+;; Editing
 (after! evil
   (setq evil-want-fine-undo t
         )
   (evil-define-key 'normal global-map
                    (kbd "C-d") 'set-selective-display/at-point)
   )
-;; Navigation
+
+;; Navigating
 ;; DOC: https://github.com/noctuid/evil-guide
 (after! evil
   (setq evil-cross-lines t
+        evil-ex-search-case 'sensitive
         evil-move-cursor-back nil
         evil-search-wrap nil
         evil-want-C-i-jump nil
   (evil-define-key 'motion 'global
                    (kbd "<C-i>") 'evil-prev-buffer ; Does not work without the angles ('<' and '>')
                    (kbd "C-k") 'evil-next-buffer
+                   (kbd "C-x k") 'kill-current-buffer
+                   (kbd "C-m") 'counsel-switch-buffer
                    )
   ;(define-key evil-normal-state-map [tab] 'evil-prev-buffer)
 
                    (kbd "C-u") 'better-jumper-jump-backward
                    (kbd "C-o") 'better-jumper-jump-forward
                    )
+  ;; Jumping
+  ;(evil-define-key '(motion normal visual) 'global
+                    ;(kbd "C--") 'doom/decrease-font-size
+                    ;(kbd "C-=") 'doom/increase-font-size
+  ;                 )
 
   ;; Moving with ijkl (instead of hjkl)
   (evil-define-key '(motion normal visual) 'global