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

Visual block training - 1047 entries

You see the input. You see the output. Go.

  • Best score: 17
  • Best player score: 55
  • Position: #147 / 195
  • Number of attempts: 3
Innocent Monster - 165 entries

You have the tools, just create him!

  • Best score: 60
  • Best player score: 68
  • Position: #14 / 48
  • Number of attempts: 2
Put a newline after every 10 lines in vim - 1649 entries

Goal is to put a newline after every 10 lines in vim.

  • Best score: 10
  • Best player score: 11
  • Position: #68 / 551
  • Number of attempts: 5
Java to JavaScript - 267 entries

Let convert some simple Java file to JavaScript!

  • Best score: 59
  • Best player score: 67
  • Position: #21 / 72
  • Number of attempts: 3
Wikitext headings to markdown - 985 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 22
  • Position: #88 / 207
  • Number of attempts: 7
hello-world-vimgolf - 2472 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #114 / 699
  • Number of attempts: 5
Contribute to keyboard mashing - 880 entries

Speak in tongues

  • Best score: 17
  • Best player score: 19
  • Position: #134 / 268
  • Number of attempts: 4
Learn to ask for :help - 572 entries

Learn to use the help to reduce your strokes...

  • Best score: 19
  • Best player score: 26
  • Position: #53 / 128
  • Number of attempts: 4
Plotting some variables in python - 1605 entries

4 sets of (x,y) variables to plot. Just increment the numbers! Well, let's change the colors of the lines as well. Oh and we meant to plot the absolute values of course.

  • Best score: 34
  • Best player score: 42
  • Position: #140 / 345
  • Number of attempts: 1
Transpose a python matrix - 848 entries

Rotate the matrix in 90 degrees.

  • Best score: 23
  • Best player score: 24
  • Position: #28 / 135
  • Number of attempts: 12
Create a diamond comment - 336 entries

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 62
  • Position: #60 / 74
  • Number of attempts: 1
Write Hello World in the 'i use arch btw' -programming language - 31 entries

> "I use Arch btw" is an esoteric programming language based on Brainfuck in which the Brainfuck commands have been replaced with the following keywords: i, use, arch, linux, btw, by, the, way. https://github.com/OverMighty/i-use-arch-btw

  • Best score: 162
  • Best player score: 460
  • Position: #13 / 16
  • Number of attempts: 1
simple replacements - 1710 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 27
  • Position: #296 / 378
  • Number of attempts: 1
Inverting Lines - 1870 entries

A simple challenge to invert all lines, except the first.

  • Best score: 10
  • Best player score: 10
  • Position: #141 / 505
  • Number of attempts: 3
Python dataclasses - 1121 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 20
  • Position: #96 / 281
  • Number of attempts: 4
Making 3 line function a one liner. - 312 entries

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #76 / 200
  • Number of attempts: 1
Modernise code - 1368 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 36
  • Position: #101 / 316
  • Number of attempts: 4
swap number pairs - 2023 entries

Swap the numbers in a bunch of 2-element arrays.

  • Best score: 16
  • Best player score: 22
  • Position: #155 / 373
  • Number of attempts: 3
HS Final exam vimgolf - 892 entries

Change the initial file to a single line containing all names comma-separated with numbers inside parentheses.

  • Best score: 21
  • Best player score: 24
  • Position: #107 / 234
  • Number of attempts: 2
ssh config skills - 250 entries

Parse output from `kuebctl get no -o wide` into an .ssh/config file!

  • Best score: 41
  • Best player score: 64
  • Position: #43 / 64
  • Number of attempts: 1
Mr. Hacker - 83 entries

Elvin is hacker. He has piece of users database from some social net site. Recently he installed Vim, and he wants to convert CSV DB to specific format `key=value' where `key' is login and `value' is password, but password in DB is encrypted in ROT13. Help him.

  • Best score: 19
  • Best player score: 22
  • Position: #30 / 34
  • Number of attempts: 1
Python: Def to Lambda - 441 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #53 / 154
  • Number of attempts: 7
