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

Two become one - 676 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: 28
  • Number of attempts: 2
Saving the hashes(#) - 1770 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: 25
  • Number of attempts: 3
Simple, Practical, and Common - 25753 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: 4
One number per line - 13426 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 21
  • Number of attempts: 1
Exchanging Quotes - 761 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 39
  • Number of attempts: 1
Hole-in-one - 936 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 19
  • Number of attempts: 2
replacing each line of a block selection - 2545 entries

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

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 4
Mess in revision history - 985 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 18
  • Number of attempts: 3
Split the words - 334 entries

Add the spaces manually if you must, but if you use Vim's spell checking feature wisely, I think you'll save a LARGE number of strokes.

  • Best score: 18
  • Best player score: 40
  • Number of attempts: 1
Whitespace, empty lines and tabs - 2557 entries

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

  • Best score: 16
  • Best player score: 17
  • Number of attempts: 9
Vice versa - 6071 entries

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Number of attempts: 2
Do you demand a shrubbery? - 1016 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 4
quotes inside quotes - 2807 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 2
Swap values - 3628 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 15
  • Number of attempts: 1
Swap assigned value - 499 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 1
NBCU Weekly Challenge - Test - 215 entries

Just testing.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 2
The name of the game - 582 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 1
switch variable - 4345 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 2
V to the i - 3977 entries

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

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 2
Letter case trickery - 1448 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 11
  • Number of attempts: 1
Create Leading Zeros - 192 entries

Create leading zeros only for id columns. Please use generic approach!

  • Best score: 23
  • Best player score: 26
  • Number of attempts: 2
learn vim in short time - 186 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Number of attempts: 1
Neither Fizz nor Buzz - 191 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 20
  • Number of attempts: 2
Just the middle - 9428 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 3
Word frequency alignment - 198 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Append semicolon after expressions - 869 entries

Some lines need the semicolon, some don't.

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

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 2
That hyphen - 2205 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 11
  • Number of attempts: 3
Sort by sum of numbers in a line(?) - 45 entries

The lines with the biggest sums need to be at the top. The sums are on the right, which makes life hard. Maybe you can find a feature that will do all the work for you...

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
Reverse Simple Deletion - 714 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Vertical Limit - 2126 entries

transform a succession of one word lines to a an array of strings

  • Best score: 21
  • Best player score: 28
  • Number of attempts: 1
Gray area - 645 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Don't know what this is - 1775 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 4
Extract argument from function - 2019 entries

The aim is to see if you can do some refactoring very fast.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 4
Search and Replace 0 - 4170 entries

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

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

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 3
Switch function arguments - 1843 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 140 entries

Someone has vandalized our text (again). Please fix to read: The Quick Brown Fox Jumps Over The Lazy Dog.

  • Best score: 25
  • Best player score: 28
  • Number of attempts: 3
Simple text editing with Vim - 10544 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
SFD-ROC: vimvimvim - 1294 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 14
  • Number of attempts: 1
Words in parens - 11183 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 3
Stairs Indenting - 360 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 1
I forgot quotes - 12173 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Number of attempts: 3

Contributed Challenges

Aligning function arguments to match a specific coding style - 159 entries

Most projects have specific coding style guidelines. In this case, the argument list must be broken into a new line for each argument, with the argument names right aligned, taking into account pointers.

buz
Twitter:

Mo' code

entered into 43 challenges

contributed 1 challenges