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]

27402 active golfers, 319976 entries, 469 challenges

Open VimGolf challenges

Combines all items - 250 entries

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

Assignment Alignment - 716 entries

line up the operators. Use spaces, not tabs.

Flip the bit - 86 entries

Change the specific 0 to a 1.

Letterbox - 83 entries

Make a box!

Prefixes and suffixes - 523 entries

Generate all prefixes of "vimchallenge", then all suffixes.

VimGolfNight - 468 entries

Based on "The name of the game".

lamb had a little Mary - 517 entries

"Mary" and "lamb" are swapped. Unswap them. Fast as you can.

Lisp Condense - 396 entries

Reduce 4 cons selection operations down to one function call.

Generate a list of numbers - 255 entries

Please generate list of numbers from 1 to 20.

Happy TvvO - 364 entries

Don’t forget the past, learn from it. Happy New Year.

Braces or Brackets? - 643 entries

Someone forgot whether to use braces or brackets and you have to clean up their code!

Swap assigned value - 505 entries

Simple problem but looking for interesting solutions.

Minimalist Limerick - 493 entries

Reproduce this lovely poem.

120 Degrees - 388 entries

Rotate that triangle.

Reverse characters in a line - 601 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

The meaning - 508 entries

Numbers are fun!

imports alignment (python) - 583 entries

Align as one import per line.

Angular naming conventions - 278 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!

Triangular Numbers - 63 entries

Generate the first 50 triangular numbers.

Remove semicolons after expressions - 488 entries

A follow-up for

citizen_hacks_2019_challenge6 - 35 entries

For the Citizen Hacks 2019 Vim competition.

Ruby 1.9 compat - 562 entries

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

Counting in binary - 402 entries

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

Interactive git rebase changing commands - 154 entries

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

Santa's naughty / nice list - 75 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.

Remember FizzBuzz? - 547 entries

Output FizzBuzz to 100. Start with nothing.

readability - 291 entries

Make the code readable by adding some spaces

ASCII box - 302 entries

Don't forget to fix typos!

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

Add to end of each line... kinda - 269 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?

Interweave two blocks of text - 516 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?

Reformat most common surnames - 537 entries

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

Line 'em up! - 279 entries

It can be so hard to keep everything neatly lined-up. Somebody clearly hasn't bothered here. Tidy it up, please!

vim = 22 / 7 - 408 entries

pi square vim

Vim tetris - 343 entries

Vim can play tetris too!

Reformat some Python - 514 entries

Fix some very bizarrely laid-out code.

lipsum lines - 242 entries

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

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

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

Increment, increment, increment.... - 503 entries

Vim likes macros

Logging with key - 276 entries

Sometimes it is better to log with meaningful key

NATO phonetic alphabet - 408 entries

Transform the series of words into a list.

Pretty multi-line bash - 196 entries

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

Text to HTML Table - 148 entries

Turn the plain text table to an HTML table.

Reverse and double space - 418 entries

Reverse the order of the given lines and double space everything

Reformat a C golf submission - 481 entries

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

Split the words - 334 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 - 434 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!

Stairs Indenting - 380 entries

Indent each line with <line number> whitespaces.

Delete unwanted lines - 342 entries

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

Shuffle puzzle - 293 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.

VimGolf Chatter