Format the CSS - 137 entries

You just copied some CSS color names from the web and need to add them to your python module. Create the COLORS variable and assign a dict() with the names as keys and hex-colors as values. BEWARE OF THE TABS!!

  • Best score: 41
  • Best player score: 45
  • Position: #25 / 46
  • Number of attempts: 3
Rural Post - 4427 entries

Simple challenge to remove all but the post code on each line

  • Best score: 9
  • Best player score: 9
  • Position: #173 / 1086
  • Number of attempts: 11
Satisfy the go linter - 2360 entries

You just came up with this briliant go vars package. But dang, you forgot to add comments to the exported variables. Can you add a comment over each variable with a TODO-placeholder?

  • Best score: 20
  • Best player score: 22
  • Position: #213 / 465
  • Number of attempts: 6
Add quotes to ansible playbook - 946 entries

You created an ansible playbook, but forgot to add quotes. Can you fix it?

  • Best score: 8
  • Best player score: 9
  • Position: #177 / 302
  • Number of attempts: 2
Multiline to Single Line - 680 entries

Convert a multiline, indented file to a single line with no whitespace

  • Best score: 5
  • Best player score: 5
  • Position: #170 / 298
  • Number of attempts: 1
xrandr outputs and dashes - 671 entries

uh oh, different video drivers identify display outputs with more dashes. Quick, need to change this xrandr script!

  • Best score: 12
  • Best player score: 20
  • Position: #199 / 218
  • Number of attempts: 4
From a Thunderlink to a Markdown link - 757 entries

ThunderLinks are durable hyperlinks to specific email messages generated from Thunderbird in HTML format. Leverage the power of vim to make them suitable for a markdown-formatted file.

  • Best score: 18
  • Best player score: 35
  • Position: #158 / 168
  • Number of attempts: 1
Yo To Hello - 1127 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #350 / 522
  • Number of attempts: 1
C# function to F# - 26 entries

Converting from C# to F# is not hard, but requires some manual labor. Here you should convert a C# function using a C# class to a F# function using a C# class.

  • Best score: 101
  • Best player score: 122
  • Position: #8 / 10
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1114 entries

For each line replace a search pattern (in this case $) with numbers starting at 1 and then increasing by 1 for each replaced match. a$b$c$ -> a0b1c2

  • Best score: 21
  • Best player score: 41
  • Position: #204 / 228
  • Number of attempts: 1
Simple, Practical, and Common - 33483 entries

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." This challenge is just a simple movement and entering text at a certain place.

  • Best score: 22
  • Best player score: 23
  • Position: #2802 / 7384
  • Number of attempts: 3
prepend * to every non-blank line - 6254 entries

Prepend an asterisk to every non-blank line in the input file.

  • Best score: 10
  • Best player score: 10
  • Position: #414 / 1530
  • Number of attempts: 6
Quote modules - 1066 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 26
  • Position: #145 / 278
  • Number of attempts: 1
remove lines containing the word "reader" - 3556 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #482 / 1151
  • Number of attempts: 3
Copy three lines - 2869 entries

If the site is up (by some miracle), make the text under every header identical.

  • Best score: 13
  • Best player score: 20
  • Position: #424 / 639
  • Number of attempts: 2
Array propagate - 332 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 26
  • Position: #59 / 117
  • Number of attempts: 2
Team names - 1812 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 22
  • Position: #532 / 585
  • Number of attempts: 1
Interweave two blocks of text - 641 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?

  • Best score: 15
  • Best player score: 20
  • Position: #178 / 212
  • Number of attempts: 3
For all cases. - 145 entries

In this case... change it! :) Watch the line.

  • Best score: 8
  • Best player score: 17
  • Position: #100 / 102
  • Number of attempts: 1
Stairstep digits - 383 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 25
  • Position: #142 / 143
  • Number of attempts: 1
create arrows in a list - 106 entries

Add arrow at same distance

  • Best score: 10
  • Best player score: 10
  • Position: #55 / 71
  • Number of attempts: 6
