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 - 61 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: 17
  • Position: #16 / 21
  • Number of attempts: 4
New teacher - 782 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 24
  • Position: #57 / 161
  • Number of attempts: 4
months to html list items - 916 entries

Turn the months into list items.

  • Best score: 22
  • Best player score: 25
  • Position: #105 / 242
  • Number of attempts: 1
Quicksort - 1838 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: #138 / 403
  • Number of attempts: 5
Find fix point of cos - 1303 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: #96 / 381
  • Number of attempts: 5
Paste a column after a column - 2477 entries

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

  • Best score: 14
  • Best player score: 21
  • Position: #311 / 535
  • Number of attempts: 1
Tabbed Table to Python Array - 706 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: 63
  • Position: #103 / 174
  • Number of attempts: 2
HS exam question - 1539 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 55
  • Position: #74 / 410
  • Number of attempts: 6
Reformat symbols in list - 1570 entries

Saw this in some lecture, easy reformatting using multiple cursor in VS Code

  • Best score: 24
  • Best player score: 25
  • Position: #94 / 337
  • Number of attempts: 4
Substraction (bis) - 584 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #32 / 111
  • Number of attempts: 2
Poorly indented Python comments - 1300 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #35 / 218
  • Number of attempts: 8
Many duplicates - 1420 entries

Quick and easy

  • Best score: 7
  • Best player score: 8
  • Position: #226 / 458
  • Number of attempts: 2
2 quick changes and a numbered list - 642 entries

The ascii will not be lost, but rather numbered in 4 digit blocks with leading zeros.

  • Best score: 37
  • Best player score: 37
  • Position: #23 / 153
  • Number of attempts: 6
delete swap - 1754 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #242 / 542
  • Number of attempts: 1
Generate a very basic Python constructor (fixed) - 1250 entries

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

  • Best score: 29
  • Best player score: 44
  • Position: #144 / 270
  • Number of attempts: 1
hello-world-vimgolf - 2481 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #267 / 702
  • Number of attempts: 5
Contribute to keyboard mashing - 887 entries

Speak in tongues

  • Best score: 17
  • Best player score: 18
  • Position: #102 / 269
  • Number of attempts: 3
Learn to ask for :help - 587 entries

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

  • Best score: 19
  • Best player score: 23
  • Position: #31 / 130
  • Number of attempts: 7
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: 34
  • Position: #49 / 347
  • Number of attempts: 8
CSV to MD format - 413 entries

To convert a CSV list to Markdown list

  • Best score: 36
  • Best player score: 79
  • Position: #49 / 94
  • Number of attempts: 3
Python dataclasses - 1127 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 19
  • Position: #56 / 283
  • Number of attempts: 3
Making 3 line function a one liner. - 324 entries

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #140 / 201
  • Number of attempts: 1
Modernise code - 1386 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 42
  • Position: #147 / 318
  • Number of attempts: 2
Enumerate Bullets - 320 entries

We will need to refer to the bullet points in our document explicitly later, so we need to assign them some ID's!

  • Best score: 20
  • Best player score: 24
  • Position: #45 / 84
  • Number of attempts: 3
swap number pairs - 2064 entries

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

  • Best score: 16
  • Best player score: 17
  • Position: #108 / 375
  • Number of attempts: 3
HS Final exam vimgolf - 894 entries

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

  • Best score: 21
  • Best player score: 28
  • Position: #141 / 235
  • Number of attempts: 1
Easy modification of ssh config - 353 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 25
  • Position: #36 / 109
  • Number of attempts: 4
Rural Post - 4450 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #464 / 1089
  • Number of attempts: 3
Satisfy the go linter - 2366 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: 24
  • Position: #251 / 467
  • Number of attempts: 1
Yo To Hello - 1127 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #383 / 522
  • Number of attempts: 1
Simple, Practical, and Common - 33528 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: 22
  • Position: #2383 / 7396
  • Number of attempts: 8
prepend * to every non-blank line - 6288 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #432 / 1532
  • Number of attempts: 2
Quote modules - 1072 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 25
  • Position: #133 / 279
  • Number of attempts: 1
Swap values inside brackets - 2480 entries

Easy challenge.

  • Best score: 14
  • Best player score: 21
  • Position: #436 / 575
  • Number of attempts: 1
