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]

30452 active golfers, 371086 entries, 513 challenges

Open VimGolf challenges

Tables, Functions, Sprocs - 95 entries

In order to load some scripts into my database in the correct order I need to load tables first (t_), then functions (fn_), then stored procedures (sp_). The order of the t_ lines and the order of the sp_ lines should also match. Reorder the lines so they will load correctly.

Interweave two blocks of text - 530 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

Remember FizzBuzz? - 548 entries

Output FizzBuzz to 100. Start with nothing.

Counting in binary - 405 entries

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

Reformat most common surnames - 540 entries

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

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 some Python - 534 entries

Fix some very bizarrely laid-out code.

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

Vim likes macros

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.

NATO phonetic alphabet - 431 entries

Transform the series of words into a list.

readability - 298 entries

Make the code readable by adding some spaces

C to python code snippet - 29 entries

C code can be easily translated into Python code. However, the difference in syntax can make this process tedious and time-consuming. Can Vim help you here?

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?

vim = 22 / 7 - 408 entries

pi square vim

ASCII box - 304 entries

Don't forget to fix typos!

Vim tetris - 347 entries

Vim can play tetris too!

Right Align Part of the line - 43 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

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

add line and index - 48 entries

a missed line and index names need to be added

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.

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!

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.

Logging with key - 281 entries

Sometimes it is better to log with meaningful key

Stairs Indenting - 387 entries

Indent each line with <line number> whitespaces.

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.

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 ...

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.

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.

Flip the bit - 92 entries

Change the specific 0 to a 1.

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?

Interactive git rebase changing commands - 155 entries

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

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.

Text to HTML Table - 156 entries

Turn the plain text table to an HTML table.

citizen_hacks_2019_challenge4 - 63 entries

For the Citizen Hacks 2019 Vim competition.

Generate English Alphabets - 425 entries

Start with a, get up to z.

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...

Indentation - 420 entries

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

Letterbox - 83 entries

Make a box!

Line Zipper - 403 entries

Zip/pair related lines.

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."

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.

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 - 397 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.

Insert a Markdown link - 392 entries

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

VimGolf Chatter