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]

27079 active golfers, 313276 entries, 468 challenges

Open VimGolf challenges

Reverse Simple Deletion - 730 entries

You did the simple deletion, now reverse it.

The name of the game - 592 entries

End up with the name of the game.

Assignment Alignment - 716 entries

line up the operators. Use spaces, not tabs.

citizen_hacks_2019_challenge6 - 35 entries

For the Citizen Hacks 2019 Vim competition.

Prefixes and suffixes - 517 entries

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

VimGolfNight - 468 entries

Based on "The name of the game".

Generate a list of numbers - 255 entries

Please generate list of numbers from 1 to 20.

Lisp Condense - 396 entries

Reduce 4 cons selection operations down to one function call.

lamb had a little Mary - 517 entries

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

Happy TvvO - 364 entries

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

Swap assigned value - 505 entries

Simple problem but looking for interesting solutions.

Braces or Brackets? - 643 entries

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

120 Degrees - 388 entries

Rotate that triangle.

Triangular Numbers - 63 entries

Generate the first 50 triangular numbers.

Minimalist Limerick - 493 entries

Reproduce this lovely poem.

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!

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!

imports alignment (python) - 583 entries

Align as one import per line.

Interactive git rebase changing commands - 154 entries

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

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

Remove semicolons after expressions - 467 entries

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

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.

ASCII box - 300 entries

Don't forget to fix typos!

Counting in binary - 393 entries

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

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

Line 'em up! - 278 entries

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

readability - 285 entries

Make the code readable by adding some spaces

citizen_hacks_2019_challenge1 - 27 entries

For the Citizen Hacks 2019 Vim competition

Remember FizzBuzz? - 537 entries

Output FizzBuzz to 100. Start with nothing.

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

replace 2nd column blanks with values in same column if blank - 186 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 most common surnames - 529 entries

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

vim = 22 / 7 - 402 entries

pi square vim

Vim tetris - 338 entries

Vim can play tetris too!

lipsum lines - 242 entries

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

Reformat some Python - 514 entries

Fix some very bizarrely laid-out code.

Hash staircase - 36 entries

Can you use a strategy to come up with this pattern?

Text to HTML Table - 148 entries

Turn the plain text table to an HTML table.

Logging with key - 276 entries

Sometimes it is better to log with meaningful key

Pretty multi-line bash - 196 entries

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

NATO phonetic alphabet - 408 entries

Transform the series of words into a list.

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

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

Increment, increment, increment.... - 498 entries

Vim likes macros

Kolakoski sequence -- level 1 - 51 entries

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

Reverse and double space - 418 entries

Reverse the order of the given lines and double space everything

If-then-else regexp - 37 entries

Rules: - golf is never following golf - vim comes first! Drawing a finite-state machine diagram could help. #regexp

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.

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.

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!

VimGolf Chatter