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]

30084 active golfers, 367045 entries, 507 challenges

Open VimGolf challenges

Counting in binary - 406 entries

"a" represents 0; "A" represents 1. Start from zero and count to 15.

Angular naming conventions - 279 entries

In angular, a directive name follows the camelCase convention. When the directive is used in an HTML template, the words are instead separated by a dash. Go from to the other the fastest!

Reformat most common surnames - 540 entries

Reformat copy-pasted table into a list of the most common surnames

Reformat some Python - 534 entries

Fix some very bizarrely laid-out code.

Increment, increment, increment.... - 530 entries

Vim likes macros

Right Align Part of the line - 39 entries

The challenge is to right align a part of the line - this is useful in some SQL queries where it's more clear which are the fields displayed

readability - 298 entries

Make the code readable by adding some spaces

Wrap the text of an email message to 79 characters - 521 entries

You're replying to an email with silly long lines. Clean them up.

Add to end of each line... kinda - 280 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

NATO phonetic alphabet - 429 entries

Transform the series of words into a list.

ASCII box - 304 entries

Don't forget to fix typos!

vim = 22 / 7 - 408 entries

pi square vim

Vim tetris - 347 entries

Vim can play tetris too!

Staircase - 6 entries

Going downstairs, while singing the alphabet song. Some vb practice to us all. Would it be much easier to make it go from left to right instead?

replace 2nd column blanks with values in same column if blank - 201 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.

Reformat a C golf submission - 492 entries

Take this C golf submission (for the "tiny but standards-compliant Hello World program" category, naturally), and turn it into formatted C code.

Reverse and double space - 424 entries

Reverse the order of the given lines and double space everything

Flip the bit - 92 entries

Change the specific 0 to a 1.

Logging with key - 281 entries

Sometimes it is better to log with meaningful key

Split the words - 346 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.

PHP Array Syntax -> MailChimp Merge Syntax - 440 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

lipsum lines - 245 entries

Convert a quoted block of text into strings in a list.

Pretty multi-line bash - 210 entries

Bash line continuations are much prettier when they're column aligned.

Mr. Hacker - 22 entries

Elvin is hacker. He has piece of users database from some social net site. Recently he installed Vim, and he wants to convert CSV DB to specific format `key=value' where `key' is login and `value' is password, but password in DB is encrypted in ROT13. Help him.

Stairs Indenting - 387 entries

Indent each line with <line number> whitespaces.

Delete unwanted lines - 350 entries

Delete all lines which does not end in "o.."

A simple change - 377 entries

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

Shuffle puzzle - 302 entries

Sort the lines in each indent group, and sort the groups. That's the pattern. Or just move lines around manually to get a better score.

Interactive git rebase changing commands - 155 entries

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

Context insensitive completion 0 - 461 entries

Buried in the lines you're not supposed to add is the line "Add this line!" Add that line to the top of the file.

citizen_hacks_2019_challenge4 - 62 entries

For the Citizen Hacks 2019 Vim competition.

Sorting paragraphs - 456 entries

Order the paragraphs correctly, per prefixed index

Pairs of numbers - 340 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

Replacing some words - 405 entries

How fast could it be?

Add fold markers to a .c file - 447 entries

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

Letterbox - 83 entries

Make a box!

Text to HTML Table - 156 entries

Turn the plain text table to an HTML table.

Going underground.... - 303 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

Generate English Alphabets - 425 entries

Start with a, get up to z.

7th Birthday - 180 entries

We have a bunch of numbers written from 0 to 9 in the order present in the text input file. The task is to create 7 by replacing the numbers with dashes.

Indentation - 420 entries

Indent each line according to the right number of spaces it needs.

The Quick Brown Fox Jumps Over The Lazy Vim - 349 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

Line Zipper - 403 entries

Zip/pair related lines.

Sort the VimGolf challenges by popularity - 324 entries

"Sort by popularity" is a good order to play the challenges. Not perfect, but you could do a lot worse. ;) Input is a sample copy-pasted from Some of the challenge names have digits that will get in your way, so read ":help :sort" for hints on sorting with a regex. When you're done, try your solution on the full list!

Case preserving word replacement - 395 entries

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

Context Insensitive completion 1 - 405 entries

Finish writing this simple Python HTTP server.

Comparing Schema With Diff - 50 entries

Sometimes databases output things differently one to another. Fixing things that are out of order will make the diffs more usable.

Insert a Markdown link - 392 entries

Put a link in a markdown document, using the after-the-paragraph format.

you're stuck on jQuery < 1.7 - 325 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

vim1001 - 244 entries

change number 1001 into a "vim1001 sequence". (My first challenge, hope it is not too bad... )

VimGolf Chatter