For the VimGolf challenge “List the first 100 prime numbers”, there’s a solution that uses a regular expression to detect prime numbers. At 43 keystokes, it’s not the winning solution, but I think it’s the most interesting one. It uses a few clever Vim tricks, including macros, control-a to increment, the very magic pattern switch, and the :global command. There’s a lot to learn from those 43 keystrokes, so let’s study it! More

7 Flattr microdonations from 7 people

  1. ethanmallove ethanma...
  2. joeylith joeylith
  3. nougad nougad
  4. refinedsir refinedsir
  5. iamtravis iamtravis
  6. +2 others