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]

23791 active golfers, 256944 entries, 417 challenges

Open VimGolf challenges

comment and uncomment code inline - 721 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

Learn some german verbs - 371 entries

The list needs to be structured so we can print in verbatim and feel ok about how it looks.

Adam's challenge - 694 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

Missing Library and a Typo - 640 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

Don't know what this is - 1669 entries

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

unknown command - 102 entries

I want change 5 words

replacing each line of a block selection - 2440 entries

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

Python challenge - 79 entries

Change the types of the variables in the list from str to float, while keeping the truncation.

Fiddle percentages into real numbers - 685 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

Space out the alphabet - 1318 entries

Put 3 spaces between adjacent letters.

Swap the operands under comparison - 191 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

Vertical Limit - 2063 entries

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

Order and join - 717 entries

There's something special about the input order.

Whitespace, empty lines and tabs - 2518 entries

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

snowflake fractal - 26 entries

From step 0 to step 3 of a fractal

Number Sort - 231 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

Saving the hashes(#) - 1688 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.

comments galore - 883 entries

Basic comment reformatting

Switch function arguments - 1795 entries

How to switch two arguments of a function.

Align commas - 767 entries

There are 15,000 aligning challenges on vimgolf.com, and they're all exactly the same. I hope this one is a little different.

Letter case trickery - 1416 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.

Make it more readable - 1719 entries

Insert blank lines to make it more organized and readable

Scrambled numbers - 704 entries

Four is NOT 1. One is 1.

Make HTML List - 855 entries

Turn the comma separated list into an unordered html list.

Array Transposition - 124 entries

Transpose four arrays into two.

C Reformatting - 581 entries

You may use Visual mode... or not. #uppercase

Santa's naughty / nice list - 52 entries

Christmas is here and Santa hasn't decided who's naughty or nice yet. He's given a list of names to his programmer friend to quickly split the children into naughty and nice. Hint: There's a hidden pattern that might be familiar.

Numbering a List - 1716 entries

Pretty simple, number the list.

Fix the XML - 837 entries

The challenge consists in having a valid xml from an incomplete source.

Do you demand a shrubbery? - 988 entries

Use :redir and crush the emacsgolfers.

SFD-ROC: vimvimvim - 1257 entries

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

Shebangs for all - 1568 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

Count both ways - 854 entries

Right AND down.

Mess in revision history - 936 entries

Help Joe clean up what Steve has cobbled.

Mirror Symmetry - 686 entries

Add backslashes.

Array propagate - 220 entries

Complete the array with the keys as part of the value

camel riding - 678 entries

add a prefix on some camelCase variables

From A to B - 487 entries

Mirror and change this text block

Todo list specification - 284 entries

The every item on the todo list must be done today. Modify the list to reflect that.

Where should I put the Newline? - 785 entries

Help me put the newline.

Hole-in-one - 935 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.

remove dupes from array - 1179 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

Condensed Cases - 670 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.

Paragraph breaks - 389 entries

Swap the blank lines and the aaa lines.

Remember VimGolf Rules ! - 186 entries

Rules, ... and don't forget !

Change the content of a string - 1208 entries

This docstring is a complete lie. Fix it.

Alsa configuration - 456 entries

I'm tweaking my ~/.asoundrc file!

Gray area - 614 entries

It's a golf metaphor or something.

Let's play some Ivmgolf - 879 entries

Oops, I spelled that wrong.

The Cake is a Lie - 1106 entries

Correct the capitalization of each word

VimGolf Chatter