Skip to content

Instantly share code, notes, and snippets.

@bigs
Last active August 29, 2015 14:05
Show Gist options
  • Save bigs/67bcaec0d6b7f20f44fe to your computer and use it in GitHub Desktop.
Save bigs/67bcaec0d6b7f20f44fe to your computer and use it in GitHub Desktop.
replace instances of the word at the cursor (or current selection) with a new word
(defun cole-foo-balls (beg end r)
(interactive "r\nsReplace sel. with: ")
(let ((s (if (use-region-p)
(buffer-substring-no-properties beg end)
(word-at-point))))
(progn
(goto-char 0)
(replace-regexp s r))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment