summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2014-12-17 20:15:59 +0000
committerAlan Pearce2014-12-17 20:15:59 +0000
commited02bd17f9efa86b1f3ec525b079f0597efc923a (patch)
tree2dca025c0802923e096ef555e34200940ea7cf22
parent083f8933424fc276a1575029a266223ef44f63bf (diff)
downloadnixfiles-ed02bd17f9efa86b1f3ec525b079f0597efc923a.tar.lz
nixfiles-ed02bd17f9efa86b1f3ec525b079f0597efc923a.tar.zst
nixfiles-ed02bd17f9efa86b1f3ec525b079f0597efc923a.zip
Emacs: Add and bind isearch-yank-symbol
-rw-r--r--tag-emacs/emacs.d/init.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/tag-emacs/emacs.d/init.el b/tag-emacs/emacs.d/init.el
index a407e67c..b7ebbefc 100644
--- a/tag-emacs/emacs.d/init.el
+++ b/tag-emacs/emacs.d/init.el
@@ -1011,6 +1011,21 @@ mouse-1: Display Line and Column Mode Menu"))))))
 
 (bind-key "S-SPC" #'set-mark-command)
 
+(defun fc/isearch-yank-symbol ()
+  "Yank the symbol at point into the isearch minibuffer.
+
+C-w does something similar in isearch, but it only looks for
+the rest of the word. I want to look for the whole string. And
+symbol, not word, as I need this for programming the most."
+  (interactive)
+  (isearch-yank-string
+   (save-excursion
+     (when (and (not isearch-forward)
+                isearch-other-end)
+       (goto-char isearch-other-end))
+     (thing-at-point 'symbol))))
+(bind-key "C-d" #'fc/isearch-yank-symbol isearch-mode-map)
+
 (req-package subword
   :init (global-subword-mode t))