Commit Diff


commit - ef2b07cffcac374241676aff08dd67e4e6878daf
commit + 7247b242eacb3ea382ca54c917f5eafd0045cc29
blob - 01fce5cc739a1e6769ce460ac2e1feb760e14488
blob + bac54d00160028e25a7c5d43b7ebad938f71bf0e
--- init.el
+++ init.el
@@ -99,6 +99,8 @@
  (elpaca consult)
  (elpaca wgrep)
  (elpaca avy)
+ (elpaca ivy)
+ (elpaca swiper)
  (elpaca nix-mode)
  (elpaca zig-mode)
  (elpaca markdown-mode)
@@ -117,7 +119,7 @@
  (elpaca geiser)
  (elpaca geiser-chez)
  (elpaca tramp)
- (elpaca modus-themes)
+ (elpaca doric-themes)
  (elpaca ef-themes)
  (elpaca fontaine)
  (elpaca (tramp-rpc :host github :repo "ArthurHeymans/emacs-tramp-rpc"
blob - e4999bf7bffaad4bfad728ff5e1ffbf3ade94c0f
blob + 3da5a34fb06322e538db574586321b9632f878f5
--- lisp/setup-evil.el
+++ lisp/setup-evil.el
@@ -16,6 +16,8 @@
 (declare-function mine-consult-project-search "setup-search" (&optional dir initial))
 (declare-function evil-org-agenda-set-keys "evil-org-agenda" ())
 (declare-function avy-goto-line "avy" ())
+(declare-function avy-jump "avy" (regex &rest keys))
+(declare-function avy--regex-candidates "avy" (regex &optional beg end pred group))
 (defvar evil-insert-state-map)
 
 (defvar-keymap mine-evil-leader-map
@@ -43,6 +45,55 @@
                    (kbd "SPC") mine-evil-leader-map
                    (kbd "gv") #'avy-goto-line))
 
+(use-package avy
+  :after evil
+  :config
+  (defun mine-avy-char-jump (char beg end &optional post)
+    "Avy-jump to CHAR between BEG and END, then move point by POST."
+    (let* ((regex (if (= char 13) "\n" (regexp-quote (string char))))
+           (cands (avy--regex-candidates regex beg end))
+           (pt (point)))
+      (cond
+       ((null cands) (user-error "No matches for `%c'" char))
+       ;; Single candidate: jump without showing the decision tree.
+       ((null (cdr cands)) (goto-char (car cands)))
+       (t (avy-jump regex :beg beg :end end)))
+      (when (and post (/= (point) pt)) (forward-char post))))
+
+  (evil-define-motion mine-avy-f (_count)
+                      "Easymotion-style f: pick among forward matches of a char."
+                      :type inclusive
+                      (let ((char (read-char "f: " t)))
+                        (unless (eq char 27)
+                          (mine-avy-char-jump char (1+ (point)) (window-end nil t)))))
+
+  (evil-define-motion mine-avy-F (_count)
+                      "Easymotion-style F: pick among backward matches of a char."
+                      :type inclusive
+                      (let ((char (read-char "F: " t)))
+                        (unless (eq char 27)
+                          (mine-avy-char-jump char (window-start) (1- (point))))))
+
+  (evil-define-motion mine-avy-t (_count)
+                      "Easymotion-style t: jump before a forward char match."
+                      :type inclusive
+                      (let ((char (read-char "t: " t)))
+                        (unless (eq char 27)
+                          (mine-avy-char-jump char (1+ (point)) (window-end nil t) -1))))
+
+  (evil-define-motion mine-avy-T (_count)
+                      "Easymotion-style T: jump after a backward char match."
+                      :type inclusive
+                      (let ((char (read-char "T: " t)))
+                        (unless (eq char 27)
+                          (mine-avy-char-jump char (window-start) (1- (point)) 1))))
+
+  (evil-define-key '(normal visual operator) 'global
+                   (kbd "f") #'mine-avy-f
+                   (kbd "F") #'mine-avy-F
+                   (kbd "t") #'mine-avy-t
+                   (kbd "T") #'mine-avy-T))
+
 (use-package evil-collection
   :after evil
   :config
blob - d1177db497965457e38b6d6f61bb06ab319538c9
blob + 8b176efe9463218f01f1f8b7c085fc0efab8caa7
--- lisp/setup-search.el
+++ lisp/setup-search.el
@@ -34,5 +34,39 @@ INITIAL is the initial minibuffer input."
             '("ugrep" (consult--grep-exclude-args)
               "--null --line-buffered --color=never --ignore-case --with-filename --line-number -I -r"))))
 
+;; Swiper and swiper-avy
+;; https://github.com/abo-abo/swiper
+(defun mine-symbol-at-point ()
+  "Return the regexp-quoted symbol at point, or nil."
+  (let ((sym (thing-at-point 'symbol t)))
+    (and sym (regexp-quote sym))))
+
+(defun mine-swiper-dwim (arg)
+  "Start Swiper, defaulting to the symbol at point.
+ARG is the raw prefix argument.  With one \<global-map>\[universal-argument]
+resume the last Ivy session; with two, start a plain Swiper."
+  (interactive "P")
+  (pcase (car arg)
+    (4  (ivy-resume))
+    (16 (swiper))
+    (_  (swiper (mine-symbol-at-point)))))
+
+(defun mine-isearch-swiper ()
+  "Hand the current isearch over to Swiper."
+  (interactive)
+  (let ((query (if isearch-regexp
+                   isearch-string
+                 (regexp-quote isearch-string))))
+    (isearch-exit)
+    (swiper query)))
+
+(use-package swiper
+  :ensure t
+  :config
+  (keymap-set isearch-mode-map "M-i" #'mine-isearch-swiper)
+  (keymap-set swiper-map "C-SPC" #'swiper-avy)
+  (evil-define-key '(normal visual) 'global
+                   (kbd "/") #'mine-swiper-dwim))
+
 (provide 'setup-search)
 ;;; setup-search.el ends here
blob - 086fd7d9668cd65c9a1a81ca15318e30c3c10a26
blob + 43fc1a42a12af85a88cd1a872142216e4b24d7fe
--- lisp/setup-ui.el
+++ lisp/setup-ui.el
@@ -77,6 +77,8 @@
   ;; Move underlines to the descent line to reduce glyph clipping.
   (setopt x-underline-at-descent-line t))
 
+(defvar ef-themes-items)
+
 (defun mine-ef-theme--record ()
   "Persist selected theme on restart."
   (when (display-graphic-p)
@@ -86,11 +88,12 @@
           (setq mine-last-ef-theme theme)
           (throw 'found t))))))
 
-(use-package modus-themes
+(use-package doric-themes
+  :ensure t
   :unless (display-graphic-p)
   :demand t
   :config
-  (load-theme (if (eq system-type 'darwin) 'ef-maris-dark 'modus-vivendi) t))
+  (load-theme (if (eq system-type 'darwin) 'ef-maris-dark 'doric-walnut) t))
 
 (use-package ef-themes
   :if (display-graphic-p)