Paragraph sort - 431 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

  • Best score: 14
  • Best player score: 25
  • Position: #114 / 124
  • Number of attempts: 1
Order and join - 965 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 19
  • Position: #243 / 258
  • Number of attempts: 1
Align commas - 1063 entries

There are 15,000 aligning challenges on vimgolf.com, and they're all exactly the same. I hope this one is a little different.

  • Best score: 11
  • Best player score: 14
  • Position: #111 / 243
  • Number of attempts: 4
Swap assigned value - 628 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #190 / 252
  • Number of attempts: 4
VimGolfNight - 538 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #276 / 344
  • Number of attempts: 1
remove all lines in first part - 197 entries

From the second part, remove all lines in the first part. It can be useful when you have done something from a long list, you want to know what is not done yet!

  • Best score: 13
  • Best player score: 36
  • Position: #66 / 66
  • Number of attempts: 1
vim1001 - 284 entries

change number 1001 into a "vim1001 sequence". (My first challenge, hope it is not too bad... )

  • Best score: 17
  • Best player score: 37
  • Position: #100 / 108
  • Number of attempts: 1
-a-b-c- - 3183 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 17
  • Position: #1035 / 1132
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1583 / 3677
  • Number of attempts: 3
attr_aligner - 3454 entries

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

  • Best score: 19
  • Best player score: 30
  • Position: #381 / 695
  • Number of attempts: 4
Letter case trickery - 1598 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 16
  • Position: #461 / 514
  • Number of attempts: 2
quotes inside quotes - 3128 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: 17
  • Position: #942 / 1073
  • Number of attempts: 1
Number an outline - 252 entries

The indent and words are right, but the numbers are all wrong.

  • Best score: 25
  • Best player score: 73
  • Position: #70 / 76
  • Number of attempts: 1
Pairs of numbers - 361 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: 37
  • Position: #75 / 134
  • Number of attempts: 1
Hole-in-one - 1017 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 20
  • Position: #201 / 303
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 167 entries

col1;col2;col3;col4 A;1;4;5 A;3;4; A;1;4; # New output: col1;col2;col3;col4 A;1(2x);3;4(3x);5 any ideas?

  • Best score: 21
  • Best player score: 23
  • Position: #52 / 75
  • Number of attempts: 1
Minimalist Limerick - 519 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 35
  • Position: #84 / 173
  • Number of attempts: 1
Prefixes and suffixes - 599 entries

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

  • Best score: 17
  • Best player score: 29
  • Position: #145 / 195
  • Number of attempts: 1
Readable Rubyhash - 245 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 23
  • Best player score: 38
  • Position: #84 / 93
  • Number of attempts: 1
Dehamlizing - 184 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 39
  • Position: #30 / 71
  • Number of attempts: 3
Checkerboard case pattern - 149 entries

All the squares are white. Make some of them black. But only the right ones.

  • Best score: 15
  • Best player score: 20
  • Position: #37 / 59
  • Number of attempts: 1
NATO phonetic alphabet - 506 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 21
  • Position: #106 / 194
  • Number of attempts: 2
A simple change - 444 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 190
  • Number of attempts: 4
SFD-ROC: The Quick Brown Fox - 175 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: 28
  • Position: #78 / 104
  • Number of attempts: 2
Extract text from xml - 110 entries

Extract text from xml file (ignoring commented out elements) and create a one line regex.

  • Best score: 28
  • Best player score: 45
  • Position: #33 / 45
  • Number of attempts: 1
The name of the game - 654 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #261 / 359
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1594 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #119 / 443
  • Number of attempts: 4
Stairs Indenting - 452 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 14
  • Position: #133 / 195
  • Number of attempts: 9
Python to Ruby - 198 entries

Convert this Python code to Ruby. NOTE: This program likely won't run.

  • Best score: 24
  • Best player score: 33
  • Position: #34 / 60
  • Number of attempts: 1
SFD-ROC: ROT13 Phonics - 99 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: #56 / 72
  • Number of attempts: 2
