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 - 372 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: #90 / 120
  • Number of attempts: 1
Remove adjacent duplicates - 726 entries

Try to find a way to remove adjacent duplicate letters.

  • Best score: 19
  • Best player score: 57
  • Position: #166 / 181
  • Number of attempts: 1
Rearrange array to single level - 1829 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: #270 / 307
  • Number of attempts: 1
months to html list items - 1151 entries

Turn the months into list items.

  • Best score: 22
  • Best player score: 24
  • Position: #102 / 311
  • Number of attempts: 6
Find fix point of cos - 1485 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: #245 / 434
  • Number of attempts: 1
Surround the 'z' character with brackets, quotes, and print as formatted string. - 582 entries

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

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

Quick and easy

  • Best score: 7
  • Best player score: 8
  • Position: #314 / 484
  • Number of attempts: 2
delete swap - 1912 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #378 / 580
  • Number of attempts: 3
Generate a very basic Python constructor (fixed) - 1295 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: #254 / 278
  • Number of attempts: 1
hello-world-vimgolf - 2533 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #340 / 726
  • Number of attempts: 4
Plotting some variables in python - 1691 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: #217 / 354
  • Number of attempts: 1
Transpose a python matrix - 907 entries

Rotate the matrix in 90 degrees.

  • Best score: 23
  • Best player score: 24
  • Position: #44 / 141
  • Number of attempts: 14
Inverting Lines - 1961 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #278 / 526
  • Number of attempts: 7
Python dataclasses - 1253 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 30
  • Position: #214 / 313
  • Number of attempts: 1
Modernise code - 1439 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 39
  • Position: #132 / 333
  • Number of attempts: 1
swap number pairs - 2173 entries

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

  • Best score: 16
  • Best player score: 40
  • Position: #334 / 394
  • Number of attempts: 3
HS Final exam vimgolf - 936 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: #136 / 245
  • Number of attempts: 2
Rural Post - 4602 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #208 / 1124
  • Number of attempts: 7
Satisfy the go linter - 2487 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: #310 / 496
  • Number of attempts: 1
Hogwarts Email Sorting - 954 entries

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

  • Best score: 20
  • Best player score: 24
  • Position: #207 / 272
  • Number of attempts: 1
Swap values - 4705 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 12
  • Position: #532 / 1293
  • Number of attempts: 8
prepend * to every non-blank line - 6395 entries

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

  • Best score: 10
  • Best player score: 14
  • Position: #925 / 1562
  • Number of attempts: 1
Unsemantic linewrapping - 964 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: #205 / 238
  • Number of attempts: 1
V to the i - 4883 entries

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

  • Best score: 7
  • Best player score: 9
  • Position: #1758 / 1914
  • Number of attempts: 1
Add string initializers to an enum - 903 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 27
  • Position: #205 / 266
  • Number of attempts: 3
Bad Copy Syntax - 2088 entries

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

  • Best score: 18
  • Best player score: 25
  • Position: #391 / 543
  • Number of attempts: 4
remove lines containing the word "reader" - 3652 entries

easy stuff

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

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

  • Best score: 5
  • Best player score: 5
  • Position: #313 / 451
  • Number of attempts: 5
multiple cursor alternative - 1591 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: #316 / 388
  • Number of attempts: 1
From argument to object - 1566 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: #361 / 471
  • Number of attempts: 1
Copy three lines - 2923 entries

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

  • Best score: 13
  • Best player score: 25
  • Position: #576 / 647
  • Number of attempts: 3
Search and Replace 0 - 5159 entries

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

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

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3216 / 4255
  • Number of attempts: 2
Subnetting - 146 entries

Split up the IP addresses in the right way.

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

Turn the plain text table to an HTML table.

  • Best score: 52
  • Best player score: 62
  • Position: #44 / 57
  • Number of attempts: 3
Python Hello World! Reformatting - 1047 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: #43 / 397
  • Number of attempts: 5
One to Ten - 2258 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 / 688
  • Number of attempts: 4
Add Go XML to structure tags - 211 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: #59 / 77
  • Number of attempts: 2
Array transposition - 2481 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 17
  • Position: #175 / 461
  • Number of attempts: 8
Space out the alphabet - 1692 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 32
  • Position: #440 / 456
  • Number of attempts: 1
Fix the XML - 1050 entries

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

  • Best score: 18
  • Best player score: 27
  • Position: #216 / 291
  • Number of attempts: 1
-a-b-c- - 3241 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 20
  • Position: #1098 / 1146
  • Number of attempts: 1
Do you demand a shrubbery? - 1207 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 28
  • Position: #215 / 309
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10755 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 14
  • Position: #2881 / 3715
  • Number of attempts: 1
quotes inside quotes - 3202 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: #954 / 1093
  • Number of attempts: 2
XML to JSON - 49 entries

Convert this xml file into json.

  • Best score: 75
  • Best player score: 243
  • Position: #18 / 21
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1642 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: #318 / 457
  • Number of attempts: 3
Let's play some Ivmgolf - 1162 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 12
  • Position: #425 / 459
  • Number of attempts: 1
Append semicolon after expressions - 1086 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 14
  • Position: #393 / 426
  • Number of attempts: 2
Ugly spreadsheet copy/paste to CSV - 1046 entries

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

  • Best score: 19
  • Best player score: 20
  • Position: #35 / 199
  • Number of attempts: 19
Multiplication table. - 240 entries

Create a multiplication table.

  • Best score: 31
  • Best player score: 147
  • Position: #62 / 70
  • Number of attempts: 3
Make it more readable - 2039 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 17
  • Position: #499 / 658
  • Number of attempts: 2
imports alignment (python) - 721 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 27
  • Position: #143 / 202
  • Number of attempts: 4
Java Array2List - 239 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 110
  • Position: #55 / 88
  • Number of attempts: 1
A Simple One - 1088 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 / 679
  • Number of attempts: 3
Letters are numbers - 179 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: #70 / 78
  • Number of attempts: 2
Ruby 1.9 compat - 661 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 / 241
  • Number of attempts: 5
Reverse Simple Deletion - 871 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #378 / 465
  • Number of attempts: 2
Turn this csv list into queries - 278 entries

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

  • Best score: 98
  • Best player score: 130
  • Position: #67 / 104
  • Number of attempts: 2
Context insensitive completion 0 - 605 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 / 255
  • Number of attempts: 3
Compile C - 454 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 30
  • Position: #131 / 146
  • Number of attempts: 2
Context Insensitive completion 1 - 532 entries

Finish writing this simple Python HTTP server.

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

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 40
  • Position: #103 / 246
  • Number of attempts: 4
Reverse characters in a line - 844 entries

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

  • Best score: 8
  • Best player score: 60
  • Position: #281 / 282
  • Number of attempts: 1
Reformat most common surnames - 834 entries

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

  • Best score: 23
  • Best player score: 50
  • Position: #213 / 238
  • Number of attempts: 1
Change the content of a string - 1799 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 24
  • Position: #389 / 655
  • Number of attempts: 2
Sort and add attributes - 1591 entries

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

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

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

  • Best score: 27
  • Best player score: 38
  • Position: #152 / 202
  • Number of attempts: 4
Reconstruct the Sentence - 1745 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: #271 / 457
  • Number of attempts: 3
Braces or Brackets? - 1201 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: #303 / 362
  • Number of attempts: 1
Whitespace, empty lines and tabs - 4044 entries

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

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

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 46
  • Position: #322 / 378
  • Number of attempts: 3
Simple text editing with Vim - 13626 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 / 3902
  • Number of attempts: 6
KoroneListener
Github:

entered into 73 challenges

contributed 0 challenges