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

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

  • Best score: 17
  • Best player score: 55
  • Position: #82 / 114
  • Number of attempts: 3
Innocent Monster - 128 entries

You have the tools, just create him!

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

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

  • Best score: 10
  • Best player score: 11
  • Position: #48 / 379
  • Number of attempts: 5
Java to JavaScript - 188 entries

Let convert some simple Java file to JavaScript!

  • Best score: 59
  • Best player score: 67
  • Position: #15 / 47
  • Number of attempts: 3
Wikitext headings to markdown - 681 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 22
  • Position: #59 / 151
  • Number of attempts: 7
hello-world-vimgolf - 1672 entries

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 19
  • Position: #104 / 205
  • Number of attempts: 4
Learn to ask for :help - 429 entries

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

  • Best score: 19
  • Best player score: 26
  • Position: #43 / 97
  • Number of attempts: 4
Plotting some variables in python - 1237 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: #103 / 259
  • Number of attempts: 1
Transpose a python matrix - 616 entries

Rotate the matrix in 90 degrees.

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

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 62
  • Position: #43 / 57
  • Number of attempts: 1
Write Hello World in the 'i use arch btw' -programming language - 25 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: #10 / 12
  • Number of attempts: 1
simple replacements - 1153 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 27
  • Position: #221 / 256
  • Number of attempts: 1
Inverting Lines - 1399 entries

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

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

Simple challenge to extract fields from a Python class

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

Simple challenge for frequent action while programming.

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

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 36
  • Position: #73 / 210
  • Number of attempts: 4
swap number pairs - 1616 entries

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

  • Best score: 16
  • Best player score: 22
  • Position: #127 / 299
  • Number of attempts: 3
HS Final exam vimgolf - 711 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: #88 / 190
  • Number of attempts: 2
ssh config skills - 219 entries

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

  • Best score: 41
  • Best player score: 64
  • Position: #37 / 54
  • Number of attempts: 1
Mr. Hacker - 65 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: #23 / 27
  • Number of attempts: 1
Python: Def to Lambda - 388 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #53 / 131
  • Number of attempts: 7
Format the CSS - 100 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: #19 / 37
  • Number of attempts: 3
Rural Post - 4138 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #173 / 1023
  • Number of attempts: 11
Satisfy the go linter - 2025 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: #181 / 408
  • Number of attempts: 6
Add quotes to ansible playbook - 801 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #167 / 252
  • Number of attempts: 2
Multiline to Single Line - 542 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #170 / 243
  • Number of attempts: 1
xrandr outputs and dashes - 608 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: #180 / 196
  • Number of attempts: 4
From a Thunderlink to a Markdown link - 707 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: #147 / 157
  • Number of attempts: 1
Yo To Hello - 1059 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #350 / 485
  • Number of attempts: 1
C# function to F# - 13 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: 105
  • Best player score: 122
  • Position: #5 / 7
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1046 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: #189 / 210
  • Number of attempts: 1
Simple, Practical, and Common - 32989 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: #2765 / 7283
  • Number of attempts: 3
prepend * to every non-blank line - 6037 entries

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

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

Complete golang import statement.

  • Best score: 21
  • Best player score: 26
  • Position: #137 / 261
  • Number of attempts: 1
remove lines containing the word "reader" - 3477 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #483 / 1126
  • Number of attempts: 3
Copy three lines - 2819 entries

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

  • Best score: 13
  • Best player score: 20
  • Position: #419 / 629
  • Number of attempts: 2
Array propagate - 315 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 26
  • Position: #56 / 112
  • Number of attempts: 2
Team names - 1781 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 22
  • Position: #523 / 572
  • Number of attempts: 1
Interweave two blocks of text - 610 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: #175 / 207
  • Number of attempts: 3
For all cases. - 128 entries

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

  • Best score: 8
  • Best player score: 17
  • Position: #90 / 92
  • Number of attempts: 1
Stairstep digits - 362 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 25
  • Position: #135 / 136
  • Number of attempts: 1
create arrows in a list - 90 entries

Add arrow at same distance

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

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

  • Best score: 14
  • Best player score: 25
  • Position: #111 / 121
  • Number of attempts: 1
Order and join - 888 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 19
  • Position: #230 / 244
  • Number of attempts: 1
Align commas - 1046 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: #106 / 238
  • Number of attempts: 4
Swap assigned value - 566 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #181 / 237
  • Number of attempts: 4
VimGolfNight - 507 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #276 / 332
  • Number of attempts: 1
remove all lines in first part - 188 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: #63 / 63
  • Number of attempts: 1
vim1001 - 274 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: #98 / 106
  • Number of attempts: 1
-a-b-c- - 3125 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 17
  • Position: #1019 / 1114
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10557 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1584 / 3643
  • Number of attempts: 3