Let's play some Ivmgolf - 1096 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #328 / 442
  • Number of attempts: 2
you're stuck on jQuery < 1.7 - 338 entries

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

  • Best score: 25
  • Best player score: 30
  • Position: #64 / 112
  • Number of attempts: 2
Recursively Palindrome - 245 entries

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 37
  • Position: #64 / 74
  • Number of attempts: 1
Enharmonic Equivalents - 57 entries

Transform # and b to digraphs

  • Best score: 18
  • Best player score: 25
  • Position: #34 / 36
  • Number of attempts: 1
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #250 / 748
  • Number of attempts: 1
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 26
  • Position: #555 / 772
  • Number of attempts: 2
Switch function arguments - 2085 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #507 / 653
  • Number of attempts: 4
Append semicolon after expressions - 1023 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #376 / 410
  • Number of attempts: 2
Reverse and double space - 498 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 18
  • Position: #167 / 197
  • Number of attempts: 1
Remove semicolons after expressions - 639 entries

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

  • Best score: 6
  • Best player score: 6
  • Position: #116 / 261
  • Number of attempts: 6
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #648 / 1742
  • Number of attempts: 5
PHP <--> Java class conversion Part 1 - 213 entries

Convert this tiny php class to adequate java one.

  • Best score: 65
  • Best player score: 101
  • Position: #38 / 62
  • Number of attempts: 6
Sort the cardinal numbers - 294 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 45
  • Position: #141 / 147
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 508 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: 53
  • Position: #138 / 149
  • Number of attempts: 1
Case preserving word replacement - 454 entries

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

  • Best score: 19
  • Best player score: 21
  • Position: #114 / 180
  • Number of attempts: 5
Sort entries based on date - 364 entries

Sort some entries in a Ledger-file based on date.

  • Best score: 11
  • Best player score: 17
  • Position: #91 / 115
  • Number of attempts: 2
HTML to Haml - 843 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 35
  • Position: #89 / 203
  • Number of attempts: 3
Numbering a List - 1869 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #67 / 646
  • Number of attempts: 14
Assignment Alignment - 842 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #53 / 217
  • Number of attempts: 12
A Simple One - 1009 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: #526 / 648
  • Number of attempts: 1
Ruby 1.9 compat - 610 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!

  • Best score: 14
  • Best player score: 18
  • Position: #173 / 230
  • Number of attempts: 5
Indentation - 499 entries

Indent each line according to the right number of spaces it needs.

  • Best score: 20
  • Best player score: 25
  • Position: #54 / 170
  • Number of attempts: 2
Hatsuyume - 467 entries

http://en.wikipedia.org/wiki/Hatsuyume

  • Best score: 15
  • Best player score: 29
  • Position: #126 / 179
  • Number of attempts: 3
Fix the Haiku - 276 entries

Change this slightly scrambled haiku to its unscrambled form and fix the capitalisation and punctuation along the way.

  • Best score: 28
  • Best player score: 45
  • Position: #79 / 110
  • Number of attempts: 1
Compile C - 366 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 26
  • Position: #110 / 133
  • Number of attempts: 2
Context Insensitive completion 1 - 471 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #146 / 237
  • Number of attempts: 2
Reformat most common surnames - 671 entries

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

  • Best score: 23
  • Best player score: 29
  • Position: #113 / 202
  • Number of attempts: 1
Change the content of a string - 1502 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #298 / 567
  • Number of attempts: 3
Sort and add attributes - 1369 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #236 / 542
  • Number of attempts: 2
Add fold markers to a .c file - 571 entries

Fold markers can make it easier to navigate source code. Add them to this .c file.

  • Best score: 30
  • Best player score: 36
  • Position: #107 / 175
  • Number of attempts: 1
Reconstruct the Sentence - 1436 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: 21
  • Position: #233 / 397
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3508 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 29
  • Position: #498 / 758
  • Number of attempts: 2
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1893 / 3626
  • Number of attempts: 4
POSIX
Twitter:

Security researcher loves to play CTF

entered into 106 challenges

contributed 0 challenges