summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/functions.el11
-rw-r--r--emacs/init.el5
2 files changed, 15 insertions, 1 deletions
diff --git a/emacs/functions.el b/emacs/functions.el
index e81639a..fc8431f 100644
--- a/emacs/functions.el
+++ b/emacs/functions.el
@@ -9,6 +9,17 @@
(expand-file-name name (concat (xdg-data-home) "/emacs")))
+;; Search Helpers
+
+(defun my/isearch-region (&rest _args)
+ "Pull the contents of the region into the search string if it
+is active."
+ (when (use-region-p)
+ (deactivate-mark)
+ (isearch-yank-string (buffer-substring-no-properties
+ (region-beginning) (region-end)))))
+
+
;; Theme Functions
(defun my/macos-dark-p ()
diff --git a/emacs/init.el b/emacs/init.el
index 36b3d32..554d7c1 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -81,7 +81,7 @@
(global-set-key (kbd "C-x C-b") #'ibuffer)
-;; Ivy
+;; Search and Completion Management
(ivy-mode 1)
(diminish 'ivy-mode)
@@ -92,6 +92,9 @@
(global-set-key (kbd "C-c s") #'swiper)
(global-set-key (kbd "C-c x") #'swiper-all)
+(dolist (fn '(isearch-forward isearch-backward))
+ (advice-add fn :after #'my/isearch-region))
+
;; Theme Management