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]

Played Challenges

vim = 22 / 7 - 424 entries

pi square vim

  • Best score: 20
  • Best player score: 402
  • Position: #130 / 130
  • Number of attempts: 1
V to the i - 4645 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 18
  • Position: #1851 / 1859
  • Number of attempts: 1
Extract argument from function - 2257 entries

The aim is to see if you can do some refactoring very fast.

  • Best score: 13
  • Best player score: 26
  • Position: #727 / 733
  • Number of attempts: 1
Search and Replace 0 - 4695 entries

Replace every instance of 'aaa' with 'xaaax'.

  • Best score: 12
  • Best player score: 18
  • Position: #1301 / 1556
  • Number of attempts: 1
That hyphen - 2512 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 39
  • Position: #684 / 685
  • Number of attempts: 1
Python Hello World! Reformatting - 907 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 54
  • Position: #338 / 353
  • Number of attempts: 1
Create Leading Zeros - 205 entries

Create leading zeros only for id columns. Please use generic approach!

  • Best score: 23
  • Best player score: 46
  • Position: #59 / 77
  • Number of attempts: 1
O Christmas Tree - 102 entries

Design a macro that makes trees grow (or ASCII triangles, if that's too hard).

  • Best score: 22
  • Best player score: 31
  • Position: #32 / 41
  • Number of attempts: 2
-a-b-c- - 3125 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #425 / 1114
  • Number of attempts: 13
Count both ways - 966 entries

Right AND down.

  • Best score: 13
  • Best player score: 19
  • Position: #319 / 343
  • Number of attempts: 3
Suffix sort - 242 entries

Sort from the end of the line, as if the letters in each line were reversed.

  • Best score: 19
  • Best player score: 30
  • Position: #54 / 63
  • Number of attempts: 2
NBCU Weekly Challenge - Test - 233 entries

Just testing.

  • Best score: 18
  • Best player score: 22
  • Position: #108 / 112
  • Number of attempts: 1
Change name of a variable - 163 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Position: #67 / 127
  • Number of attempts: 1
Lisp Condense - 432 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 19
  • Position: #143 / 152
  • Number of attempts: 3
120 Degrees - 454 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 57
  • Position: #139 / 141
  • Number of attempts: 1
Neither Fizz nor Buzz - 221 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 20
  • Position: #60 / 97
  • Number of attempts: 3
Do you demand a shrubbery? - 1107 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 26
  • Position: #187 / 292
  • Number of attempts: 2
Don't know what this is - 1955 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

  • Best score: 11
  • Best player score: 17
  • Position: #533 / 573
  • Number of attempts: 2
Two become one - 703 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 37
  • Position: #168 / 202
  • Number of attempts: 1
Where should I put the Newline? - 845 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Position: #407 / 422
  • Number of attempts: 1
Shuffle puzzle - 307 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.

  • Best score: 13
  • Best player score: 16
  • Position: #76 / 100
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10555 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #458 / 3642
  • Number of attempts: 5
attr_aligner - 3402 entries

Two attr keywords. Two separate indentations. Align the colons.

  • Best score: 19
  • Best player score: 33
  • Position: #514 / 685
  • Number of attempts: 1
Counting in binary - 442 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #7 / 110
  • Number of attempts: 21
quotes inside quotes - 3051 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

  • Best score: 14
  • Best player score: 19
  • Position: #972 / 1050
  • Number of attempts: 1
Words in parens - 12769 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 22
  • Position: #3521 / 3925
  • Number of attempts: 3
Pairs of numbers - 346 entries

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

  • Best score: 26
  • Best player score: 60
  • Position: #120 / 130
  • Number of attempts: 2
Word frequency alignment - 250 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

  • Best score: 5
  • Best player score: 158
  • Position: #148 / 148
  • Number of attempts: 1
fib.c cleanup - 60 entries

cleanup the file

  • Best score: 15
  • Best player score: 16
  • Position: #38 / 51
  • Number of attempts: 1
Enumerate words - 241 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Position: #49 / 86
  • Number of attempts: 3
Prefixes and suffixes - 571 entries

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

  • Best score: 17
  • Best player score: 17
  • Position: #12 / 186
  • Number of attempts: 10
abcd > a b c d - 267 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 16
  • Position: #195 / 208
  • Number of attempts: 1
NATO phonetic alphabet - 490 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 23
  • Position: #128 / 185
  • Number of attempts: 2
Add links to an existing HTML table - 60 entries

Add these links at that top to the respective table cell. First link, first cell, etc.

  • Best score: 42
  • Best player score: 57
  • Position: #17 / 26
  • Number of attempts: 8
SFD-ROC: The Quick Brown Fox - 160 entries

Someone has vandalized our text (again). Please fix to read: The Quick Brown Fox Jumps Over The Lazy Dog.

  • Best score: 24
  • Best player score: 98
  • Position: #97 / 97
  • Number of attempts: 1
The Quick Brown Fox Jumps Over The Lazy Vim - 392 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."

  • Best score: 8
  • Best player score: 11
  • Position: #137 / 182
  • Number of attempts: 3
The name of the game - 636 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 12
  • Position: #303 / 348
  • Number of attempts: 1
Complete the circuit grid! - 72 entries

Continuing from the last challenge, add additional rows to the grid. Change each of the names from 'A1'...'A10' to 'B1'...'B10', 'C1'...'C10', etc, and for each new row add 0.7 to the X values in the (X Y) at the end of each line.

  • Best score: 49
  • Best player score: 71
  • Position: #16 / 26
  • Number of attempts: 4
lamb had a little Mary - 569 entries

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

  • Best score: 16
  • Best player score: 44
  • Position: #147 / 159
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1522 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 9
  • Position: #201 / 428
  • Number of attempts: 7
Saving the hashes(#) - 1973 entries

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

  • Best score: 20
  • Best player score: 32
  • Position: #408 / 468
  • Number of attempts: 2
SFD-ROC: ROT13 Phonics - 81 entries

A is for apple, b is for ball, etc... This familiar phonics poem has been rotated 13 characters. Make the letter match the word.

  • Best score: 6
  • Best player score: 6
  • Position: #47 / 66
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 332 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

  • Best score: 25
  • Best player score: 35
  • Position: #89 / 108
  • Number of attempts: 1
Inconsistent real estate paste - 176 entries

Format a hand-typed real estate listing that uses inconsistent punctuation into four sections

  • Best score: 24
  • Best player score: 206
  • Position: #52 / 53
  • Number of attempts: 1
Flip the chessboard - 75 entries

White's turn is over. Flip the board to black's perspective. I added coordinates to frustrate you.

  • Best score: 18
  • Best player score: 57
  • Position: #28 / 29
  • Number of attempts: 1
Vertical Limit - 2383 entries

transform a succession of one word lines to a an array of strings

  • Best score: 21
  • Best player score: 61
  • Position: #718 / 721
  • Number of attempts: 1
Make the circuit grid! - 79 entries

Copy this command for a circuit layout program to create 10 total smd commands. Increment the number in quotes to name each pad, and add 0.7 to each of the (X Y) coordinates at the end of each line.

  • Best score: 26
  • Best player score: 88
  • Position: #44 / 45
  • Number of attempts: 1
Aligning function arguments to match a specific coding style - 218 entries

Most projects have specific coding style guidelines. In this case, the argument list must be broken into a new line for each argument, with the argument names right aligned, taking into account pointers.

  • Best score: 16
  • Best player score: 89
  • Position: #66 / 66
  • Number of attempts: 1
replacing each line of a block selection - 2838 entries

replace each line's ../assets/js with /javascripts

  • Best score: 18
  • Best player score: 37
  • Position: #715 / 741
  • Number of attempts: 1
Switch function arguments - 1993 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #458 / 630
  • Number of attempts: 1
Append semicolon after expressions - 968 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 13
  • Position: #317 / 391
  • Number of attempts: 6
Reverse and double space - 456 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 17
  • Position: #145 / 187
  • Number of attempts: 1
Remove noise from HTTP log - 666 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 17
  • Position: #219 / 263
  • Number of attempts: 1
switch variable - 4963 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #820 / 1712
  • Number of attempts: 3
The meaning - 526 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #236 / 340
  • Number of attempts: 1
Ugly spreadsheet copy/paste to CSV - 905 entries

convert an ugly spreadsheet copy/paste into a CSV format.

  • Best score: 19
  • Best player score: 61
  • Position: #165 / 176
  • Number of attempts: 1
Make it more readable - 1915 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Position: #164 / 628
  • Number of attempts: 12
Alphabetize the directory - 269 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 116
  • Position: #96 / 97
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 502 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!

  • Best score: 23
  • Best player score: 45
  • Position: #118 / 144
  • Number of attempts: 1
Happy New Year! - 139 entries

This is a simple new year's challenge.

  • Best score: 22
  • Best player score: 27
  • Position: #38 / 56
  • Number of attempts: 2
imports alignment (python) - 656 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 30
  • Position: #150 / 193
  • Number of attempts: 5
Generate Fibonacci Numbers - 251 entries

Use your super vim powers to generate Fibonacci Numbers.

  • Best score: 19
  • Best player score: 25
  • Position: #78 / 94
  • Number of attempts: 1
HTML to Haml - 837 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 50
  • Position: #170 / 200
  • Number of attempts: 1
The holy-grail may help - 324 entries

Can you find it in less than 20 strokes, Arthur?

  • Best score: 16
  • Best player score: 25
  • Position: #192 / 197
  • Number of attempts: 1
Shebangs for all - 1787 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

  • Best score: 11
  • Best player score: 25
  • Position: #446 / 470
  • Number of attempts: 1
A Simple One - 957 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #391 / 624
  • Number of attempts: 1
Reverse Simple Deletion - 787 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 17
  • Position: #422 / 437
  • Number of attempts: 2
Increment, increment, increment.... - 599 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #270 / 382
  • Number of attempts: 1
Context insensitive completion 0 - 476 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.

  • Best score: 7
  • Best player score: 9
  • Position: #183 / 224
  • Number of attempts: 2
Context Insensitive completion 1 - 437 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 19
  • Position: #168 / 224
  • Number of attempts: 1
Make Fancy Header - 983 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 31
  • Position: #321 / 331
  • Number of attempts: 1
Reformat some Python - 565 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 46
  • Position: #146 / 223
  • Number of attempts: 1
Reformat a C golf submission - 536 entries

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

  • Best score: 22
  • Best player score: 33
  • Position: #111 / 195
  • Number of attempts: 1
Reformat most common surnames - 599 entries

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

  • Best score: 23
  • Best player score: 55
  • Position: #174 / 188
  • Number of attempts: 1
Remember FizzBuzz? - 596 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 132
  • Position: #161 / 167
  • Number of attempts: 1
Get rid of html tags - 348 entries

Want to read more about Vim's background? Then get rid of those html tags...

  • Best score: 15
  • Best player score: 32
  • Position: #205 / 209
  • Number of attempts: 1
Change the content of a string - 1364 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 30
  • Position: #478 / 525
  • Number of attempts: 1
Sort and add attributes - 1217 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 40
  • Position: #455 / 492
  • Number of attempts: 1
Reconstruct the Sentence - 1168 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 20
  • Best player score: 25
  • Position: #296 / 350
  • Number of attempts: 4
Simple text editing with Vim - 11705 entries

Make the pairs of lines match up by making each second line same as first

  • Best score: 13
  • Best player score: 27
  • Position: #3051 / 3430
  • Number of attempts: 1
Reformat/Refactor a Golfer Class - 6066 entries

A simple case of removing unneeded code and fixing broken indentation.

  • Best score: 32
  • Best player score: 46
  • Position: #1098 / 1496
  • Number of attempts: 2
Justin Knag
Twitter:

Facebooker and Entrepreneur

entered into 81 challenges

contributed 0 challenges