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

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

  • Best score: 17
  • Best player score: 55
  • Position: #132 / 176
  • Number of attempts: 3
Innocent Monster - 155 entries

You have the tools, just create him!

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

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

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

Let convert some simple Java file to JavaScript!

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

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 22
  • Position: #86 / 198
  • Number of attempts: 7
hello-world-vimgolf - 2311 entries

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 19
  • Position: #126 / 252
  • Number of attempts: 4
Learn to ask for :help - 510 entries

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

  • Best score: 19
  • Best player score: 26
  • Position: #48 / 118
  • Number of attempts: 4
Plotting some variables in python - 1543 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: #135 / 329
  • Number of attempts: 1
Transpose a python matrix - 823 entries

Rotate the matrix in 90 degrees.

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

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 62
  • Position: #56 / 70
  • Number of attempts: 1
Write Hello World in the 'i use arch btw' -programming language - 30 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 / 15
  • Number of attempts: 1
simple replacements - 1536 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 27
  • Position: #272 / 336
  • Number of attempts: 1
Inverting Lines - 1797 entries

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

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

Simple challenge to extract fields from a Python class

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

Simple challenge for frequent action while programming.

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

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 36
  • Position: #97 / 306
  • Number of attempts: 4
swap number pairs - 2002 entries

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

  • Best score: 16
  • Best player score: 22
  • Position: #153 / 369
  • Number of attempts: 3
HS Final exam vimgolf - 864 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: #103 / 227
  • 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 - 78 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: #28 / 32
  • Number of attempts: 1
Python: Def to Lambda - 423 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #53 / 149
  • Number of attempts: 7
Format the CSS - 115 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: #22 / 43
  • Number of attempts: 3
Rural Post - 4351 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #173 / 1066
  • Number of attempts: 11
Satisfy the go linter - 2169 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: #194 / 434
  • Number of attempts: 6
Add quotes to ansible playbook - 872 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #171 / 274
  • Number of attempts: 2
Multiline to Single Line - 596 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #170 / 268
  • Number of attempts: 1
xrandr outputs and dashes - 652 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: #195 / 213
  • Number of attempts: 4
From a Thunderlink to a Markdown link - 738 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: #155 / 165
  • Number of attempts: 1
Yo To Hello - 1107 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #350 / 512
  • 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 - 1089 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: #199 / 222
  • Number of attempts: 1
Simple, Practical, and Common - 33353 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: #2795 / 7358
  • Number of attempts: 3
prepend * to every non-blank line - 6201 entries

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

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

Complete golang import statement.

  • Best score: 21
  • Best player score: 26
  • Position: #142 / 272
  • Number of attempts: 1
remove lines containing the word "reader" - 3528 entries

easy stuff

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

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

  • Best score: 13
  • Best player score: 20
  • Position: #421 / 634
  • Number of attempts: 2
Array propagate - 319 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 26
  • Position: #57 / 115
  • Number of attempts: 2
Team names - 1805 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 22
  • Position: #530 / 581
  • Number of attempts: 1
Interweave two blocks of text - 630 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: #177 / 211
  • 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 - 376 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 25
  • Position: #140 / 141
  • Number of attempts: 1
create arrows in a list - 103 entries

Add arrow at same distance

  • Best score: 10
  • Best player score: 10
  • Position: #55 / 70
  • 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 - 948 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 19
  • Position: #240 / 254
  • Number of attempts: 1
Align commas - 1049 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: #109 / 241
  • Number of attempts: 4
Swap assigned value - 614 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #187 / 247
  • Number of attempts: 4
VimGolfNight - 531 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #276 / 342
  • Number of attempts: 1
remove all lines in first part - 190 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: #65 / 65
  • Number of attempts: 1
vim1001 - 275 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: #99 / 107
  • Number of attempts: 1
-a-b-c- - 3170 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 17
  • Position: #1031 / 1127
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10616 entries

A HAPPY NEW YEAR 2014 !

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

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

  • Best score: 19
  • Best player score: 30
  • Position: #380 / 692
  • Number of attempts: 4
Letter case trickery - 1594 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: #458 / 511
  • Number of attempts: 2
quotes inside quotes - 3124 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: #940 / 1071
  • 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 - 349 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: #73 / 132
  • 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 - 516 entries

Reproduce this lovely poem.

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

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

  • Best score: 17
  • Best player score: 29
  • Position: #144 / 192
  • Number of attempts: 1
Readable Rubyhash - 243 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: #82 / 91
  • Number of attempts: 1
Dehamlizing - 179 entries

Change this piece of HAML code back into erb

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

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

  • Best score: 15
  • Best player score: 20
  • Position: #35 / 57
  • Number of attempts: 1
NATO phonetic alphabet - 498 entries

Transform the series of words into a list.

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

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

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 187
  • Number of attempts: 4
SFD-ROC: The Quick Brown Fox - 168 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 / 100
  • Number of attempts: 2
Extract text from xml - 106 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 / 43
  • Number of attempts: 1
The name of the game - 646 entries

End up with the name of the game.

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

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

  • Best score: 24
  • Best player score: 33
  • Position: #33 / 58
  • Number of attempts: 1
SFD-ROC: ROT13 Phonics - 96 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 / 70
  • Number of attempts: 2
Let's play some Ivmgolf - 1084 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #326 / 440
  • Number of attempts: 2
you're stuck on jQuery < 1.7 - 335 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 / 110
  • 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 - 55 entries

Transform # and b to digraphs

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

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

  • Best score: 21
  • Best player score: 23
  • Position: #247 / 735
  • Number of attempts: 1
replacing each line of a block selection - 2925 entries

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

  • Best score: 18
  • Best player score: 26
  • Position: #549 / 764
  • Number of attempts: 2
Switch function arguments - 2064 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #503 / 647
  • Number of attempts: 4
Append semicolon after expressions - 1002 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #370 / 401
  • Number of attempts: 2
Reverse and double space - 489 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 18
  • Position: #164 / 194
  • Number of attempts: 1
Remove semicolons after expressions - 628 entries

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

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

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #648 / 1734
  • 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 - 362 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 - 1855 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #67 / 638
  • Number of attempts: 14
Assignment Alignment - 829 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 - 996 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 / 641
  • Number of attempts: 1
Ruby 1.9 compat - 609 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: #172 / 229
  • Number of attempts: 5
Indentation - 497 entries

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

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

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

  • Best score: 16
  • Best player score: 29
  • Position: #121 / 174
  • 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 - 456 entries

Finish writing this simple Python HTTP server.

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

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

  • Best score: 23
  • Best player score: 29
  • Position: #109 / 197
  • Number of attempts: 1
Change the content of a string - 1457 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #292 / 552
  • Number of attempts: 3
Sort and add attributes - 1321 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #236 / 527
  • Number of attempts: 2
Add fold markers to a .c file - 550 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: #103 / 170
  • Number of attempts: 1
Reconstruct the Sentence - 1348 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: #225 / 379
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3290 entries

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

  • Best score: 16
  • Best player score: 29
  • Position: #475 / 729
  • Number of attempts: 2
Simple text editing with Vim - 12233 entries

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

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

Security researcher loves to play CTF

entered into 106 challenges

contributed 0 challenges