Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put [challenge ID]

Played Challenges

HTML formatting: vertical alignment for readability - 59 entries

We did this a VimGolf challenge at work and now that we have finished I want to see if you guys can come up with something even better than we could. Our best solution was 44 keystrokes.

  • Best score: 33
  • Best player score: 60
  • Number of attempts: 1
Refactoring useless Method away - 78 entries

Real-life challenge, convert a bunch of ifs to a switch statement

  • Best score: 47
  • Best player score: 48
  • Number of attempts: 4
Sort with uniq OpenEmbedded package names - 26 entries

For each line take 4th dirname of path. For example: "alsa-utils", "gawk-3.1.5", ... But! But if previous result is "files", take 3rd dirname instead. For example: "mktemp", "mklibs" ... If version is present in package name (dash is the separator character), take it. For example: "apt-0.9.9.4" prevails over "apt". And finally, use sort -u to get unique names!

  • Best score: 32
  • Best player score: 63
  • Number of attempts: 1
Going underground.... - 291 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

  • Best score: 22
  • Best player score: 28
  • Number of attempts: 2
Two become one - 682 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 26
  • Number of attempts: 10
Carriage return - 41 entries

I have some raw data from terminal output which uses carriege return for formatting. Carriage return sets the pointer to the first character on the line, and subsequent characters will overwrite what was there before. The challange is to simulate the terminal behaviour in vim. I'm kind of unsure if I should have skipped lines 9 and 15, since there might be some interesting solutions which are not that generic. Happy Golfing!

  • Best score: 22
  • Best player score: 25
  • Number of attempts: 1
Box it - 4495 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 23
  • Number of attempts: 4
Gray area - 655 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 3
Order and join - 773 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 2
That hyphen - 2263 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 11
  • Number of attempts: 5
Refactor to Helpers - 45 entries

This Rails partial is almost all template escapes. Put it into a helper, and refactor each case to methods so we can build out the controls for each. (I've converted to tabs - fighting with Vimgolf's default config shouldn't be part of the challenge.)

  • Best score: 147
  • Best player score: 160
  • Number of attempts: 6
Just the middle - 9765 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 9782 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 3
Add semicolons - 4860 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 1
Where should I put the Newline? - 812 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 1
Simple text editing with Vim - 10706 entries

Make the pairs of lines match up by making each second line same as first

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 2
V to the i - 4155 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 2
Simple, Practical, and Common - 27217 entries

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." This challenge is just a simple movement and entering text at a certain place.

  • Best score: 22
  • Best player score: 23
  • Number of attempts: 5
Happy TvvO - 357 entries

Don’t forget the past, learn from it. Happy New Year.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 2
Shuffle puzzle - 289 entries

Sort the lines in each indent group, and sort the groups. That's the pattern. Or just move lines around manually to get a better score.

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 3
I forgot quotes - 12879 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Number of attempts: 3
Words in parens - 11444 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 16
  • Number of attempts: 1
Condensed Cases - 706 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 1
Wget failed to download redirections - 162 entries

Output of a wget session, where 302 where not properly handled due to certificate problems, has been saved to a file. Keep the correct URLs to start again downloading.

  • Best score: 15
  • Best player score: 18
  • Number of attempts: 4
increment by column in XML - 140 entries

modify an arbitrary "column" in an xml table by incrementing a an arbitrary placeholder string

  • Best score: 19
  • Best player score: 22
  • Number of attempts: 3
One number per line - 14428 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 20
  • Number of attempts: 7
Every other line - 2259 entries

AaAaAaA

  • Best score: 12
  • Best player score: 16
  • Number of attempts: 4
Numbering a List - 1754 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 19
  • Number of attempts: 4
Basic renumbering - 4854 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 20
  • Number of attempts: 2
Saving the hashes(#) - 1806 entries

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

  • Best score: 20
  • Best player score: 21
  • Number of attempts: 3
Logging with key - 276 entries

Sometimes it is better to log with meaningful key

  • Best score: 21
  • Best player score: 23
  • Number of attempts: 4
ゆきみ
Twitter:

Non-24 になってしまった人。仕事はソフトウェア修理屋さん。趣味はハードウェアの修理。古い道具と懐かしい未来観が好き。 Time Tagged Data の表示に長いこと思い馳せています。 2004 年辺りをさまよっています。 しばしば正気を失っているので、誤字脱字込みで絡まれた時はスルーかブロックをお願いします。

entered into 31 challenges

contributed 0 challenges