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]

26719 active golfers, 308057 entries, 462 challenges

Open VimGolf challenges

Triangular Numbers - 59 entries

Generate the first 50 triangular numbers.

VimGolfNight - 463 entries

Based on "The name of the game".

Lisp Condense - 392 entries

Reduce 4 cons selection operations down to one function call.

lamb had a little Mary - 507 entries

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

Happy TvvO - 358 entries

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

Swap assigned value - 502 entries

Simple problem but looking for interesting solutions.

Braces or Brackets? - 635 entries

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

Minimalist Limerick - 488 entries

Reproduce this lovely poem.

citizen_hacks_2019_challenge1 - 26 entries

For the Citizen Hacks 2019 Vim competition

120 Degrees - 380 entries

Rotate that triangle.

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

Reverse characters in a line - 593 entries

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

The meaning - 506 entries

Numbers are fun!

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.

imports alignment (python) - 581 entries

Align as one import per line.

Hash staircase - 36 entries

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

Interactive git rebase changing commands - 151 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.

ASCII box - 300 entries

Don't forget to fix typos!

If-then-else regexp - 37 entries

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

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

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.

Remember FizzBuzz? - 537 entries

Output FizzBuzz to 100. Start with nothing.

Kolakoski sequence -- level 1 - 51 entries

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

Reformat most common surnames - 528 entries

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

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

vim = 22 / 7 - 402 entries

pi square vim

lipsum lines - 242 entries

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

Vim tetris - 338 entries

Vim can play tetris too!

Text to HTML Table - 148 entries

Turn the plain text table to an HTML table.

Pretty multi-line bash - 196 entries

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

Reformat some Python - 514 entries

Fix some very bizarrely laid-out code.

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.

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

citizen_hacks_2019_challenge3 - 20 entries

For the Citizen Hacks 2019 Vim competition.

Reverse and double space - 414 entries

Reverse the order of the given lines and double space everything

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.

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.

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!

Delete unwanted lines - 341 entries

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

7th Birthday - 171 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.

Pairs of numbers - 336 entries

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

A simple change - 366 entries

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

VimGolf Chatter