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 - 90 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: 52
  • Best player score: 62
  • Position: #16 / 31
  • Number of attempts: 5
HS exam question - 790 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 68
  • Position: #89 / 204
  • Number of attempts: 3
Reformat symbols in list - 662 entries

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

  • Best score: 24
  • Best player score: 30
  • Position: #84 / 150
  • Number of attempts: 2
2 quick changes and a numbered list - 359 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: #61 / 88
  • Number of attempts: 1
Fix the shell script! - 1402 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #208 / 347
  • Number of attempts: 3
Visual block training - 630 entries

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

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

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

  • Best score: 10
  • Best player score: 12
  • Position: #159 / 401
  • Number of attempts: 3
Wikitext headings to markdown - 709 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 26
  • Position: #84 / 157
  • Number of attempts: 1
hello-world-vimgolf - 1762 entries

Simple number generation

  • Best score: 10
  • Best player score: 11
  • Position: #297 / 507
  • Number of attempts: 3
Contribute to keyboard mashing - 692 entries

Speak in tongues

  • Best score: 17
  • Best player score: 20
  • Position: #159 / 214
  • Number of attempts: 1
Fill in the chess board - 665 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: #134 / 140
  • Number of attempts: 2
Learn to ask for :help - 447 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #61 / 102
  • Number of attempts: 1
Plotting some variables in python - 1269 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: #66 / 270
  • Number of attempts: 5
Lowercase first characters - 387 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: #48 / 142
  • Number of attempts: 2
Increment number for every 10 lines - 173 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: #40 / 50
  • Number of attempts: 1
Inverting Lines - 1447 entries

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

  • Best score: 10
  • Best player score: 13
  • Position: #267 / 396
  • Number of attempts: 1
Python dataclasses - 710 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 26
  • Position: #97 / 183
  • Number of attempts: 2
RUST Cargo.toml version to last - 252 entries

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

  • Best score: 16
  • Best player score: 19
  • Position: #54 / 74
  • Number of attempts: 1
Modernise code - 999 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 47
  • Position: #153 / 225
  • Number of attempts: 2
HS Final exam vimgolf - 746 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: #93 / 201
  • Number of attempts: 2
Easy modification of ssh config - 265 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 64
  • Position: #80 / 86
  • Number of attempts: 1
Mr. Hacker - 72 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: #21 / 30
  • Number of attempts: 4
Python: Def to Lambda - 392 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 27
  • Position: #131 / 135
  • Number of attempts: 1
Rural Post - 4160 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #436 / 1030
  • Number of attempts: 7
Satisfy the go linter - 2032 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: #242 / 413
  • Number of attempts: 2
Multiline to Single Line - 552 entries

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

  • Best score: 5
  • Best player score: 6
  • Position: #223 / 248
  • Number of attempts: 1
Simple, Practical, and Common - 33029 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: #2368 / 7290
  • Number of attempts: 5
Get mail address from outlook format - 600 entries

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

  • Best score: 15
  • Best player score: 19
  • Position: #140 / 188
  • Number of attempts: 1
prepend * to every non-blank line - 6061 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #722 / 1481
  • Number of attempts: 2
Wget failed to download redirections - 180 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: #43 / 61
  • Number of attempts: 2
citizen_hacks_2019_challenge2 - 180 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 7
  • Position: #83 / 92
  • Number of attempts: 1
Unsemantic linewrapping - 849 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 / 215
  • Number of attempts: 2
V to the i - 4647 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1472 / 1861
  • Number of attempts: 1
Applying same text modification in several lines - 2768 entries

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

  • Best score: 12
  • Best player score: 17
  • Position: #629 / 821
  • Number of attempts: 2
Add string initializers to an enum - 802 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 30
  • Position: #220 / 240
  • Number of attempts: 1
Add semicolons - 10715 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 12
  • Position: #1920 / 3019
  • Number of attempts: 1
Bad Copy Syntax - 1951 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #340 / 497
  • Number of attempts: 1
remove lines containing the word "reader" - 3480 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #834 / 1127
  • Number of attempts: 2
Com(m)a Trouble - 3454 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #409 / 775
  • Number of attempts: 4
Box it - 7718 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 29
  • Position: #1327 / 1841
  • Number of attempts: 2
From argument to object - 1439 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: #258 / 440
  • Number of attempts: 3
Array propagate - 318 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 29
  • Position: #82 / 114
  • Number of attempts: 1
Extract argument from function - 2261 entries

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

  • Best score: 13
  • Best player score: 16
  • Position: #536 / 735
  • Number of attempts: 1
Search and Replace 0 - 4722 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1032 / 1562
  • Number of attempts: 2
Number Sort - 294 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 / 157
  • Number of attempts: 1
That hyphen - 2520 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 10
  • Position: #279 / 688
  • Number of attempts: 4
comment and uncomment code inline - 1019 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: #283 / 301
  • Number of attempts: 1
Just the middle - 11281 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3170 / 4139
  • Number of attempts: 2
Extract HTML option values from tag values - 81 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: #33 / 38
  • Number of attempts: 2
For all cases. - 131 entries

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

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

Renumbering Basic.

  • Best score: 11
  • Best player score: 14
  • Position: #488 / 1238
  • Number of attempts: 1
