7 ms·
VimGolf.com - real Vim ninjas count every keystroke
- SwellJoe 16y agoWhere 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.
- deleted 16y ago[deleted]
- igrigorik 16y agoI'm logging the solutions, but in real MVP fashion... not showing them just yet. Need to bootstrap a vimscript parser first. If anyone is up for it, would love some help with the client/parser: https://github.com/igrigorik/vimgolf https://github.com/igrigorik/vimgolf
- Complete 16y agoI will take part in this when the solutions are displayed. All the fun is in the solutions. So for me, hiding them kills the whole point of the project. Otherwise it would be lots of fun. Im a long time vim user and love it.
- silentbicycle 16y agoI think Project Euler has a good compromise - you can see (and comment on!) solutions once you've successfully passed some baseline. Then you don't feel like you cheated, but can pick apart their solutions, now that you've already focused on that problem for a while. I've learned a LOT figuring out how some outstanding PE submissions worked, translating their algorithms to my favorite languages.
- preek 16y agoMVP meaning 'Most Valuable Player'?
- johnswamps 16y agoMinimum Viable Product
- Groxx 16y ago"Maximum reVivification Potential" gets my vote.
- rue 16y agoIs the parser for deconstructing the solutions? That'd be a useful feature to have along with the solutions themselves.
- snprbob86 16y agoDo you really need to do anything super smart with them? Could you at least link to the logged scripts as files? Smarter stuff can come later.
- igrigorik 16y agoGood news. You can now preview the solutions! Only one wrinkle: you have to submit your own challenge to see the solutions. Ex: http://vimgolf.com/challenges/4d1a8bf2b8cb3409320002c4 http://vimgolf.com/challenges/4d1a8bf2b8cb3409320002c4
- Bud 16y agoThis 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.
- rbxbx 16y agoNot an original concept here. http://en.wikipedia.org/wiki/Perl#Perl_golf http://en.wikipedia.org/wiki/Perl#Perl_golf 'Golfing' different languages has been around for some time. No discredit to the site though, certainly happy to have Vim golfing join the ranks.
- DEinspanjer 16y agoUgh.. 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::
- luigi 16y agoNot sure what you mean, as the vast majority of Ruby developers I know use OS X. Ruby works out of the box on Snow Leopard. Or try Homebrew. Or RVM.
- DEinspanjer 16y agoI'm running an MBP received a clean install of the first Snow Leopard release and has subsequently gone through the normal system updates. On this system, and the previous one that was running 10.5, I've never managed to get RubyGems updated successfully.. hence, when I try to gem install vimgolf, it tells me that I need rubygems >=1.3.6. I guess I'm just failing as a hacker and missing something obvious. Grr. Well, I just discovered that I had two different conflicting gem home dirs. was able to set GEM_HOME and do "gem cleanup" and things seem to be a bit better now. Yay!
- kunley 16y agoJust mercifully ignore OSX-shipped Ruby and go with Ruby from ports, homebrew, vanilla-source install. Or just use RVM.
- steveklabnik 16y agoI use rvm on OSX every day, Ruby would be worse without it. I'm going to sorely miss it when I start working in other languages again.
- gfodor 16y agoAnyone else having problems signing in? I connected my twitter account but its still thinking I'm not logged in.
- luigi 16y agoI want to go head to head with someone in match play.
- bradendouglass 16y agoprecisely what I was thinking.
- steveklabnik 16y agoDJ Hero has a great feature where after you beat a song, you can "Challenge a friend" and it sends a message to them that says something along the lines of "Steve just scored 200,000 points on $SONG_NAME. Can you do better? OK/CANCEL/ABORT"
- Symmetry 16y agoLets see, for the simple text editing: qa/vim<ENTER>yypjddq@a@a so 18.
- Complete 16y agoqa/v<ENTER>yypjddq@a@a 16 :P
- meastham 16y agoKinda a bummer for those of us who don't use twitter.. Edit: Still a very cool project though
- meastham 16y agoIs 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.
- gfodor 16y agoThe people submitting scores of 4 are probably just adding macros to their .vimrc
- gfodor 16y agoOP: can you figure out a way to get vim to not load vimrc?
- silentbicycle 16y agovim -u NONE (real Vim ninjas read man pages)
- duck 16y agoThey just fixed that.
- devin 16y agoI had an idea for an emacs version of this. Anyone have any ideas on how you'd implement this with emacs?
- jlongster 16y agoMy emacs-fu is pretty stale, but I'm sure it has the hooks to track what you need. Although, Emacs isn't all about keystrokes, it's more about interactive coding and an integrated development environment. Maybe you could do something more along the lines of Perl golf, where you achieve certain things in as little code as possible.
- lelele 16y agoWhat? Viewing/counting keystrokes? Then "C-h l".
- aerique 16y agoPerhaps Xah Lee's command frequencies script is a start?
- silentbicycle 16y agoYou could check keystrokes used with C-h l (or M-x view-lossage), but Emacs's whole design is based on extensibility rather than terse, orthogonal, and (usually) single-key commands. Don't find a clever way to knock it down to 30 keystrokes (or whatever) - when you notice a common operation, script it, name it, bind it, now it's two or three keystrokes.
- eterps 16y agoAny tips on improving 'Sort and add attributes'? I have scored 38 with: :sor<ENTER>:%s/)/, :country => "USA")/<ENTER>
- clvv 16y agoUntil 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.
- askedrelic 16y agoI've been trying with editing the file in another editor, then :e! :wq which seems to give 17/18 score mostly. I love this idea and love the challenge, but would love to make it less hackable as well.
- jjcm 16y agoZZ instead of :wq will knock a letter off. I'm guessing that's what the current leader with 16 is doing on this challenge: http://vimgolf.com/challenges/4d1a1c36567bac34a9000002 http://vimgolf.com/challenges/4d1a1c36567bac34a9000002
- zacharycohn 16y agoHey! You demo'd this to me at Beer && Code a few weeks ago. Good to see this has come along!
- exogen 16y agoHeh, that was me, and this is actually a completely independent project. Mine's still coming along, and I think it's an improvement.
- exogen 16y agoHa, 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. I brought up this idea in a "gamification of software development" talk I gave last April.
- neilk 16y agoUnbelievable. I had this exact same idea. Get out of my mind!
- Calamitous 16y agoMe too. :) This is a much, much nicer implementation than anything I had in mind, though,
- DEinspanjer 16y agoThis one gives a score of 32, but I like it just for the sheer one-liner obsfucatedness: :g/#/+1s/\v(.*)\n.*/\1\r\1
- BrandonM 16y agoed golf, eh?
- jjcm 16y agoYou 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 jd2jVjj=f(ci)*a^]jcfda.join(',')^] but it wont generalize anywhere. Having a full script though that will detect and do that automagically, now there's the fun part.
- jjcm 16y ago4JD=Gjwci(*a^]jcfda.join(',')^] God this is addicting. Shaved off a few characters. edit: switch the first three letters to j3D, as 4JD seems to work differently between my two machines.
- callahad 16y agoI 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? [0]: http://vimgolf.com/challenges/4d1a522ea860b7447200010b http://vimgolf.com/challenges/4d1a522ea860b7447200010b [1]: https://gist.github.com/757767 https://gist.github.com/757767
- jjcm 16y agoHere's my Flodder Challenge (http://vimgolf.com/challenges/4d1a4f2ba860b744720000bf http://vimgolf.com/challenges/4d1a4f2ba860b744720000bf) solution: ~wqave~2wq@aw2@ab~ws**^]l~fe~ww@afg@aZZ (where ^] is an esc). Currently gets a score of 41 (although I only count 38 keystrokes...)
- deleted 16y ago[deleted]
- seles 16y agoYou can also use Vi for hundreds of challenges at http://golf.shinh.org http://golf.shinh.org alot of the newer challenges are stale but some of the older ones are gold.
- jjcm 16y agoDifferent game, that's counting the resulting code that you create. This is counting the number of keystrokes to create the code (for some at least).
- jjcm 16y agoFizzBuzz: (score: 71) i1^] qaYp CTRL+a q98@aggjjqaA Fizz^] 3jq32@agg:5 ENTER qaA Buzz^] 5jq19@a:%s/z B/zB/ ENTER ZZ
- psadauskas 16y agoYou don't need the "gg" (move to top) before ":5" (go to line 5)
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- clvv 16y agoYou 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.
- jjcm 16y agoLooks like Tim Pope started playing. He's talking about the "anti cheat" mechanisms on twitter: http://twitter.com/tpope/status/19900265129836544 http://twitter.com/tpope/status/19900265129836544
- fdhjtykyu 16y ago☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ==== ☆ ==== http://ta.gg/4wt http://ta.gg/4wt ====
- Calamitous 16y agoThis awesomeness unexpectedly sucked away half my afternoon. Not really sure whether to be upset about it our not. :) 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. :\ 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. All that aside, this is a barrel of fun, and I'm sure these kinks will get worked out.
- Calamitous 16y agoAlso, it would be awesome if I could delete some of my scores. :\ My bogus win and early attempts are cluttering up the leaderboard.
- dfhjtyjyt 16y agohttp://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX http://✂.ws/yX
- jh3 16y agoOnly 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?