about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-navigation.el
blob: e4836371e30c09e8877393667873aff115ae327e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
;;; init-navigation.el --- Navigation Configuration File -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(use-package smartscan
  :config
  (global-smartscan-mode t)
  :hook
  (cider-repl-mode . (lambda () (smartscan-mode -1)))
  (ielm-mode . (lambda () (smartscan-mode -1)))
  (vterm-mode . (lambda () (smartscan-mode -1)))
  (eshell-mode . (lambda () (smartscan-mode -1))))

(use-package affe
  :after (consult orderless)
  :config
  (setq affe-grep-command (replace-regexp-in-string "\\." "-Suu ." affe-grep-command))
  (when (and (eq system-type 'darwin) (string-match-p "^find" affe-find-command))
    (setq affe-find-command (concat "g" affe-find-command)))
  ;; Configure Orderless
  (setq affe-regexp-function #'orderless-pattern-compiler
        affe-highlight-function #'orderless--highlight)
  ;; Manual preview key for `affe-grep'
  (consult-customize affe-grep :preview-key (kbd "M-."))
  (defun my/affe-grep-symbol-at-point (&optional dir initial)
    (interactive
      (list prefix-arg (when-let ((s (symbol-at-point)))
                         (symbol-name s))))
    (affe-grep dir initial))
  (defun my/affe-find-symbol-at-point (&optional dir initial)
    (interactive
      (list prefix-arg (when-let ((s (symbol-at-point)))
                         (symbol-name s))))
    (affe-find dir initial))
  :custom
  (affe-find-command "fd --color never -t f")
  :bind
  ("C-#" . affe-grep)
  ("C-c z" . affe-find)
  ("C-c Z" . my/affe-find-symbol-at-point)
  ("C-~" . my/affe-grep-symbol-at-point))

;; TODO - which of these are useful?
(use-package avy
  :after key-chord
  :custom
  (avy-background t)
  (avy-style 'pre)
  :config
  (key-chord-define-global "LL" 'avy-goto-line)
  (key-chord-define-global ",," 'avy-goto-char-in-line)
  (key-chord-define-global "jj" 'avy-goto-word-1)
  (key-chord-define-global "jk" 'avy-goto-char)
  :bind
  ("C-:" . avy-goto-char)
  ("C-'" . avy-goto-char-2)
  ("C-;" . avy-goto-char-in-line)
  ("C-c C-v" . avy-goto-char-in-line)
  ("C-c v" . avy-goto-word-or-subword-1)
  ("M-g w" . avy-goto-word-1)
  ("M-g M-w" . avy-goto-word-0)
  ("M-g M-f" . avy-goto-line))

(use-package rg
  :bind
  ("C-c C-M-r" . rg-menu)
  ("C-c C-M-R" . rg))

(provide 'init-navigation)
;;; init-navigation.el ends here