My Solution to the Latest VimGolf Challenge

Readers contributed many good solutions to this challenge. The mundane solution involves using query-replace-regexp with regular expressions

w+ → (\1)

for 14 keystrokes or, if you're a bit more clever

w+ → (\&)

for 10. Actually, I have electric-pair-mode enabled so my counts were 13 and 9 but the 14 and 10 counts work for a stock Emacs.

My best solution was much like those contributed by readers

F3  
Meta+( ;; paredit-wrap-round
Meta+Ctrl+n ;; paredit-forward-up
Ctrl+f ;; forward-char
Meta+0  
F4  

Sadly, my mind appears to be undergoing bit rot. As Fuco points out, I've posted this problem before. You can check the comments to that post for a bunch of other solutions.

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

2 Responses to My Solution to the Latest VimGolf Challenge

  1. roberton says:

    Where is the "Latest VimGolf Challenge" that you based this article?

Comments are closed.