Unsemantic linewrapping - 918 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: 10
  • Position: #151 / 228
  • Number of attempts: 6
Applying same text modification in several lines - 2859 entries

Remove identical text at the beginning of several lines and the closing parenthesis.

  • Best score: 12
  • Best player score: 12
  • Position: #22 / 845
  • Number of attempts: 4
Add string initializers to an enum - 872 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #101 / 258
  • Number of attempts: 4
Add semicolons - 10841 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1765 / 3058
  • Number of attempts: 3
Bad Copy Syntax - 2024 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #303 / 520
  • Number of attempts: 1
remove lines containing the word "reader" - 3573 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #849 / 1157
  • Number of attempts: 3
Box it - 7897 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 27
  • Position: #1196 / 1872
  • Number of attempts: 1
Cool or not? - 829 entries

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 16
  • Position: #121 / 230
  • 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: 22
  • Position: #240 / 380
  • Number of attempts: 2
Two pairs of cluster of letters creates word - 749 entries

Clean and group.

  • Best score: 17
  • Best player score: 18
  • Position: #93 / 178
  • Number of attempts: 3
Every other line - 2910 entries

AaAaAaA

  • Best score: 12
  • Best player score: 17
  • Position: #525 / 703
  • Number of attempts: 1
Search and Replace 0 - 4951 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #716 / 1614
  • Number of attempts: 2
Just the middle - 11411 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3188 / 4181
  • Number of attempts: 2
Team names - 1834 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 20
  • Position: #499 / 587
  • Number of attempts: 1
Remember VimGolf Rules ! - 261 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 8
  • Position: #127 / 141
  • Number of attempts: 1
Fiddle percentages into real numbers - 862 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

  • Best score: 13
  • Best player score: 13
  • Position: #161 / 289
  • Number of attempts: 2
Combines all items - 313 entries

For each line that starts with the same number I want to combine its contents

  • Best score: 9
  • Best player score: 9
  • Position: #85 / 140
  • Number of attempts: 4
ninja substitution - 1420 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 15
  • Position: #139 / 267
  • Number of attempts: 5
Change part of a function name in multiple occurrences - 661 entries

Change the middle part of the function name in multiple places, preferably using the next and dot commands.

  • Best score: 14
  • Best player score: 15
  • Position: #126 / 207
  • Number of attempts: 3
Increment each number - 1020 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 17
  • Position: #89 / 247
  • Number of attempts: 6
Join 'em - 251 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #138 / 151
  • Number of attempts: 3
Delete to the end of the current line - 810 entries

Delete to the end of the current line, but keep the character under the cursor.

  • Best score: 5
  • Best player score: 5
  • Position: #252 / 389
  • Number of attempts: 1
change parenthesis - 296 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #89 / 161
  • Number of attempts: 3
Remove quotes after first field - 380 entries

Remove the quotes around each field except for the first field.

  • Best score: 16
  • Best player score: 18
  • Position: #45 / 91
  • Number of attempts: 2
Reorder the groups - 1176 entries

Change the order so that the groups of fruit come before the vegetables.

  • Best score: 14
  • Best player score: 15
  • Position: #123 / 263
  • Number of attempts: 4
move titles next to url, in quotes - 529 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 24
  • Position: #116 / 139
  • Number of attempts: 1
Array transposition - 2415 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 16
  • Position: #45 / 446
  • Number of attempts: 10
Simple format (2) - 335 entries

try again!

  • Best score: 23
  • Best player score: 23
  • Position: #19 / 70
  • Number of attempts: 7
attr_aligner - 3498 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #497 / 696
  • Number of attempts: 1
Letter case trickery - 1619 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: 10
  • Position: #173 / 515
  • Number of attempts: 4
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: 15
  • Position: #512 / 1075
  • Number of attempts: 4
replacing each line of a block selection - 2979 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #227 / 773
  • Number of attempts: 6
Ugly spreadsheet copy/paste to CSV - 998 entries

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

  • Best score: 19
  • Best player score: 48
  • Position: #143 / 190
  • Number of attempts: 1
Simple text editing with Vim - 12616 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1943 / 3650
  • Number of attempts: 1
someone
Twitter2:

entered into 68 challenges

contributed 0 challenges