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

Tabbed Table to Python Array - 652 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: 62
  • Position: #93 / 171
  • Number of attempts: 5
HS exam question - 1523 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 68
  • Position: #171 / 404
  • Number of attempts: 3
Reformat symbols in list - 1507 entries

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

  • Best score: 24
  • Best player score: 30
  • Position: #183 / 334
  • Number of attempts: 2
2 quick changes and a numbered list - 615 entries

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

  • Best score: 37
  • Best player score: 56
  • Position: #99 / 148
  • Number of attempts: 1
Fix the shell script! - 2431 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #343 / 569
  • Number of attempts: 3
Visual block training - 1047 entries

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

  • Best score: 17
  • Best player score: 52
  • Position: #140 / 195
  • Number of attempts: 1
Put a newline after every 10 lines in vim - 1649 entries

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

  • Best score: 10
  • Best player score: 12
  • Position: #229 / 551
  • Number of attempts: 3
Wikitext headings to markdown - 985 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 26
  • Position: #115 / 207
  • Number of attempts: 1
hello-world-vimgolf - 2472 entries

Simple number generation

  • Best score: 10
  • Best player score: 11
  • Position: #399 / 699
  • Number of attempts: 3
Contribute to keyboard mashing - 880 entries

Speak in tongues

  • Best score: 17
  • Best player score: 20
  • Position: #194 / 268
  • Number of attempts: 1
Fill in the chess board - 933 entries

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

  • Best score: 19
  • Best player score: 136
  • Position: #172 / 180
  • Number of attempts: 2
Learn to ask for :help - 572 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #73 / 128
  • Number of attempts: 1
Plotting some variables in python - 1605 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: 35
  • Position: #79 / 345
  • Number of attempts: 5
Lowercase first characters - 484 entries

This is the (abridged) input for Day 3 in Advent of Code 2019. The output is a format more suitable for Prolog programming: the two lines of input become two lists of pairs, joined together in a wires functor.

  • Best score: 33
  • Best player score: 35
  • Position: #60 / 181
  • Number of attempts: 2
Increment number for every 10 lines - 229 entries

The file consists of 2 columns (code and percentage). We need to add 2 more columns with increasing number for 4th column (Xcols) and increment 3rd column (Ycols) only for every 10 lines with reset of 4th column

  • Best score: 25
  • Best player score: 72
  • Position: #52 / 63
  • Number of attempts: 1
Inverting Lines - 1870 entries

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

  • Best score: 10
  • Best player score: 13
  • Position: #338 / 505
  • Number of attempts: 1
Python dataclasses - 1121 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 26
  • Position: #157 / 281
  • Number of attempts: 2
RUST Cargo.toml version to last - 332 entries

RUST Cargo.toml version to last. rusty practice on vimgolf

  • Best score: 16
  • Best player score: 19
  • Position: #65 / 99
  • Number of attempts: 1
Modernise code - 1368 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 47
  • Position: #203 / 316
  • Number of attempts: 2
HS Final exam vimgolf - 892 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: #110 / 234
  • Number of attempts: 2
Easy modification of ssh config - 348 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 64
  • Position: #99 / 108
  • Number of attempts: 1
Mr. Hacker - 83 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: 20
  • Position: #25 / 34
  • Number of attempts: 4
Python: Def to Lambda - 441 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 27
  • Position: #149 / 154
  • Number of attempts: 1
Rural Post - 4427 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #456 / 1086
  • Number of attempts: 7
Satisfy the go linter - 2360 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: 25
  • Position: #278 / 465
  • Number of attempts: 2
Multiline to Single Line - 680 entries

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

  • Best score: 5
  • Best player score: 6
  • Position: #263 / 298
  • Number of attempts: 1
Simple, Practical, and Common - 33483 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: #2367 / 7384
  • Number of attempts: 5
Get mail address from outlook format - 642 entries

Create a mail list space separated of mail list formatted by outlook

  • Best score: 15
  • Best player score: 19
  • Position: #150 / 202
  • Number of attempts: 1
prepend * to every non-blank line - 6254 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #744 / 1530
  • Number of attempts: 2
Wget failed to download redirections - 185 entries

Output of a wget session, where 302 where not properly handled due to certificate problems, has been saved to a file. Keep the correct URLs to start again downloading.

  • Best score: 15
  • Best player score: 22
  • Position: #45 / 64
  • Number of attempts: 2
citizen_hacks_2019_challenge2 - 194 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 7
  • Position: #90 / 101
  • Number of attempts: 1
Unsemantic linewrapping - 901 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: 9
  • Position: #97 / 226
  • Number of attempts: 2
V to the i - 4771 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1485 / 1887
  • Number of attempts: 1
Applying same text modification in several lines - 2851 entries

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

  • Best score: 12
  • Best player score: 17
  • Position: #647 / 843
  • Number of attempts: 2
Add string initializers to an enum - 866 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 30
  • Position: #234 / 256
  • Number of attempts: 1
Add semicolons - 10831 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 12
  • Position: #1943 / 3055
  • Number of attempts: 1
Bad Copy Syntax - 2009 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #355 / 518
  • Number of attempts: 1
remove lines containing the word "reader" - 3556 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #845 / 1151
  • Number of attempts: 2
Com(m)a Trouble - 3711 entries

Someone was real stupid when placing his commas. Can you fix it?

  • Best score: 12
  • Best player score: 15
  • Position: #437 / 839
  • Number of attempts: 4
Box it - 7849 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 29
  • Position: #1352 / 1870
  • Number of attempts: 2
From argument to object - 1481 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: 18
  • Position: #264 / 453
  • Number of attempts: 3
Array propagate - 332 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 29
  • Position: #85 / 117
  • Number of attempts: 1
Extract argument from function - 2337 entries

The aim is to see if you can do some refactoring very fast.

  • Best score: 13
  • Best player score: 16
  • Position: #547 / 750
  • Number of attempts: 1
Search and Replace 0 - 4853 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1057 / 1605
  • Number of attempts: 2
Number Sort - 307 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

  • Best score: 9
  • Best player score: 9
  • Position: #132 / 165
  • Number of attempts: 1
That hyphen - 2572 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 10
  • Position: #283 / 698
  • Number of attempts: 4
comment and uncomment code inline - 1074 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

  • Best score: 9
  • Best player score: 18
  • Position: #295 / 316
  • Number of attempts: 1
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3180 / 4174
  • Number of attempts: 2
Extract HTML option values from tag values - 99 entries

Generate HTML option values from the text in the option tag. If the text contains multiple words, replace the spaces with an underscore and convert all capital letters to small letters.

  • Best score: 34
  • Best player score: 43
  • Position: #38 / 43
  • Number of attempts: 2
For all cases. - 145 entries

In this case... change it! :) Watch the line.

  • Best score: 8
  • Best player score: 8
  • Position: #83 / 102
  • Number of attempts: 2
Basic renumbering - 5605 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 14
  • Position: #499 / 1260
  • Number of attempts: 1
Fiddle percentages into real numbers - 841 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: 35
  • Position: #283 / 288
  • Number of attempts: 1
Nesting SASS - 262 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 17
  • Position: #81 / 94
  • Number of attempts: 1
Add to end of each line... kinda - 329 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

  • Best score: 12
  • Best player score: 13
  • Position: #157 / 173
  • Number of attempts: 1
Combines all items - 307 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #128 / 139
  • Number of attempts: 2
Vice versa - 7865 entries

Little role switching.

  • Best score: 12
  • Best player score: 14
  • Position: #972 / 2114
  • Number of attempts: 2
Paragraph sort - 431 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

  • Best score: 14
  • Best player score: 17
  • Position: #76 / 124
  • Number of attempts: 3
Sort files from hosts - 180 entries

Resume files by host. I hope you enjoy with this challenge

  • Best score: 15
  • Best player score: 18
  • Position: #67 / 75
  • Number of attempts: 4
comments galore - 1017 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 11
  • Position: #370 / 421
  • Number of attempts: 2
Angular naming conventions - 307 entries

In angular, a directive name follows the camelCase convention. When the directive is used in an HTML template, the words are instead separated by a dash. Go from to the other the fastest!

  • Best score: 18
  • Best player score: 22
  • Position: #87 / 117
  • Number of attempts: 2
Replace and keep the case - 415 entries

Replace all instance of plugin and Plugin to device and Device.

  • Best score: 26
  • Best player score: 27
  • Position: #64 / 117
  • Number of attempts: 6
Change attribute to getter - 134 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 29
  • Position: #51 / 58
  • Number of attempts: 3
Generate a list of numbers - 284 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 18
  • Position: #133 / 137
  • Number of attempts: 1
One to Ten - 2174 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: #349 / 664
  • Number of attempts: 2
Change part of a function name in multiple occurrences - 648 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: 17
  • Position: #162 / 205
  • Number of attempts: 1
citizen_hacks_2019_challenge5 - 139 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 8
  • Position: #73 / 75
  • Number of attempts: 1
Increment each number - 995 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 21
  • Position: #180 / 245
  • Number of attempts: 1
Song Transcription Oops - 236 entries

