urxvt: enable url-select
[julm/julm-nix.git] / home-manager / profiles / emacs / config.el
index f47af323702e88c4dbe64a0dbd4be98d00d75d0b..fb71e191771e82107647e6333d1e89ebcec53da6 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
       ;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
       prettify-symbols-mode -1
       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 ()
 (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
+        ;; 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
+        )
+  (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
   ;(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)))
                    )
   )
 
-;; 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-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