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

Search and Replace 0 - 4792 entries

Replace every instance of 'aaa' with 'xaaax'.

  • Best score: 12
  • Best player score: 12
  • Position: #158 / 1585
  • Number of attempts: 6
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 13
  • Position: #210 / 249
  • Number of attempts: 1
Define to require - 118 entries

When JSHint is enabled, there's a rule that doesn't let you have more than 6 arguments in a function, so the moment you need to add a 7th argument, you need to do a refactoring.

  • Best score: 62
  • Best player score: 77
  • Position: #18 / 48
  • Number of attempts: 3
Enumerate words - 250 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 34
  • Position: #80 / 89
  • Number of attempts: 1
Harder than "abcd > a b c d" - 77 entries

Not as easy as the last challenge. This time, just one space between a and b, up to 25 spaces between y and z. (Removed some lines; diff was too long.)

  • Best score: 15
  • Best player score: 26
  • Position: #31 / 40
  • Number of attempts: 1
Groups magic - 150 entries

Regexp or macros for string converting: (a) -> ___ (abc) -> ____ (abcd) -> ______ All in the '(' replace to _ multiply by char count + ()

  • Best score: 13
  • Best player score: 14
  • Position: #24 / 90
  • Number of attempts: 2
abcd > a b c d - 280 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #16 / 218
  • Number of attempts: 1
Python: Lots of function arguments - 102 entries

The function definition is too long for one line. The modeline helps you with some typical Python indent settings.

  • Best score: 13
  • Best player score: 14
  • Position: #21 / 46
  • Number of attempts: 1
Readable Rubyhash - 244 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 23
  • Best player score: 28
  • Position: #46 / 92
  • Number of attempts: 1
Printable ASCII characters - 124 entries

From a blank input, print all 95 printing ASCII characters one per line, from space to tilde.

  • Best score: 22
  • Best player score: 48
  • Position: #38 / 42
  • Number of attempts: 1
A simple change - 442 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 14
  • Position: #55 / 189
  • Number of attempts: 1
Extract text from xml - 109 entries

Extract text from xml file (ignoring commented out elements) and create a one line regex.

  • Best score: 28
  • Best player score: 38
  • Position: #21 / 44
  • Number of attempts: 1
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #65 / 356
  • Number of attempts: 3
lamb had a little Mary - 586 entries

"Mary" and "lamb" are swapped. Unswap them. Fast as you can.

  • Best score: 16
  • Best player score: 36
  • Position: #92 / 163
  • Number of attempts: 2
Unwrap the text of an email message - 185 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 24
  • Position: #41 / 72
  • 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: 30
  • Position: #353 / 473
  • Number of attempts: 1
Let's play some Ivmgolf - 1091 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #148 / 441
  • Number of attempts: 2
replacing each line of a block selection - 2947 entries

replace each line's ../assets/js with /javascripts

  • Best score: 18
  • Best player score: 18
  • Position: #13 / 768
  • Number of attempts: 8
Switch function arguments - 2082 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #199 / 652
  • Number of attempts: 2
Append semicolon after expressions - 1005 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #143 / 403
  • Number of attempts: 3
Remove semicolons after expressions - 628 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 8
  • Position: #147 / 258
  • Number of attempts: 1
switch variable - 5036 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #706 / 1736
  • Number of attempts: 2
The meaning - 558 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #11 / 356
  • Number of attempts: 2
Remember FizzBuzz? - 654 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 55
  • Position: #59 / 177
  • Number of attempts: 5
Change the content of a string - 1476 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #72 / 558
  • Number of attempts: 5
Sort and add attributes - 1327 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 34
  • Position: #304 / 529
  • Number of attempts: 2
Add fold markers to a .c file - 556 entries

Fold markers can make it easier to navigate source code. Add them to this .c file.

  • Best score: 30
  • Best player score: 30
  • Position: #18 / 172
  • Number of attempts: 8
Reconstruct the Sentence - 1369 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 20
  • Best player score: 21
  • Position: #176 / 384
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3339 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 22
  • Position: #267 / 736
  • Number of attempts: 6
Simple text editing with Vim - 12290 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #916 / 3581
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6560 entries

A simple case of removing unneeded code and fixing broken indentation.

  • Best score: 32
  • Best player score: 32
  • Position: #8 / 1616
  • Number of attempts: 10
Pawel Obrok
Twitter:

Arrrr! I'm coding Ruby!

entered into 31 challenges

contributed 0 challenges