Live data from Hacker News

VimGolf.com - real Vim ninjas count every keystroke

vimgolf.com

81–86 of 86 posts

Re: VimGolf.com - real Vim ninjas count every keystroke

#82
post #60

FizzBuzz: (score: 71) i1^] qaYp CTRL+a q98@aggjjqaA Fizz^] 3jq32@agg:5 ENTER qaA Buzz^] 5jq19@a:%s/z B/zB/ ENTER ZZ

You can achieve even less key strokes if you have your vim automatically removes trailing spaces, which is a neat feature itself and a common hack.

autocmd BufWritePre * :%s/\s\+$//

53 is the least I got.

Re: VimGolf.com - real Vim ninjas count every keystroke

#84
post #73

Earlier quoted context omitted.

Sadly, that's not allowed :(

Which kind of defeats the purpose. I use Vim plugins to reduce my keystrokes.

I agree that all users rely on plugins for doing real work. However, seeing how much can be accomplished by using just vanilla features can be enlightening.

Re: VimGolf.com - real Vim ninjas count every keystroke

#86
Only scored a 27 on the 'Reverse characters in a line' challenge...

I was trying to do this:

  :s/./&\r/g|g/^/m0|j!
However, that causes a to be before b for some reason.

So I ended up doing:

  :s/./&\\r/g|g/^/m0\rV}gJ
Anyone know why appending j! joins everything correctly except a and b?
Post reply on HN