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

Swap function parameters and delete all comments in python. - 718 entries

Swap function parameters and delete all comments in python.

  • Best score: 19
  • Best player score: 20
  • Position: #45 / 188
  • Number of attempts: 3
Delete the last function argument in python. - 517 entries

Delete the last function argument in this python script.

  • Best score: 6
  • Best player score: 7
  • Position: #119 / 189
  • Number of attempts: 1
Flip All Bits - 329 entries

Perform a bitwise NOT operation on each bit, meaning that bits that are 0 become 1, and those that are 1 become 0.

  • Best score: 26
  • Best player score: 29
  • Position: #12 / 106
  • Number of attempts: 4
Convert list of enums to list of localization terms - 200 entries

While making my game Piloteer, I had a large list of TaskTypes and needed to convert them to an equivalent list of localization terms, to be used when translating the game's text into different languages.

  • Best score: 75
  • Best player score: 86
  • Position: #6 / 63
  • Number of attempts: 5
From brakets to parens - 1264 entries

This is one of the most common problem when you wrap an array for error handling. Vim is useful when you convert foo[i][j][k] into foo(i, j, k) for many times.

  • Best score: 24
  • Best player score: 25
  • Position: #35 / 282
  • Number of attempts: 8
Create json from a .env file - 1648 entries

A simple everyday task.

  • Best score: 38
  • Best player score: 40
  • Position: #45 / 403
  • Number of attempts: 7
Reordering properties - 1308 entries

Arrange the CSS lines for the #topbar selector based on their complete line length, from shortest to longest.

  • Best score: 24
  • Best player score: 24
  • Position: #13 / 293
  • Number of attempts: 15
Sort and Tag - 703 entries

The goal is to sort these lines alphabetically, assign a unique identifier to each line in the format "[01]", "[02]", etc., and then restore the original order of the lines while preserving the assigned identifiers.

  • Best score: 36
  • Best player score: 46
  • Position: #32 / 151
  • Number of attempts: 10
Reorganize Pokémon - 865 entries

Change the format of the each line and sort alphabetically.

  • Best score: 18
  • Best player score: 21
  • Position: #135 / 236
  • Number of attempts: 3
Format a long line - 129 entries

Reformat long lines (gq), textwidth=78, no trailing spaces.

  • Best score: 17
  • Best player score: 19
  • Position: #15 / 37
  • Number of attempts: 4
Evil Numbers - 117 entries

Print the first 100 evil numbers https://oeis.org/A001969. This is an advert for code.golf https://code.golf/evil-numbers#viml

  • Best score: 25
  • Best player score: 51
  • Position: #13 / 28
  • Number of attempts: 8
Mirror image - 126 entries

Add the second eye

  • Best score: 15
  • Best player score: 24
  • Position: #21 / 37
  • Number of attempts: 2
Find anomalies - 166 entries

There is one special character per line

  • Best score: 30
  • Best player score: 30
  • Position: #1 / 45
  • Number of attempts: 3
Coordinate extraction - 67 entries

Get the coordinates of all "M"s from the Vim logo

  • Best score: 43
  • Best player score: 43
  • Position: #3 / 18
  • Number of attempts: 5
Morse - 181 entries

Translate Morse code to Text

  • Best score: 31
  • Best player score: 32
  • Position: #5 / 37
  • Number of attempts: 4
New teacher - 1505 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 21
  • Position: #49 / 316
  • Number of attempts: 5
Replace word while reserving first letter case - 665 entries

Window -> Door window -> door Windows -> Windows windows -> windows

  • Best score: 24
  • Best player score: 30
  • Position: #50 / 127
  • Number of attempts: 7
months to html list items - 1139 entries

Turn the months into list items.

  • Best score: 22
  • Best player score: 24
  • Position: #91 / 309
  • Number of attempts: 5
Quicksort - 2109 entries

We need the numbers in the first row sorted as quickly as possible! Be careful not to disturb the data below the divider though: that must remain unchanged.

  • Best score: 6
  • Best player score: 7
  • Position: #169 / 471
  • Number of attempts: 7
EDN reformat - 1218 entries

The goal is to make the code more readable and concise while maintaining its functionality.

  • Best score: 17
  • Best player score: 18
  • Position: #72 / 172
  • Number of attempts: 8
Pick and sort servers from mirror list - 463 entries

