about summary refs log tree commit diff stats
path: root/.emacs.d/lisp/init-navigation.el
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
committerDavid Morgan <djm_uk@protonmail.com>2021-08-17 12:49:19 +0100
commitd0db5660caa836755ea8c99471d816484ea9e837 (patch)
treec7d0456a58e450abaf34b489b0b31c58ddbc8557 /.emacs.d/lisp/init-navigation.el
parentc92b18514728245850d31531ce224a74eddfc5a6 (diff)
downloaddotfiles-d0db5660caa836755ea8c99471d816484ea9e837.tar.gz
Add new .emacs.d
Diffstat (limited to '.emacs.d/lisp/init-navigation.el')
-rw-r--r--.emacs.d/lisp/init-navigation.el81
1 files changed, 81 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-navigation.el b/.emacs.d/lisp/init-navigation.el
new file mode 100644
index 0000000..c9a3e90
--- /dev/null
+++ b/.emacs.d/lisp/init-navigation.el
@@ -0,0 +1,81 @@
+;;; init-navigation.el --- Navigation Configuration File -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Code:
+
+(use-package ctrlf
+  :init
+  (ctrlf-mode +1)
+  :config
+  (add-to-list 'ctrlf-minibuffer-bindings '("C-M-g" . ctrlf-cancel))
+  (add-to-list 'ctrlf-minibuffer-bindings '("C-o o" . ctrlf-occur))
+  (add-to-list 'ctrlf-minibuffer-bindings '("C-o C-o" . ctrlf-occur))
+  :custom
+  (ctrlf-default-search-style 'fuzzy-regexp)
+  (ctrlf-alternate-search-style 'literal)
+  :bind
+  ("C-*" . ctrlf-forward-symbol-at-point))
+
+(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))
+  ;; TODO is this faster and/or more portable?
+  ;; :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
+  :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-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
+  :config
+  (rg-enable-default-bindings))
+
+(provide 'init-navigation)
+;;; init-navigation.el ends here