attr_aligner - 3402 entries

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

  • Best score: 19
  • Best player score: 30
  • Position: #375 / 685
  • Number of attempts: 4
Letter case trickery - 1558 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: #451 / 501
  • Number of attempts: 2
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: 17
  • Position: #925 / 1050
  • Number of attempts: 1
Number an outline - 246 entries

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

  • Best score: 25
  • Best player score: 73
  • Position: #68 / 74
  • Number of attempts: 1
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: 37
  • Position: #72 / 130
  • Number of attempts: 1
Hole-in-one - 982 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: #197 / 299
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 164 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: #50 / 72
  • Number of attempts: 1
Minimalist Limerick - 507 entries

Reproduce this lovely poem.

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

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

  • Best score: 17
  • Best player score: 29
  • Position: #142 / 186
  • Number of attempts: 1
Readable Rubyhash - 239 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: #79 / 88
  • Number of attempts: 1
Dehamlizing - 177 entries

Change this piece of HAML code back into erb

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

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

  • Best score: 15
  • Best player score: 20
  • Position: #34 / 55
  • Number of attempts: 1
NATO phonetic alphabet - 490 entries

Transform the series of words into a list.

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

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

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 180
  • Number of attempts: 4
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: 28
  • Position: #75 / 97
  • Number of attempts: 2
Extract text from xml - 102 entries

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

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

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #261 / 348
  • Number of attempts: 2
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: 8
  • Position: #119 / 428
  • Number of attempts: 4
Stairs Indenting - 434 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 14
  • Position: #131 / 186
  • Number of attempts: 9
Python to Ruby - 190 entries

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

  • Best score: 24
  • Best player score: 33
  • Position: #32 / 56
  • Number of attempts: 1
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: #56 / 66
  • Number of attempts: 2
Let's play some Ivmgolf - 1022 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #318 / 422
  • Number of attempts: 2
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: 30
  • Position: #63 / 108
  • Number of attempts: 2
Recursively Palindrome - 235 entries

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 37
  • Position: #62 / 72
  • Number of attempts: 1
Enharmonic Equivalents - 54 entries

Transform # and b to digraphs

  • Best score: 18
  • Best player score: 25
  • Position: #32 / 33
  • 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: 23
  • Position: #245 / 721
  • Number of attempts: 1
replacing each line of a block selection - 2852 entries

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

  • Best score: 18
  • Best player score: 26
  • Position: #539 / 743
  • Number of attempts: 2
Switch function arguments - 1995 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #492 / 631
  • Number of attempts: 4
Append semicolon after expressions - 968 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #362 / 391
  • Number of attempts: 2
Reverse and double space - 456 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 18
  • Position: #159 / 187
  • Number of attempts: 1
Remove semicolons after expressions - 576 entries

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

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

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #648 / 1712
  • Number of attempts: 5
PHP <--> Java class conversion Part 1 - 211 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 - 283 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 45
  • Position: #137 / 142
  • 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: 53
  • Position: #135 / 144
  • Number of attempts: 1
Case preserving word replacement - 439 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: #111 / 176
  • Number of attempts: 5
Sort entries based on date - 347 entries

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

  • Best score: 11
  • Best player score: 17
  • Position: #89 / 111
  • Number of attempts: 2
HTML to Haml - 837 entries

Help convert this HTML page to Haml.

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

Pretty simple, number the list.

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

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #53 / 214
  • Number of attempts: 12
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: #526 / 624
  • Number of attempts: 1
Ruby 1.9 compat - 598 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: #170 / 227
  • Number of attempts: 5
Indentation - 454 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #50 / 161
  • Number of attempts: 2
Hatsuyume - 428 entries

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

  • Best score: 16
  • Best player score: 29
  • Position: #117 / 169
  • Number of attempts: 3
Fix the Haiku - 265 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: #76 / 106
  • Number of attempts: 1
Compile C - 341 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 26
  • Position: #105 / 126
  • Number of attempts: 2
Context Insensitive completion 1 - 437 entries

Finish writing this simple Python HTTP server.

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

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

  • Best score: 23
  • Best player score: 29
  • Position: #104 / 188
  • 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: 23
  • Position: #276 / 525
  • Number of attempts: 3
Sort and add attributes - 1217 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #236 / 492
  • Number of attempts: 2
Add fold markers to a .c file - 499 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: #94 / 158
  • 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: 21
  • Position: #209 / 350
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3043 entries

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

  • Best score: 16
  • Best player score: 29
  • Position: #439 / 673
  • Number of attempts: 2
Simple text editing with Vim - 11711 entries

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

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

Security researcher loves to play CTF

entered into 106 challenges

contributed 0 challenges