TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

VimGolf.com - real Vim ninjas count every keystroke

178 pointsby igrigorikover 14 years ago

24 comments

SwellJoeover 14 years ago
Where are the solutions? That's the fun thing about Perl golf is seeing how people did it in X characters. Without solutions...well, I don't see the point.
评论 #2046573 未加载
评论 #2046553 未加载
Calamitousover 14 years ago
This awesomeness unexpectedly sucked away half my afternoon. Not really sure whether to be upset about it our not. :)<p>Only thing is that the key counting doesn't seem to be consistent. :\ Using the command history seems to really, really screw with the counts. I thought it counted up all the characters in the submitted command, but this doesn't seem to be the case. I submitted an 18 for the "Sort and add attributes" challenge, then realized that the text for the new key is longer than that. :\<p>I'm not really clear on what "counts" as a keypress (shift key? colon for commands? Paste commands? Esc?) and I haven't been able to get any of my "scores" to match up with the count in my head.<p>All that aside, this is a barrel of fun, and I'm sure these kinks will get worked out.
评论 #2047535 未加载
luigiover 14 years ago
I want to go head to head with someone in match play.
评论 #2047523 未加载
评论 #2046846 未加载
gfodorover 14 years ago
The people submitting scores of 4 are probably just adding macros to their .vimrc
评论 #2046728 未加载
评论 #2046827 未加载
Budover 14 years ago
This is one of the most wonderfully geeky things I have ever seen. The analogy to golf is exceptionally well-drawn, too! It might be entertaining if you developed the parallel even more, perhaps by adapting some of The Rules of Golf to your project.
评论 #2046722 未加载
devinover 14 years ago
I had an idea for an emacs version of this.<p>Anyone have any ideas on how you'd implement this with emacs?
评论 #2046888 未加载
评论 #2048056 未加载
评论 #2047075 未加载
评论 #2046921 未加载
callahadover 14 years ago
I held the title on "Brackets or Braces?" [0] for a good seven minutes with a 44 character solution [1], only to be ousted by @ryanmusicman with 42. Can anyone see an obvious way to improve mine?<p>[0]: <a href="http://vimgolf.com/challenges/4d1a522ea860b7447200010b" rel="nofollow">http://vimgolf.com/challenges/4d1a522ea860b7447200010b</a><p>[1]: <a href="https://gist.github.com/757767" rel="nofollow">https://gist.github.com/757767</a>
评论 #2047108 未加载
DEinspanjerover 14 years ago
Ugh.. wanted to play with it, but after three years, there still isn't a simple way to get Ruby and Gems working nicely with modern Ruby apps on OSX. Searching for ways to update show a variety of hacks, each uglier than the last. Of course, I could always build it from source.. ::sigh::
评论 #2046632 未加载
exogenover 14 years ago
Ha, I just started working on the same exact project a few weeks ago. Great minds think alike, I guess. I'm taking a different approach, so I'll still launch it to see what people think.<p>I brought up this idea in a "gamification of software development" talk I gave last April.
jjcmover 14 years ago
Looks like Tim Pope started playing. He's talking about the "anti cheat" mechanisms on twitter: <a href="http://twitter.com/tpope/status/19900265129836544" rel="nofollow">http://twitter.com/tpope/status/19900265129836544</a>
clvvover 14 years ago
Until somebody can come up with at least some method of restricting vim scripting, the results are useless(one can easily only use 4 key strokes by key mapping as you can see). But, on the other hand, you can't just disable vim from loading scripts, because there's no point in mastering the plain old vim without any plugins, custom key mappings and such.
评论 #2046962 未加载
jjcmover 14 years ago
You should really make some challenges that require the users to pass multiple tests with the same script. Sure, you can solve the reformat/refactor challenge by<p><pre><code> jd2jVjj=f(ci)*a^]jcfda.join(',')^] </code></pre> but it wont generalize anywhere. Having a full script though that will detect and do that automagically, now there's the fun part.
评论 #2047171 未加载
DEinspanjerover 14 years ago
This one gives a score of 32, but I like it just for the sheer one-liner obsfucatedness:<p><pre><code> :g/#/+1s/\v(.*)\n.*/\1\r\1</code></pre>
评论 #2047665 未加载
jjcmover 14 years ago
Here's my Flodder Challenge (<a href="http://vimgolf.com/challenges/4d1a4f2ba860b744720000bf" rel="nofollow">http://vimgolf.com/challenges/4d1a4f2ba860b744720000bf</a>) solution:<p><pre><code> ~wqave~2wq@aw2@ab~ws**^]l~fe~ww@afg@aZZ </code></pre> (where ^] is an esc). Currently gets a score of 41 (although I only count 38 keystrokes...)
评论 #2048317 未加载
jh3over 14 years ago
Only scored a 27 on the 'Reverse characters in a line' challenge...<p>I was trying to do this:<p><pre><code> :s/./&#38;\r/g|g/^/m0|j! </code></pre> However, that causes a to be before b for some reason.<p>So I ended up doing:<p><pre><code> :s/./&#38;\\r/g|g/^/m0\rV}gJ </code></pre> Anyone know why appending j! joins everything correctly except a and b?
eterpsover 14 years ago
Any tips on improving 'Sort and add attributes'?<p>I have scored 38 with:<p>:sor&#60;ENTER&#62;:%s/)/, :country =&#62; "USA")/&#60;ENTER&#62;
评论 #2047082 未加载
评论 #2047014 未加载
Symmetryover 14 years ago
Lets see, for the simple text editing: qa/vim&#60;ENTER&#62;yypjddq@a@a so 18.
评论 #2046707 未加载
评论 #2046753 未加载
评论 #2046684 未加载
measthamover 14 years ago
Kinda a bummer for those of us who don't use twitter..<p>Edit: Still a very cool project though
selesover 14 years ago
You can also use Vi for hundreds of challenges at <a href="http://golf.shinh.org" rel="nofollow">http://golf.shinh.org</a> alot of the newer challenges are stale but some of the older ones are gold.
评论 #2047427 未加载
measthamover 14 years ago
Is there anything to stop people form just writing a macro beforehand that does each task? I'm guessing that's how the guy who 4 keystrokes on Simple Text Editing accomplished that.
jjcmover 14 years ago
FizzBuzz: (score: 71)<p><pre><code> i1^] qaYp CTRL+a q98@aggjjqaA Fizz^] 3jq32@agg:5 ENTER qaA Buzz^] 5jq19@a:%s/z B/zB/ ENTER ZZ</code></pre>
评论 #2048296 未加载
评论 #2047466 未加载
评论 #2048284 未加载
评论 #2048285 未加载
gfodorover 14 years ago
Anyone else having problems signing in? I connected my twitter account but its still thinking I'm not logged in.
zacharycohnover 14 years ago
Hey! You demo'd this to me at Beer &#38;&#38; Code a few weeks ago. Good to see this has come along!
评论 #2047042 未加载
neilkover 14 years ago
Unbelievable. I had this exact same idea. Get out of my mind!
评论 #2047479 未加载