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]

21782 active golfers, 223575 entries, 385 challenges

Open VimGolf challenges

Make it more readable - 1656 entries

Insert blank lines to make it more organized and readable

Fix the XML - 793 entries

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

Do you demand a shrubbery? - 946 entries

Use :redir and crush the emacsgolfers.

Numbering a List - 1676 entries

Pretty simple, number the list.

Count both ways - 840 entries

Right AND down.

Mirror Symmetry - 660 entries

Add backslashes.

SFD-ROC: vimvimvim - 1222 entries

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

Mess in revision history - 899 entries

Help Joe clean up what Steve has cobbled.

From A to B - 468 entries

Mirror and change this text block

Shebangs for all - 1542 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.

camel riding - 663 entries

add a prefix on some camelCase variables

Paragraph breaks - 376 entries

Swap the blank lines and the aaa lines.

Simple addition - 203 entries

The right side of the equation is already there. We just need the left one now.

Where should I put the Newline? - 772 entries

Help me put the newline.

Hello ${world} - 185 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

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

Create a table - 183 entries

Convert the given input into a formatted table

Alsa configuration - 438 entries

I'm tweaking my ~/.asoundrc file!

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

remove dupes from array - 1155 entries

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

Stairstep digits - 192 entries

Remove the evens. Double the odds.

Gray area - 601 entries

It's a golf metaphor or something.

Change the content of a string - 1192 entries

This docstring is a complete lie. Fix it.

Nesting SASS - 184 entries

Move a block inside another block and indent it

Let's play some Ivmgolf - 855 entries

Oops, I spelled that wrong.

Subnetting - 54 entries

Split up the IP addresses in the right way.

Interactive git rebase changing commands - 131 entries

How to change the action of some commits in git rebase dialog.

Two become one - 626 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

The Cake is a Lie - 1096 entries

Correct the capitalization of each word

Combines all items - 219 entries

For each line that starts with the same number I want to combine its contents

Paragraph sort - 287 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

Sort and add attributes - 1034 entries

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

Ruby 1.9 hashes - 1022 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!

Append semicolon after expressions - 810 entries

Some lines need the semicolon, some don't.

Reconstruct the Sentence - 982 entries

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

Wrap text in quotes - 261 entries

All the blocks of text should be wrapped in quotation marks.

Replace and keep the case - 317 entries

Replace all instance of plugin and Plugin to device and Device.

Long prime list - filter version - 19 entries

I've used the maximum input/diff/output size allowed by vimgolf to get a list of integers up to 1460 separated by newlines, and your goal is to only keep the lines containing primes. There are 232 of them I hope some of you will golf vimscript itself to create some function to run as a primality check for each line, which is a good exercise if you haven't done much vimscript yet! You're invited to also try copy-pasting and doing other non-smart text manipulation. Even more interesting would be to see a solution that uses text manipulation to do the filtering! Whether you use vimscript, normal-mode primality checks, or text manipulation, as long as the end result is valid, your answer will be valid! Let's see which method does better here. Best of luck!

Exchanging Quotes - 722 entries

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

Add Go XML to structure tags - 122 entries

The Go programming language can directly map XML to structure fields. Add the correct XML tag after each field.

Make Fancy Header - 867 entries

Make the header text stand out with surrounding asterisks

Mute the second method of this script - 391 entries

prepend a # infront of every line of the second method

Separate the lines - 116 entries

Every other line is mixed up. Separate them into their original texts.

Text to HTML Table - 118 entries

Turn the plain text table to an HTML table.

Generate a list of numbers - 213 entries

Please generate list of numbers from 1 to 20.

replace 2nd column blanks with values in same column if blank - 171 entries

Where ,SOMELOGB and ,SOMELOGC replaces each /r carriage return if 2nd column is blank. The replace only happens if 2nd column is blank though and should replace up to the non blank row.

Python Hello World! Reformatting - 808 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

A Simple One - 795 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

Flodder-challenge - 784 entries

Replace the text the most efficient and win!

Un"finnish"ed Work - 96 entries

Replace å by a, ä by a and ö by o.

VimGolf Chatter