Retrieve the primary server for each country from a mirror list file and organize them alphabetically by country name. Given a mirror list file containing server information for various countries, the objective is to extract the primary server from each country and then arrange these servers in alphabetical order based on the respective country names.

  • Best score: 28
  • Best player score: 29
  • Position: #22 / 92
  • Number of attempts: 5
Populate 3D bone names list - 656 entries

Ran into this at work, excited to see how this gets optimized

  • Best score: 21
  • Best player score: 22
  • Position: #48 / 169
  • Number of attempts: 4
Remove line numbers - 784 entries

From http://web.archive.org/web/20140831121704/http://dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php#investigatingthestackwithgdb.

  • Best score: 8
  • Best player score: 12
  • Position: #62 / 208
  • Number of attempts: 7
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: #230 / 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: #203 / 328
  • Number of attempts: 2
Easier Align - 443 entries

Align the columns of a markdown table

  • Best score: 51
  • Best player score: 90
  • Position: #29 / 100
  • Number of attempts: 3
Paste a column after a column - 2668 entries

This task is very common while using multi-cursor. What is the elegant vim way ?

  • Best score: 14
  • Best player score: 15
  • Position: #123 / 578
  • Number of attempts: 6
Filter number combinations that don't add to 11 - 427 entries

Append the sum of each line to its end, alongside an equals sign, and remove any that do not sum to 11. The ordering of lines should stay the same. Note that the combinations are semi-arbitrary and not all 4-number combinations are present in the file.

  • Best score: 27
  • Best player score: 28
  • Position: #79 / 123
  • Number of attempts: 5
Tabbed Table to Python Array - 773 entries

Not payed by the hour? So make it fast ;-) The table contains the relative occurencies of bigrams (two consecutive letters) in 1/100,000 in the german language, copy-pasted from http://www.mathe.tu-freiberg.de/~hebisch/cafe/kryptographie/bigramme.html

  • Best score: 50
  • Best player score: 52
  • Position: #30 / 185
  • Number of attempts: 10
Substraction (bis) - 638 entries

Solve the equations (adapted from the original @Caek_'s challenge).

  • Best score: 21
  • Best player score: 25
  • Position: #42 / 117
  • Number of attempts: 8
Poorly indented Python comments - 1350 entries

Fix the alignment of some Python comments as quickly as possible.

  • Best score: 15
  • Best player score: 15
  • Position: #47 / 225
  • Number of attempts: 12
Many duplicates - 1483 entries

Quick and easy

  • Best score: 7
  • Best player score: 8
  • Position: #289 / 482
  • Number of attempts: 1
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: 29
  • Position: #62 / 278
  • Number of attempts: 5
Fix the shell script! - 2681 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 27
  • Position: #124 / 624
  • Number of attempts: 5
Java to JavaScript - 302 entries

Let convert some simple Java file to JavaScript!

  • Best score: 59
  • Best player score: 69
  • Position: #27 / 78
  • Number of attempts: 4
Contribute to keyboard mashing - 908 entries

Speak in tongues

  • Best score: 17
  • Best player score: 18
  • Position: #117 / 276
  • Number of attempts: 3
Reordering Lorem Ipsum - 306 entries

Who even sorted this?

  • Best score: 13
  • Best player score: 1197
  • Position: #67 / 67
  • Number of attempts: 1
Fill in the chess board - 980 entries

Fill in the name of each square using its file (a-h) and rank (1-8).

  • Best score: 19
  • Best player score: 20
  • Position: #53 / 187
  • Number of attempts: 10
Transpose a python matrix - 905 entries

Rotate the matrix in 90 degrees.

  • Best score: 23
  • Best player score: 65
  • Position: #104 / 140
  • Number of attempts: 2
Migrated to Postgres! - 349 entries

Celebration completion of this project. https://github.com/igrigorik/vimgolf/pull/322

  • Best score: 26
  • Best player score: 27
  • Position: #37 / 135
  • Number of attempts: 6
Add quotes to ansible playbook - 1042 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #89 / 331
  • Number of attempts: 2
Swap values - 4703 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 12
  • Position: #530 / 1291
  • Number of attempts: 5

Contributed Challenges

Mirror image - 126 entries

Add the second eye

Lennart
Github:

entered into 42 challenges

contributed 1 challenges