Skip to content

Instantly share code, notes, and snippets.

@dgutov
Last active December 16, 2015 05:59
Show Gist options
  • Save dgutov/5388082 to your computer and use it in GitHub Desktop.
Save dgutov/5388082 to your computer and use it in GitHub Desktop.
Make isearch default to the current selection
(defun isearch-use-region-when-active ()
(when (region-active-p)
(setq mark-active nil)
(setq isearch-lazy-highlight-last-string nil)
(isearch-yank-string
(buffer-substring (region-beginning) (region-end)))))
(add-hook 'isearch-mode-hook 'isearch-use-region-when-active)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment