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

Fix timezone format - 186 entries

Add the missing T and Z in the datetime field. There should be a T instead of the space, and a Z at the end of the datetime. `2024-08-31 18:32:00;` -> `2024-08-31T18:32:00Z;`

  • Best score: 15
  • Best player score: 20
  • Position: #48 / 61
  • Number of attempts: 1
Remove adjacent duplicates - 367 entries

Try to find a way to remove adjacent duplicate letters.

  • Best score: 19
  • Best player score: 57
  • Position: #96 / 103
  • Number of attempts: 1
Rearrange array to single level - 1094 entries

The goal is to flatten the array into a single list and remove any empty elements.

  • Best score: 14
  • Best player score: 52
  • Position: #165 / 186
  • Number of attempts: 1
months to html list items - 957 entries

Turn the months into list items.

  • Best score: 22
  • Best player score: 24
  • Position: #92 / 254
  • Number of attempts: 6
Find fix point of cos - 1359 entries

Write a function to find the fix point of cos. It is not a good code; It is just to use vim. Inspired by the excellent https://mvanier.livejournal.com/2897.html about the Y combinator.

  • Best score: 14
  • Best player score: 15
  • Position: #239 / 394
  • Number of attempts: 1
Surround the 'z' character with brackets, quotes, and print as formatted string. - 538 entries

Surround the 'z' character with brackets, quotes, and print as formatted string.

  • Best score: 17
  • Best player score: 17
  • Position: #222 / 300
  • Number of attempts: 2
Many duplicates - 1443 entries

Quick and easy

  • Best score: 7
  • Best player score: 8
  • Position: #311 / 467
  • Number of attempts: 2
delete swap - 1768 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #378 / 548
  • Number of attempts: 3
Generate a very basic Python constructor (fixed) - 1253 entries

