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

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

  • Best score: 17
  • Best player score: 55
  • Position: #152 / 205
  • Number of attempts: 3
Innocent Monster - 217 entries

You have the tools, just create him!

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

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

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

Let convert some simple Java file to JavaScript!

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

Convert the wikitext headings to markdown.

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

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 19
  • Position: #135 / 270
  • Number of attempts: 4
Learn to ask for :help - 587 entries

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

  • Best score: 19
  • Best player score: 26
  • Position: #54 / 130
  • Number of attempts: 4
Plotting some variables in python - 1661 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: #141 / 348
  • Number of attempts: 1
Transpose a python matrix - 873 entries

Rotate the matrix in 90 degrees.

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

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 62
  • Position: #60 / 75
  • 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 - 1762 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 27
  • Position: #299 / 381
  • Number of attempts: 1
Inverting Lines - 1900 entries

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

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

Simple challenge to extract fields from a Python class

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

Simple challenge for frequent action while programming.

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

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 36
  • Position: #102 / 323
  • Number of attempts: 4
swap number pairs - 2105 entries

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

  • Best score: 16
  • Best player score: 22
  • Position: #158 / 382
  • Number of attempts: 3
HS Final exam vimgolf - 898 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: #108 / 237
  • Number of attempts: 2
ssh config skills - 258 entries

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

  • Best score: 41
  • Best player score: 64
  • Position: #43 / 66
  • Number of attempts: 1
Mr. Hacker - 89 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: #31 / 35
  • Number of attempts: 1
Python: Def to Lambda - 455 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #53 / 156
  • Number of attempts: 7
Format the CSS - 158 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: #26 / 49
  • Number of attempts: 3
Rural Post - 4492 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #173 / 1103
  • Number of attempts: 11
Satisfy the go linter - 2393 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: #215 / 472
  • Number of attempts: 6
Add quotes to ansible playbook - 957 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #178 / 306
  • Number of attempts: 2
Multiline to Single Line - 703 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #170 / 302
  • Number of attempts: 1
xrandr outputs and dashes - 710 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: #204 / 223
  • Number of attempts: 4
From a Thunderlink to a Markdown link - 775 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: #159 / 171
  • Number of attempts: 1
Yo To Hello - 1133 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #350 / 526
  • Number of attempts: 1
C# function to F# - 30 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: #9 / 11
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1148 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: #206 / 231
  • Number of attempts: 1
Simple, Practical, and Common - 33677 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: #2812 / 7431
  • Number of attempts: 3
prepend * to every non-blank line - 6323 entries

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

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

Complete golang import statement.

  • Best score: 21
  • Best player score: 26
  • Position: #147 / 282
  • Number of attempts: 1
remove lines containing the word "reader" - 3595 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #482 / 1166
  • Number of attempts: 3
Copy three lines - 2875 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 / 641
  • Number of attempts: 2
Array propagate - 338 entries

Complete the array with the keys as part of the value

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

The team names are misspelled.

  • Best score: 16
  • Best player score: 22
  • Position: #535 / 588
  • Number of attempts: 1
Interweave two blocks of text - 661 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: #180 / 215
  • Number of attempts: 3
For all cases. - 161 entries

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

  • Best score: 8
  • Best player score: 17
  • Position: #103 / 106
  • Number of attempts: 1
Stairstep digits - 394 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 25
  • Position: #144 / 145
  • Number of attempts: 1
create arrows in a list - 117 entries

Add arrow at same distance

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

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

  • Best score: 14
  • Best player score: 25
  • Position: #115 / 125
  • Number of attempts: 1
Order and join - 983 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 19
  • Position: #244 / 259
  • Number of attempts: 1
Align commas - 1095 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: #112 / 246
  • Number of attempts: 4
Swap assigned value - 655 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #192 / 256
  • Number of attempts: 4
VimGolfNight - 560 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #276 / 347
  • Number of attempts: 1
remove all lines in first part - 211 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: #67 / 67
  • Number of attempts: 1
vim1001 - 307 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: #102 / 110
  • Number of attempts: 1
-a-b-c- - 3216 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 17
  • Position: #1039 / 1138
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10676 entries

A HAPPY NEW YEAR 2014 !

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

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

  • Best score: 19
  • Best player score: 30
  • Position: #385 / 702
  • Number of attempts: 4
Letter case trickery - 1630 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: #465 / 518
  • Number of attempts: 2
quotes inside quotes - 3165 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: #944 / 1079
  • Number of attempts: 1
