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]

24030 active golfers, 261434 entries, 422 challenges

Open VimGolf challenges

Extract argument from function - 1933 entries

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

comment and uncomment code inline - 731 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.

Pascal's Triangle - 17 entries

Generate the first 17 left-justified rows of Pascal's triangle.

Adam's challenge - 712 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 - 644 entries

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

Kolakoski sequence -- level 1 - 36 entries

Generate the Kolakoski sequence as described by its first 75 terms.

Don't know what this is - 1678 entries

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

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.

replacing each line of a block selection - 2442 entries

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

Fiddle percentages into real numbers - 690 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 - 1325 entries

Put 3 spaces between adjacent letters.

Vertical Limit - 2070 entries

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

Whitespace, empty lines and tabs - 2518 entries

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

Order and join - 723 entries

There's something special about the input order.

Swap the operands under comparison - 196 entries

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

unknown command - 103 entries

I want change 5 words

Saving the hashes(#) - 1696 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 - 886 entries

Basic comment reformatting

Switch function arguments - 1801 entries

How to switch two arguments of a function.

Align commas - 782 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.

Number Sort - 232 entries

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

Python challenge - 79 entries

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

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

C Reformatting - 593 entries

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

Numbering a List - 1717 entries

Pretty simple, number the list.

Array Transposition - 129 entries

Transpose four arrays into two.

Do you demand a shrubbery? - 1001 entries

Use :redir and crush the emacsgolfers.

Fix the XML - 845 entries

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

The D a n k Side of the Moon - 28 entries

You're making a vaporwave cover of The Dark Side of the Moon. So for the tracklisting, you want to: 1. Change the track names to v a p o r c a s e 2. Double the track lengths (since you're slowing them down). Well... let's just double the minutes.

SFD-ROC: vimvimvim - 1264 entries

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

Shebangs for all - 1573 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 - 859 entries

Right AND down.

Mess in revision history - 944 entries

Help Joe clean up what Steve has cobbled.

Mirror Symmetry - 694 entries

Add backslashes.

Array propagate - 226 entries

Complete the array with the keys as part of the value

camel riding - 678 entries

add a prefix on some camelCase variables

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.

snowflake fractal - 26 entries

From step 0 to step 3 of a fractal

Where should I put the Newline? - 788 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.

From A to B - 487 entries

Mirror and change this text block

Todo list specification - 287 entries

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

remove dupes from array - 1185 entries

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

Kolakoski sequence -- level 2 - 8 entries

This time, the line above describes the line below. Level 1 at: http://www.vimgolf.com/challenges/5c880211ab65cb00065c74eb

Condensed Cases - 675 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 - 392 entries

Swap the blank lines and the aaa lines.

Change the content of a string - 1210 entries

This docstring is a complete lie. Fix it.

VimGolf Chatter