When transcribing vocal music to Canjo Tab you can start by finding the lowest note and assigning that to zero and working your way up from there. However, without fail, I tend to miscount the notes and when I am near done I find a lower note. I mark this with a "z". This means I have to increase all the previous ones by 1. just a sting of numbers :)

  • Best score: 15
  • Best player score: 23
  • Position: #65 / 77
  • Number of attempts: 1
change parenthesis - 287 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #142 / 160
  • Number of attempts: 1
Array transposition - 2407 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 28
  • Position: #348 / 445
  • Number of attempts: 1
convert yml into java pojo field - 837 entries

How fast vim can create fields for java pojo i.e class declaration referring to a (simple) yml file

  • Best score: 29
  • Best player score: 32
  • Position: #159 / 225
  • Number of attempts: 2
Assign numbers to fields - 107 entries

You are given a list of space-separated strings. Add an increasing numeric prefix to each one.

  • Best score: 19
  • Best player score: 20
  • Position: #46 / 61
  • Number of attempts: 1
Mirror Symmetry - 812 entries

Add backslashes.

  • Best score: 7
  • Best player score: 12
  • Position: #169 / 268
  • Number of attempts: 2
unknown command - 166 entries

I want change 5 words

  • Best score: 7
  • Best player score: 7
  • Position: #62 / 86
  • Number of attempts: 2
Collect List - 4267 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 17
  • Position: #1008 / 1188
  • Number of attempts: 2
VimGolfNight - 538 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #285 / 344
  • Number of attempts: 1
Fix the XML - 1000 entries

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

  • Best score: 18
  • Best player score: 22
  • Position: #99 / 287
  • Number of attempts: 4
Mute the second method of this script - 449 entries

prepend a # infront of every line of the second method

  • Best score: 8
  • Best player score: 10
  • Position: #220 / 238
  • Number of attempts: 1
Change name of a variable - 173 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Position: #125 / 136
  • Number of attempts: 1
Two become one - 713 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 32
  • Position: #122 / 208
  • Number of attempts: 2
Where should I put the Newline? - 874 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Position: #427 / 436
  • Number of attempts: 1
Letter case trickery - 1598 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: #462 / 514
  • Number of attempts: 1
quotes inside quotes - 3128 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: 19
  • Position: #998 / 1073
  • Number of attempts: 1
Pairs of numbers - 361 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: 40
  • Position: #89 / 134
  • Number of attempts: 1
Delete unwanted lines - 398 entries

Delete all lines which does not end in "o.."

  • Best score: 9
  • Best player score: 9
  • Position: #192 / 227
  • Number of attempts: 1
A simple change - 444 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #129 / 190
  • Number of attempts: 3
The Quick Brown Fox Jumps Over The Lazy Vim - 404 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 8
  • Best player score: 12
  • Position: #170 / 190
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 338 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

  • Best score: 25
  • Best player score: 44
  • Position: #103 / 112
  • Number of attempts: 1
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #386 / 748
  • Number of attempts: 2
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 28
  • Position: #611 / 772
  • Number of attempts: 1
Switch function arguments - 2085 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 15
  • Position: #570 / 653
  • Number of attempts: 1
Append semicolon after expressions - 1023 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #260 / 410
  • Number of attempts: 2
Remove noise from HTTP log - 700 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 17
  • Position: #233 / 272
  • Number of attempts: 2
Remove semicolons after expressions - 639 entries

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

  • Best score: 6
  • Best player score: 7
  • Position: #144 / 261
  • Number of attempts: 4
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 13
  • Position: #1255 / 1742
  • Number of attempts: 1
Ugly spreadsheet copy/paste to CSV - 978 entries

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

  • Best score: 19
  • Best player score: 63
  • Position: #179 / 188
  • Number of attempts: 1
Make it more readable - 1955 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #408 / 643
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 508 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: #139 / 149
  • Number of attempts: 1
Numbering a List - 1869 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 14
  • Position: #86 / 646
  • Number of attempts: 1
Reverse and count - 459 entries

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

  • Best score: 18
  • Best player score: 22
  • Position: #46 / 174
  • Number of attempts: 1
Hatsuyume - 467 entries

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

  • Best score: 15
  • Best player score: 27
  • Position: #105 / 179
  • Number of attempts: 1
Almost encrypted - 199 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 6
  • Position: #139 / 145
  • Number of attempts: 1
Make Fancy Header - 1024 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 23
  • Position: #289 / 340
  • Number of attempts: 1
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 18
  • Position: #2610 / 3626
  • Number of attempts: 1
vimgolfaccfekxh
Twitter:

entered into 104 challenges

contributed 0 challenges