A Groups Magic VimGolf in Emacs Challenge

Here's a simple ViGolf challenge that has a simple solution in Emacs. Given

(a) (abc) (abcd) (123456)

turn it into

___ _____ ______ ________

That is, replace everything in the sexpr with an underscore. This is really easy with Emacs using query-replace-regexp. Here's a solution in only 8 keystrokes. The best Vim solution is 11, so Emacs definitely wins this one.

Meta+Ctrl+% Invoke query-replace-regexp
\S-Return Replace non-spaces with
_Return Underscores
! For the whole buffer

On the other hand, my experience has been that every time I think I have the best possible solution, one of my way smarter readers shows me a much better way. If you can beat 8 keystrokes, leave a comment and tell us how a real master does it.

This entry was posted in General and tagged . Bookmark the permalink.