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 - 1028 entries

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

  • Best score: 17
  • Best player score: 55
  • Position: #144 / 191
  • 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 - 1605 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #63 / 535
  • Number of attempts: 5
Java to JavaScript - 261 entries

Let convert some simple Java file to JavaScript!

  • Best score: 59
  • Best player score: 67
  • Position: #20 / 68
  • Number of attempts: 3
Wikitext headings to markdown - 983 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 22
  • Position: #87 / 205
  • Number of attempts: 7
hello-world-vimgolf - 2402 entries

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 19
  • Position: #132 / 262
  • Number of attempts: 4
Learn to ask for :help - 549 entries

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

  • Best score: 19
  • Best player score: 26
  • Position: #51 / 125
  • Number of attempts: 4
Plotting some variables in python - 1597 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: #138 / 342
  • Number of attempts: 1
Transpose a python matrix - 847 entries

Rotate the matrix in 90 degrees.

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

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 62
  • Position: #59 / 73
  • 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: #12 / 16
  • Number of attempts: 1
simple replacements - 1690 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 27
  • Position: #293 / 375
  • Number of attempts: 1
Inverting Lines - 1858 entries

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

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

Simple challenge to extract fields from a Python class

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

Simple challenge for frequent action while programming.

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

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 36
  • Position: #99 / 311
  • Number of attempts: 4
swap number pairs - 2021 entries

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

  • Best score: 16
  • Best player score: 22
  • Position: #155 / 372
  • Number of attempts: 3
HS Final exam vimgolf - 885 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: #105 / 232
  • Number of attempts: 2
ssh config skills - 249 entries

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

  • Best score: 41
  • Best player score: 64
  • Position: #42 / 63
  • Number of attempts: 1
Mr. Hacker - 82 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: #29 / 33
  • Number of attempts: 1
Python: Def to Lambda - 435 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #53 / 152
  • Number of attempts: 7
Format the CSS - 136 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: #24 / 45
  • Number of attempts: 3
Rural Post - 4405 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #173 / 1082
  • Number of attempts: 11
Satisfy the go linter - 2350 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: #212 / 462
  • Number of attempts: 6
Add quotes to ansible playbook - 939 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #176 / 299
  • Number of attempts: 2
Multiline to Single Line - 679 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #170 / 297
  • Number of attempts: 1
xrandr outputs and dashes - 670 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: #198 / 217
  • Number of attempts: 4
From a Thunderlink to a Markdown link - 756 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: #157 / 167
  • Number of attempts: 1
Yo To Hello - 1122 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #350 / 520
  • Number of attempts: 1
C# function to F# - 25 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: #7 / 9
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1112 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: #203 / 227
  • Number of attempts: 1
Simple, Practical, and Common - 33420 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: #2797 / 7375
  • Number of attempts: 3
prepend * to every non-blank line - 6248 entries

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

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

Complete golang import statement.

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

easy stuff

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

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

  • Best score: 13
  • Best player score: 20
  • Position: #423 / 637
  • Number of attempts: 2
Array propagate - 331 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 26
  • Position: #58 / 116
  • Number of attempts: 2
Team names - 1808 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 22
  • Position: #531 / 582
  • 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. - 141 entries

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

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

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 25
  • Position: #141 / 142
  • 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 - 430 entries

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

  • Best score: 14
  • Best player score: 25
  • Position: #113 / 123
  • Number of attempts: 1
Order and join - 964 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 19
  • Position: #243 / 257
  • Number of attempts: 1
Align commas - 1062 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: #110 / 242
  • Number of attempts: 4
Swap assigned value - 626 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #189 / 250
  • Number of attempts: 4
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #276 / 343
  • 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 - 283 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- - 3177 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 17
  • Position: #1033 / 1130
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10637 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1583 / 3671
  • 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 - 1597 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: #460 / 513
  • Number of attempts: 2
quotes inside quotes - 3125 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: #941 / 1072
  • Number of attempts: 1
Number an outline - 249 entries

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

  • Best score: 25
  • Best player score: 73
  • Position: #69 / 75
  • Number of attempts: 1
Pairs of numbers - 360 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: #74 / 133
  • Number of attempts: 1
Hole-in-one - 1012 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: #200 / 302
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 165 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: #51 / 73
  • Number of attempts: 1
