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

Simple, Practical, and Common - 33353 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
  • Position: #2493 / 7358
  • Number of attempts: 5
One number per line - 18613 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 20
  • Position: #2245 / 3841
  • Number of attempts: 7
Wget failed to download redirections - 184 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
  • Position: #25 / 63
  • Number of attempts: 4
V to the i - 4743 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #956 / 1878
  • Number of attempts: 2
Add semicolons - 10785 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1103 / 3042
  • Number of attempts: 1
Box it - 7818 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 23
  • Position: #620 / 1861
  • Number of attempts: 4
Every other line - 2886 entries

AaAaAaA

  • Best score: 12
  • Best player score: 16
  • Position: #384 / 700
  • Number of attempts: 4
That hyphen - 2554 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 11
  • Position: #305 / 694
  • Number of attempts: 5
Just the middle - 11346 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #34 / 4160
  • Number of attempts: 3
Basic renumbering - 5584 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 20
  • Position: #778 / 1257
  • Number of attempts: 2
Order and join - 948 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #156 / 254
  • Number of attempts: 2
Logging with key - 301 entries

Sometimes it is better to log with meaningful key

  • Best score: 21
  • Best player score: 23
  • Position: #33 / 86
  • Number of attempts: 4
Sort with uniq OpenEmbedded package names - 33 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
  • Position: #11 / 13
  • Number of attempts: 1
Refactoring useless Method away - 91 entries

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

  • Best score: 47
  • Best player score: 48
  • Position: #6 / 32
  • Number of attempts: 4
Condensed Cases - 788 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
  • Position: #126 / 242
  • Number of attempts: 1
increment by column in XML - 146 entries

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

  • Best score: 19
  • Best player score: 22
  • Position: #27 / 53
  • Number of attempts: 3
Happy TvvO - 403 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 200
  • Number of attempts: 2
I forgot quotes - 15922 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1464 / 4159
  • Number of attempts: 3
Gray area - 724 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Position: #63 / 267
  • Number of attempts: 3
Two become one - 710 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
  • Position: #20 / 205
  • Number of attempts: 10
Where should I put the Newline? - 859 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #256 / 430
  • Number of attempts: 1
Shuffle puzzle - 317 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
  • Position: #24 / 101
  • Number of attempts: 3
Carriage return - 42 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
  • Position: #13 / 20
  • Number of attempts: 1
HTML formatting: vertical alignment for readability - 63 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
  • Position: #20 / 33
  • Number of attempts: 1
Going underground.... - 330 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
  • Position: #39 / 124
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10616 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #175 / 3663
  • Number of attempts: 3
Words in parens - 12848 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 16
  • Position: #2172 / 3943
  • Number of attempts: 1
Saving the hashes(#) - 1992 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
  • Position: #92 / 473
  • Number of attempts: 3
Refactor to Helpers - 48 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
  • Position: #5 / 23
  • Number of attempts: 6
Numbering a List - 1855 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 19
  • Position: #253 / 638
  • Number of attempts: 4
Simple text editing with Vim - 12230 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1204 / 3567
  • Number of attempts: 2
ゆきみ
Twitter:

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

entered into 31 challenges

contributed 0 challenges