Number an outline - 280 entries

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

  • Best score: 25
  • Best player score: 73
  • Position: #71 / 78
  • Number of attempts: 1
Pairs of numbers - 363 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 / 136
  • Number of attempts: 1
Hole-in-one - 1018 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 / 304
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 179 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: #53 / 77
  • Number of attempts: 1
Minimalist Limerick - 520 entries

Reproduce this lovely poem.

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

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

  • Best score: 17
  • Best player score: 29
  • Position: #146 / 201
  • Number of attempts: 1
Readable Rubyhash - 267 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: #86 / 95
  • Number of attempts: 1
Dehamlizing - 185 entries

Change this piece of HAML code back into erb

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

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

  • Best score: 15
  • Best player score: 20
  • Position: #38 / 61
  • Number of attempts: 1
NATO phonetic alphabet - 529 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 21
  • Position: #107 / 196
  • Number of attempts: 2
A simple change - 468 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 193
  • Number of attempts: 4
SFD-ROC: The Quick Brown Fox - 200 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: #80 / 107
  • Number of attempts: 2
Extract text from xml - 127 entries

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

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

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #261 / 361
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1606 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 / 446
  • Number of attempts: 4
Stairs Indenting - 478 entries

Indent each line with <line number> whitespaces.

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

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

  • Best score: 24
  • Best player score: 33
  • Position: #34 / 61
  • Number of attempts: 1
SFD-ROC: ROT13 Phonics - 101 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 / 73
  • Number of attempts: 2
Let's play some Ivmgolf - 1122 entries

Oops, I spelled that wrong.

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

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

  • Best score: 25
  • Best player score: 30
  • Position: #65 / 113
  • Number of attempts: 2
Recursively Palindrome - 267 entries

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 37
  • Position: #65 / 75
  • Number of attempts: 1
Enharmonic Equivalents - 59 entries

Transform # and b to digraphs

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

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

  • Best score: 21
  • Best player score: 23
  • Position: #255 / 755
  • Number of attempts: 1
replacing each line of a block selection - 3001 entries

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

  • Best score: 18
  • Best player score: 26
  • Position: #558 / 778
  • Number of attempts: 2
Switch function arguments - 2140 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #516 / 664
  • Number of attempts: 4
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #383 / 419
  • Number of attempts: 2
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

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

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

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

how fast can you switch two variable ?

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

Convert this tiny php class to adequate java one.

  • Best score: 65
  • Best player score: 101
  • Position: #39 / 63
  • Number of attempts: 6
Sort the cardinal numbers - 315 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 45
  • Position: #143 / 149
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 545 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: #139 / 150
  • 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 - 392 entries

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

  • Best score: 11
  • Best player score: 17
  • Position: #93 / 117
  • Number of attempts: 2
HTML to Haml - 881 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 35
  • Position: #90 / 205
  • Number of attempts: 3
Numbering a List - 1935 entries

Pretty simple, number the list.

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

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #53 / 220
  • Number of attempts: 12
A Simple One - 1052 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 / 666
  • Number of attempts: 1
Ruby 1.9 compat - 634 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: #178 / 235
  • Number of attempts: 5
Indentation - 550 entries

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

  • Best score: 20
  • Best player score: 25
  • Position: #57 / 180
  • Number of attempts: 2
Hatsuyume - 540 entries

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

  • Best score: 15
  • Best player score: 29
  • Position: #134 / 187
  • Number of attempts: 3
Fix the Haiku - 313 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: #82 / 114
  • Number of attempts: 1
Compile C - 430 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 26
  • Position: #115 / 141
  • Number of attempts: 2
Context Insensitive completion 1 - 506 entries

Finish writing this simple Python HTTP server.

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

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

  • Best score: 23
  • Best player score: 29
  • Position: #120 / 215
  • Number of attempts: 1
Change the content of a string - 1591 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #315 / 593
  • Number of attempts: 3
Sort and add attributes - 1475 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #236 / 573
  • Number of attempts: 2
Add fold markers to a .c file - 660 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: #116 / 189
  • Number of attempts: 1
Reconstruct the Sentence - 1557 entries

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

  • Best score: 19
  • Best player score: 21
  • Position: #245 / 421
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3708 entries

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

  • Best score: 16
  • Best player score: 29
  • Position: #522 / 797
  • Number of attempts: 2
Simple text editing with Vim - 12897 entries

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

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

Security researcher loves to play CTF

entered into 106 challenges

contributed 0 challenges