Helix golf competition! 1. Turn a list into an array of strings using as few keystrokes as possible #8130
Replies: 5 comments 21 replies
-
Another 19 solution more inline with yours: |
Beta Was this translation helpful? Give feedback.
-
for the first challange you can get even better: If the file does not have a trailing newline you can get down to 17:
If it does this variant needs one more keypress (so 18):
|
Beta Was this translation helpful? Give feedback.
-
do we have any more of those? that is really fun |
Beta Was this translation helpful? Give feedback.
-
Here's a website which showcases more of these examples: https://nik-rev.github.io/helix-golf/ |
Beta Was this translation helpful? Give feedback.
-
Another solution for game 2 in 7 keypresses: Without whitespace around the text it could be 6: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Please try and beat my Helix golf solutions! You must end in Normal Mode. Let the games begin!
Game 1
I borrowed the idea from https://stackoverflow.com/questions/27473633/how-to-follow-a-vim-golf-solution which contains the original Vim solution. I have not tried to convert it, but rather use Helix functionality. Your cursor starts on the first letter of
Hello
Becomes:
[ "Hello", "This", "Is", "Helix" ]
%<A-s>ms"<A-,>I<backspace>, <esc>x_ms ms[
%<A-s>ms"(<A-,>a,<esc>Jx_ms ms[
%<ALT s>ms"a,<ESC>J<ALT ->;ddxms<SPACE>ms[
Game 2
Start with
8x
, there is imaginary white-space around the text:becomes:
8x<ALT s>4hT<ENTER>d
8x<ALT s>s\d{4}<ENTER><ALT ;>hT<ENTER>d
Beta Was this translation helpful? Give feedback.
All reactions