Original by @BiddulphCaleb (http://www.vimgolf.com/challenges/6019f1c4642668000cee11e8) - had some extra spaces in output file.

  • Best score: 29
  • Best player score: 81
  • Position: #247 / 271
  • Number of attempts: 1
hello-world-vimgolf - 2490 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #340 / 705
  • Number of attempts: 4
Plotting some variables in python - 1660 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: 50
  • Position: #211 / 347
  • Number of attempts: 1
Transpose a python matrix - 871 entries

Rotate the matrix in 90 degrees.

  • Best score: 23
  • Best player score: 24
  • Position: #43 / 137
  • Number of attempts: 14
Inverting Lines - 1881 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #268 / 508
  • Number of attempts: 7
Python dataclasses - 1127 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 30
  • Position: #191 / 283
  • Number of attempts: 1
Modernise code - 1388 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 39
  • Position: #126 / 319
  • Number of attempts: 1
swap number pairs - 2066 entries

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

  • Best score: 16
  • Best player score: 40
  • Position: #322 / 377
  • Number of attempts: 3
HS Final exam vimgolf - 897 entries

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

  • Best score: 21
  • Best player score: 27
  • Position: #130 / 236
  • Number of attempts: 2
Rural Post - 4462 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #208 / 1093
  • Number of attempts: 7
Satisfy the go linter - 2374 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: 26
  • Position: #298 / 469
  • Number of attempts: 1
Hogwarts Email Sorting - 917 entries

Given a list of emails, get the students full name and their associated house.

  • Best score: 20
  • Best player score: 24
  • Position: #198 / 260
  • Number of attempts: 1
Swap values - 4610 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 12
  • Position: #528 / 1267
  • Number of attempts: 8
prepend * to every non-blank line - 6298 entries

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

  • Best score: 10
  • Best player score: 14
  • Position: #908 / 1535
  • Number of attempts: 1
Unsemantic linewrapping - 925 entries

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

  • Best score: 9
  • Best player score: 14
  • Position: #199 / 229
  • Number of attempts: 1
V to the i - 4798 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 9
  • Position: #1741 / 1891
  • Number of attempts: 1
Add string initializers to an enum - 872 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 27
  • Position: #198 / 258
  • Number of attempts: 3
Bad Copy Syntax - 2028 entries

Copy should be from right to left, but sometimes you type it wrong.

  • Best score: 18
  • Best player score: 25
  • Position: #379 / 522
  • Number of attempts: 4
remove lines containing the word "reader" - 3574 entries

easy stuff

  • Best score: 9
  • Best player score: 14
  • Position: #1064 / 1158
  • Number of attempts: 1
Wrap the text of an email message to 79 characters - 750 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #313 / 405
  • Number of attempts: 5
multiple cursor alternative - 1519 entries

from: https://www.reddit.com/r/vim/comments/6w5pfa/crosspost_from_remacs_how_would_you_do_this_in_vim/

  • Best score: 19
  • Best player score: 25
  • Position: #309 / 380
  • Number of attempts: 1
From argument to object - 1503 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

  • Best score: 17
  • Best player score: 20
  • Position: #349 / 455
  • Number of attempts: 1
Copy three lines - 2872 entries

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

  • Best score: 13
  • Best player score: 25
  • Position: #570 / 640
  • Number of attempts: 3
Search and Replace 0 - 4970 entries

Replace every instance of 'aaa' with 'xaaax'.

  • Best score: 12
  • Best player score: 12
  • Position: #738 / 1618
  • Number of attempts: 4
Just the middle - 11423 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3202 / 4185
  • Number of attempts: 2
Subnetting - 131 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 38
  • Position: #29 / 39
  • Number of attempts: 2
Text to HTML Table - 180 entries

Turn the plain text table to an HTML table.

  • Best score: 52
  • Best player score: 62
  • Position: #41 / 53
  • Number of attempts: 3
Python Hello World! Reformatting - 989 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 40
  • Position: #41 / 379
  • Number of attempts: 5
One to Ten - 2209 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

  • Best score: 12
  • Best player score: 12
  • Position: #368 / 669
  • Number of attempts: 4
Add Go XML to structure tags - 170 entries

The Go programming language can directly map XML to structure fields. Add the correct XML tag after each field.

  • Best score: 23
  • Best player score: 31
  • Position: #53 / 69
  • Number of attempts: 2
Array transposition - 2415 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 17
  • Position: #174 / 446
  • Number of attempts: 8
Space out the alphabet - 1657 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 32
  • Position: #430 / 444
  • Number of attempts: 1
Fix the XML - 1039 entries

The challenge consists in having a valid xml from an incomplete source.

  • Best score: 18
  • Best player score: 27
  • Position: #215 / 290
  • Number of attempts: 1
-a-b-c- - 3213 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 20
  • Position: #1089 / 1137
  • Number of attempts: 1
Do you demand a shrubbery? - 1158 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 28
  • Position: #209 / 300
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10657 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 14
  • Position: #2855 / 3679
  • Number of attempts: 1
quotes inside quotes - 3154 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: #946 / 1075
  • Number of attempts: 2
XML to JSON - 47 entries

Convert this xml file into json.

  • Best score: 75
  • Best player score: 243
  • Position: #17 / 20
  • Number of attempts: 1
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: 13
  • Position: #313 / 446
  • Number of attempts: 3
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 12
  • Position: #414 / 445
  • Number of attempts: 1
Append semicolon after expressions - 1046 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #382 / 413
  • Number of attempts: 2
Ugly spreadsheet copy/paste to CSV - 1007 entries

convert an ugly spreadsheet copy/paste into a CSV format.

  • Best score: 19
  • Best player score: 20
  • Position: #34 / 192
  • Number of attempts: 19
Multiplication table. - 232 entries

Create a multiplication table.

  • Best score: 31
  • Best player score: 147
  • Position: #61 / 68
  • Number of attempts: 3
Make it more readable - 1986 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 17
  • Position: #490 / 646
  • Number of attempts: 2
imports alignment (python) - 700 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 27
  • Position: #141 / 198
  • Number of attempts: 4
Java Array2List - 233 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 110
  • Position: #54 / 87
  • Number of attempts: 1
A Simple One - 1043 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: #580 / 659
  • Number of attempts: 3
Letters are numbers - 167 entries

Letters and numbers are interchangeable. A lot of programming languages give you simple ways to convert individual letters to hex, binary and decimal but does Vim?

  • Best score: 20
  • Best player score: 32
  • Position: #69 / 76
  • Number of attempts: 2
Ruby 1.9 compat - 624 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: 14
  • Position: #73 / 232
  • Number of attempts: 5
Reverse Simple Deletion - 845 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #374 / 457
  • Number of attempts: 2
Turn this csv list into queries - 237 entries

Transform each line of this csv file into a MySQL-ready INSERT query.

  • Best score: 98
  • Best player score: 130
  • Position: #64 / 99
  • Number of attempts: 2
Context insensitive completion 0 - 558 entries

Buried in the lines you're not supposed to add is the line "Add this line!" Add that line to the top of the file.

  • Best score: 6
  • Best player score: 7
  • Position: #128 / 242
  • Number of attempts: 3
Compile C - 400 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 30
  • Position: #124 / 137
  • Number of attempts: 2
Context Insensitive completion 1 - 494 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #165 / 243
  • Number of attempts: 2
Reformat some Python - 604 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 40
  • Position: #96 / 235
  • Number of attempts: 4
Reverse characters in a line - 750 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 12
  • Best player score: 60
  • Position: #260 / 261
  • Number of attempts: 1
Reformat most common surnames - 692 entries

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

  • Best score: 23
  • Best player score: 50
  • Position: #186 / 205
  • Number of attempts: 1
Change the content of a string - 1552 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 24
  • Position: #340 / 580
  • Number of attempts: 2
Sort and add attributes - 1421 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #288 / 552
  • Number of attempts: 3
Add fold markers to a .c file - 605 entries

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

  • Best score: 30
  • Best player score: 38
  • Position: #136 / 179
  • Number of attempts: 4
Reconstruct the Sentence - 1477 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: #247 / 405
  • Number of attempts: 3
Braces or Brackets? - 958 entries

Someone forgot whether to use braces or brackets and you have to clean up their code!

  • Best score: 34
  • Best player score: 54
  • Position: #262 / 306
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3589 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #45 / 775
  • Number of attempts: 9
Flodder-challenge - 1224 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 46
  • Position: #282 / 328
  • Number of attempts: 3
Simple text editing with Vim - 12680 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #723 / 3665
  • Number of attempts: 6
KoroneListener
Github:

entered into 73 challenges

contributed 0 challenges