Minimalist Limerick - 517 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 35
  • Position: #83 / 172
  • Number of attempts: 1
Prefixes and suffixes - 598 entries

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

  • Best score: 17
  • Best player score: 29
  • Position: #145 / 194
  • Number of attempts: 1
Readable Rubyhash - 244 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: #83 / 92
  • Number of attempts: 1
Dehamlizing - 183 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 39
  • Position: #29 / 70
  • Number of attempts: 3
Checkerboard case pattern - 148 entries

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

  • Best score: 15
  • Best player score: 20
  • Position: #36 / 58
  • Number of attempts: 1
NATO phonetic alphabet - 501 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 21
  • Position: #105 / 191
  • Number of attempts: 2
A simple change - 442 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 189
  • Number of attempts: 4
SFD-ROC: The Quick Brown Fox - 169 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: #76 / 101
  • Number of attempts: 2
Extract text from xml - 109 entries

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

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

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #261 / 356
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1583 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 / 440
  • Number of attempts: 4
Stairs Indenting - 448 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 14
  • Position: #132 / 193
  • Number of attempts: 9
Python to Ruby - 196 entries

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

  • Best score: 24
  • Best player score: 33
  • Position: #33 / 59
  • 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 - 337 entries

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

  • Best score: 25
  • Best player score: 30
  • Position: #63 / 111
  • Number of attempts: 2
Recursively Palindrome - 239 entries

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 37
  • Position: #63 / 73
  • Number of attempts: 1
Enharmonic Equivalents - 56 entries

Transform # and b to digraphs

  • Best score: 18
  • Best player score: 25
  • Position: #33 / 35
  • Number of attempts: 1
Vertical Limit - 2479 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #249 / 744
  • Number of attempts: 1
replacing each line of a block selection - 2947 entries

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

  • Best score: 18
  • Best player score: 26
  • Position: #552 / 768
  • Number of attempts: 2
Switch function arguments - 2082 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #506 / 652
  • Number of attempts: 4
Append semicolon after expressions - 1015 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #374 / 407
  • Number of attempts: 2
Reverse and double space - 491 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 18
  • Position: #165 / 195
  • Number of attempts: 1
Remove semicolons after expressions - 635 entries

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

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

how fast can you switch two variable ?

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

Convert this tiny php class to adequate java one.

  • Best score: 65
  • Best player score: 101
  • Position: #37 / 61
  • Number of attempts: 6
Sort the cardinal numbers - 293 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 45
  • Position: #140 / 146
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 507 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: #137 / 148
  • Number of attempts: 1
Case preserving word replacement - 453 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: #113 / 179
  • Number of attempts: 5
Sort entries based on date - 363 entries

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

  • Best score: 11
  • Best player score: 17
  • Position: #90 / 114
  • Number of attempts: 2
HTML to Haml - 842 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 35
  • Position: #88 / 202
  • Number of attempts: 3
Numbering a List - 1860 entries

Pretty simple, number the list.

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

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #53 / 215
  • Number of attempts: 12
A Simple One - 1005 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 / 646
  • 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 - 498 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #53 / 169
  • Number of attempts: 2
Hatsuyume - 462 entries

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

  • Best score: 16
  • Best player score: 29
  • Position: #123 / 176
  • Number of attempts: 3
Fix the Haiku - 275 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: #78 / 109
  • Number of attempts: 1
Compile C - 365 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 26
  • Position: #109 / 132
  • Number of attempts: 2
Context Insensitive completion 1 - 463 entries

Finish writing this simple Python HTTP server.

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

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

  • Best score: 23
  • Best player score: 29
  • Position: #111 / 201
  • Number of attempts: 1
Change the content of a string - 1495 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #296 / 563
  • Number of attempts: 3
Sort and add attributes - 1348 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #236 / 535
  • Number of attempts: 2
Add fold markers to a .c file - 565 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: #105 / 173
  • Number of attempts: 1
Reconstruct the Sentence - 1401 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: #229 / 390
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3401 entries

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

  • Best score: 16
  • Best player score: 29
  • Position: #486 / 743
  • Number of attempts: 2
Simple text editing with Vim - 12360 entries

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

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

Security researcher loves to play CTF

entered into 106 challenges

contributed 0 challenges