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]

26185 active golfers, 298103 entries, 459 challenges

Open VimGolf challenges

Assignment Alignment - 703 entries

line up the operators. Use spaces, not tabs.

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

Generate a list of numbers - 253 entries

Please generate list of numbers from 1 to 20.

Kolakoski sequence -- level 1 - 51 entries

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

VimGolfNight - 463 entries

Based on "The name of the game".

Lisp Condense - 391 entries

Reduce 4 cons selection operations down to one function call.

Prefixes and suffixes - 506 entries

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

Happy TvvO - 357 entries

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

Swap assigned value - 499 entries

Simple problem but looking for interesting solutions.

lamb had a little Mary - 499 entries

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

Rule 110 - 31 entries

Compute the next 5 iterations of Rule 110 with the given starting state. https://en.wikipedia.org/wiki/Rule_110

Minimalist Limerick - 481 entries

Reproduce this lovely poem.

Braces or Brackets? - 627 entries

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

120 Degrees - 370 entries

Rotate that triangle.

Interactive git rebase changing commands - 151 entries

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

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

The meaning - 503 entries

Numbers are fun!

Reverse characters in a line - 585 entries

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

imports alignment (python) - 577 entries

Align as one import per line.

citizen_hacks_2019_part6 - 12 entries

For the Citizen Hacks 2019 Vim competition

Label grid cells (6x6) - 13 entries

Label the cells of a grid with its coordinates. Rows are labelled top to bottom from A to F, and columns left to right from A to F. Each cell has a coordinate MN, where M is the row letter and N is the column letter.

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

Ruby 1.9 compat - 557 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!

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

readability - 285 entries

Make the code readable by adding some spaces

Line 'em up! - 276 entries

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

Counting in binary - 393 entries

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

ASCII box - 295 entries

Don't forget to fix typos!

Remove semicolons after expressions - 463 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

Remember FizzBuzz? - 537 entries

Output FizzBuzz to 100. Start with nothing.

Text to HTML Table - 143 entries

Turn the plain text table to an HTML table.

lipsum lines - 239 entries

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

Pretty multi-line bash - 194 entries

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

Vim tetris - 338 entries

Vim can play tetris too!

Interweave two blocks of text - 502 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 - 523 entries

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

vim = 22 / 7 - 398 entries

pi square vim

Logging with key - 275 entries

Sometimes it is better to log with meaningful key

Reformat some Python - 511 entries

Fix some very bizarrely laid-out code.

NATO phonetic alphabet - 407 entries

Transform the series of words into a list.

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

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

Increment, increment, increment.... - 493 entries

Vim likes macros

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.

Reverse and double space - 411 entries

Reverse the order of the given lines and double space everything

Add Go XML to structure tags - 128 entries

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

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

Reformat a C golf submission - 476 entries

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

Delete unwanted lines - 339 entries

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

Separate the lines - 126 entries

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

PHP Array Syntax -> MailChimp Merge Syntax - 427 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!

VimGolf Chatter