Fiddle percentages into real numbers - 805 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: #272 / 276
  • Number of attempts: 1
Nesting SASS - 257 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 17
  • Position: #78 / 91
  • Number of attempts: 1
Add to end of each line... kinda - 307 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: #148 / 163
  • Number of attempts: 1
Combines all items - 290 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #124 / 131
  • Number of attempts: 2
Vice versa - 7598 entries

Little role switching.

  • Best score: 12
  • Best player score: 14
  • Position: #952 / 2059
  • Number of attempts: 2
Paragraph sort - 421 entries

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

  • Best score: 14
  • Best player score: 17
  • Position: #75 / 122
  • Number of attempts: 3
Sort files from hosts - 167 entries

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

  • Best score: 15
  • Best player score: 18
  • Position: #64 / 70
  • Number of attempts: 4
comments galore - 982 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 11
  • Position: #363 / 414
  • Number of attempts: 2
Angular naming conventions - 285 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: #82 / 111
  • Number of attempts: 2
Replace and keep the case - 405 entries

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

  • Best score: 26
  • Best player score: 27
  • Position: #61 / 114
  • Number of attempts: 6
Change attribute to getter - 121 entries

Wrap attributes with a getter method.

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

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 18
  • Position: #130 / 134
  • Number of attempts: 1
One to Ten - 2116 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 / 647
  • Number of attempts: 2
Change part of a function name in multiple occurrences - 611 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: #153 / 196
  • Number of attempts: 1
citizen_hacks_2019_challenge5 - 123 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 8
  • Position: #64 / 66
  • Number of attempts: 1
Increment each number - 957 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 21
  • Position: #175 / 236
  • Number of attempts: 1
Song Transcription Oops - 227 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: #61 / 72
  • Number of attempts: 1
change parenthesis - 260 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #135 / 147
  • Number of attempts: 1
Array transposition - 2321 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 28
  • Position: #339 / 434
  • Number of attempts: 1
convert yml into java pojo field - 823 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: #155 / 220
  • Number of attempts: 2
Assign numbers to fields - 94 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: #42 / 53
  • Number of attempts: 1
Mirror Symmetry - 787 entries

Add backslashes.

  • Best score: 7
  • Best player score: 12
  • Position: #165 / 264
  • Number of attempts: 2
unknown command - 149 entries

I want change 5 words

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

Convert to comma separated list.

  • Best score: 12
  • Best player score: 17
  • Position: #997 / 1173
  • Number of attempts: 2
VimGolfNight - 510 entries

Based on "The name of the game".

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

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

  • Best score: 18
  • Best player score: 22
  • Position: #95 / 280
  • Number of attempts: 4
Mute the second method of this script - 444 entries

prepend a # infront of every line of the second method

  • Best score: 9
  • Best player score: 10
  • Position: #219 / 236
  • Number of attempts: 1
Change name of a variable - 167 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 / 130
  • Number of attempts: 1
Two become one - 706 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: #120 / 204
  • Number of attempts: 2
Where should I put the Newline? - 849 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Position: #416 / 425
  • Number of attempts: 1
Letter case trickery - 1563 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: #453 / 503
  • Number of attempts: 1
quotes inside quotes - 3070 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: #983 / 1055
  • Number of attempts: 1
Pairs of numbers - 347 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: #86 / 131
  • Number of attempts: 1
Delete unwanted lines - 390 entries

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

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #127 / 184
  • Number of attempts: 3
The Quick Brown Fox Jumps Over The Lazy Vim - 393 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: #166 / 183
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 335 entries

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

  • Best score: 25
  • Best player score: 44
  • Position: #102 / 110
  • Number of attempts: 1
Vertical Limit - 2386 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #376 / 723
  • Number of attempts: 2
replacing each line of a block selection - 2871 entries

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

  • Best score: 18
  • Best player score: 28
  • Position: #596 / 751
  • Number of attempts: 1
Switch function arguments - 1996 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 15
  • Position: #554 / 632
  • Number of attempts: 1
Append semicolon after expressions - 973 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #252 / 393
  • Number of attempts: 2
Remove noise from HTTP log - 668 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: #229 / 264
  • Number of attempts: 2
Remove semicolons after expressions - 580 entries

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

  • Best score: 6
  • Best player score: 7
  • Position: #136 / 245
  • Number of attempts: 4
switch variable - 4974 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 13
  • Position: #1241 / 1715
  • Number of attempts: 1
Ugly spreadsheet copy/paste to CSV - 926 entries

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

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

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #404 / 632
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 503 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: #136 / 145
  • Number of attempts: 1
Numbering a List - 1838 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 14
  • Position: #79 / 631
  • Number of attempts: 1
Reverse and count - 422 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: #40 / 162
  • Number of attempts: 1
Hatsuyume - 430 entries

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

  • Best score: 16
  • Best player score: 27
  • Position: #98 / 170
  • Number of attempts: 1
Almost encrypted - 187 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 6
  • Position: #135 / 141
  • Number of attempts: 1
Make Fancy Header - 984 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 23
  • Position: #284 / 332
  • Number of attempts: 1
Simple text editing with Vim - 11753 entries

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

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

entered into 104 challenges

contributed 0 challenges