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 - 643 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: #91 / 166
  • Number of attempts: 5
HS exam question - 1497 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 68
  • Position: #166 / 393
  • Number of attempts: 3
Reformat symbols in list - 1466 entries

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

  • Best score: 24
  • Best player score: 30
  • Position: #177 / 322
  • Number of attempts: 2
2 quick changes and a numbered list - 599 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: #97 / 145
  • Number of attempts: 1
Fix the shell script! - 2338 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #331 / 540
  • Number of attempts: 3
Visual block training - 1001 entries

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

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

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

  • Best score: 10
  • Best player score: 12
  • Position: #222 / 524
  • Number of attempts: 3
Wikitext headings to markdown - 980 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 26
  • Position: #113 / 203
  • Number of attempts: 1
hello-world-vimgolf - 2346 entries

Simple number generation

  • Best score: 10
  • Best player score: 11
  • Position: #382 / 663
  • Number of attempts: 3
Contribute to keyboard mashing - 839 entries

Speak in tongues

  • Best score: 17
  • Best player score: 20
  • Position: #187 / 256
  • Number of attempts: 1
Fill in the chess board - 905 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: #167 / 175
  • Number of attempts: 2
Learn to ask for :help - 531 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #69 / 121
  • Number of attempts: 1
Plotting some variables in python - 1558 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: #77 / 333
  • Number of attempts: 5
Lowercase first characters - 467 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: #57 / 175
  • Number of attempts: 2
Increment number for every 10 lines - 219 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: #50 / 61
  • Number of attempts: 1
Inverting Lines - 1832 entries

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

  • Best score: 10
  • Best player score: 13
  • Position: #331 / 497
  • Number of attempts: 1
Python dataclasses - 1104 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 26
  • Position: #155 / 277
  • Number of attempts: 2
RUST Cargo.toml version to last - 320 entries

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

  • Best score: 16
  • Best player score: 19
  • Position: #64 / 95
  • Number of attempts: 1
Modernise code - 1333 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 47
  • Position: #197 / 307
  • Number of attempts: 2
HS Final exam vimgolf - 864 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: #106 / 227
  • Number of attempts: 2
Easy modification of ssh config - 335 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 64
  • Position: #97 / 104
  • Number of attempts: 1
Mr. Hacker - 78 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: #23 / 32
  • Number of attempts: 4
Python: Def to Lambda - 423 entries

LAMBDA!!!

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

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

  • Best score: 9
  • Best player score: 10
  • Position: #449 / 1071
  • Number of attempts: 7
Satisfy the go linter - 2329 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: #274 / 457
  • Number of attempts: 2
Multiline to Single Line - 668 entries

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

  • Best score: 5
  • Best player score: 6
  • Position: #258 / 292
  • Number of attempts: 1
Simple, Practical, and Common - 33379 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 / 7363
  • Number of attempts: 5
Get mail address from outlook format - 621 entries

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

  • Best score: 15
  • Best player score: 19
  • Position: #146 / 196
  • Number of attempts: 1
prepend * to every non-blank line - 6208 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #736 / 1517
  • Number of attempts: 2
Wget failed to download redirections - 184 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: #44 / 63
  • Number of attempts: 2
citizen_hacks_2019_challenge2 - 189 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 7
  • Position: #88 / 99
  • Number of attempts: 1
Unsemantic linewrapping - 890 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 / 224
  • Number of attempts: 2
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1483 / 1879
  • Number of attempts: 1
Applying same text modification in several lines - 2845 entries

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

  • Best score: 12
  • Best player score: 17
  • Position: #646 / 840
  • Number of attempts: 2
Add string initializers to an enum - 862 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 30
  • Position: #232 / 254
  • Number of attempts: 1
Add semicolons - 10792 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 12
  • Position: #1936 / 3044
  • Number of attempts: 1
Bad Copy Syntax - 2001 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #353 / 516
  • Number of attempts: 1
remove lines containing the word "reader" - 3537 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #840 / 1144
  • Number of attempts: 2
Com(m)a Trouble - 3668 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #431 / 826
  • Number of attempts: 4
Box it - 7827 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 29
  • Position: #1348 / 1864
  • Number of attempts: 2
From argument to object - 1474 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: #262 / 450
  • Number of attempts: 3
Array propagate - 319 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 29
  • Position: #83 / 115
  • Number of attempts: 1
Extract argument from function - 2314 entries

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

  • Best score: 13
  • Best player score: 16
  • Position: #543 / 744
  • Number of attempts: 1
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1045 / 1585
  • Number of attempts: 2
Number Sort - 303 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 / 162
  • Number of attempts: 1
That hyphen - 2556 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 10
  • Position: #280 / 695
  • Number of attempts: 4
comment and uncomment code inline - 1069 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: #294 / 314
  • Number of attempts: 1
Just the middle - 11360 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3178 / 4164
  • Number of attempts: 2
Extract HTML option values from tag values - 98 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: #37 / 42
  • Number of attempts: 2
For all cases. - 141 entries

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

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

Renumbering Basic.

  • Best score: 11
  • Best player score: 14
  • Position: #497 / 1258
  • Number of attempts: 1
Fiddle percentages into real numbers - 840 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: #282 / 287
  • Number of attempts: 1
Nesting SASS - 261 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 17
  • Position: #80 / 93
  • Number of attempts: 1
Add to end of each line... kinda - 325 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: #155 / 171
  • Number of attempts: 1
Combines all items - 303 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #126 / 137
  • Number of attempts: 2
Vice versa - 7803 entries

Little role switching.

  • Best score: 12
  • Best player score: 14
  • Position: #969 / 2100
  • Number of attempts: 2
Paragraph sort - 430 entries

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

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

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

  • Best score: 15
  • Best player score: 18
  • Position: #66 / 74
  • Number of attempts: 4
comments galore - 998 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 11
  • Position: #367 / 418
  • Number of attempts: 2
Angular naming conventions - 301 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: #84 / 114
  • Number of attempts: 2
Replace and keep the case - 407 entries

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

  • Best score: 26
  • Best player score: 27
  • Position: #62 / 115
  • Number of attempts: 6
Change attribute to getter - 133 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 29
  • Position: #50 / 57
  • Number of attempts: 3
Generate a list of numbers - 283 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 18
  • Position: #132 / 136
  • Number of attempts: 1
One to Ten - 2165 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 / 662
  • Number of attempts: 2
Change part of a function name in multiple occurrences - 639 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: #160 / 203
  • Number of attempts: 1
citizen_hacks_2019_challenge5 - 137 entries

For the Citizen Hacks 2019 Vim competition.

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

Increment each number individually by one

  • Best score: 15
  • Best player score: 21
  • Position: #178 / 242
  • Number of attempts: 1
Song Transcription Oops - 234 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: #63 / 75
  • Number of attempts: 1
change parenthesis - 278 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #139 / 156
  • Number of attempts: 1
Array transposition - 2378 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 28
  • Position: #346 / 443
  • Number of attempts: 1
convert yml into java pojo field - 829 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: #157 / 223
  • Number of attempts: 2
Assign numbers to fields - 105 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: #45 / 59
  • Number of attempts: 1
Mirror Symmetry - 798 entries

Add backslashes.

  • Best score: 7
  • Best player score: 12
  • Position: #167 / 266
  • Number of attempts: 2
unknown command - 158 entries

I want change 5 words

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

Convert to comma separated list.

  • Best score: 12
  • Best player score: 17
  • Position: #1006 / 1186
  • Number of attempts: 2
VimGolfNight - 536 entries

Based on "The name of the game".

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

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

  • Best score: 18
  • Best player score: 22
  • Position: #98 / 284
  • Number of attempts: 4
Mute the second method of this script - 447 entries

prepend a # infront of every line of the second method

  • Best score: 9
  • Best player score: 10
  • Position: #219 / 237
  • Number of attempts: 1
Change name of a variable - 169 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 / 132
  • Number of attempts: 1
Two become one - 710 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: #121 / 205
  • Number of attempts: 2
Where should I put the Newline? - 863 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Position: #422 / 431
  • Number of attempts: 1
Letter case trickery - 1594 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: #459 / 511
  • Number of attempts: 1
quotes inside quotes - 3125 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: #997 / 1072
  • Number of attempts: 1
Pairs of numbers - 360 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: #88 / 133
  • Number of attempts: 1
Delete unwanted lines - 396 entries

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

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #128 / 189
  • Number of attempts: 3
The Quick Brown Fox Jumps Over The Lazy Vim - 401 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: #169 / 188
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 337 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 / 111
  • Number of attempts: 1
Vertical Limit - 2437 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #381 / 736
  • Number of attempts: 2
replacing each line of a block selection - 2946 entries

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

  • Best score: 18
  • Best player score: 28
  • Position: #608 / 767
  • Number of attempts: 1
Switch function arguments - 2078 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 15
  • Position: #569 / 651
  • Number of attempts: 1
Append semicolon after expressions - 1005 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #256 / 403
  • Number of attempts: 2
Remove noise from HTTP log - 695 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: #231 / 270
  • Number of attempts: 2
Remove semicolons after expressions - 628 entries

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

  • Best score: 6
  • Best player score: 7
  • Position: #141 / 258
  • Number of attempts: 4
switch variable - 5031 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 13
  • Position: #1251 / 1735
  • Number of attempts: 1
Ugly spreadsheet copy/paste to CSV - 973 entries

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

  • Best score: 19
  • Best player score: 63
  • Position: #177 / 185
  • Number of attempts: 1
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #407 / 640
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 507 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: #138 / 148
  • Number of attempts: 1
Numbering a List - 1859 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 14
  • Position: #83 / 639
  • Number of attempts: 1
Reverse and count - 456 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: #45 / 172
  • Number of attempts: 1
Hatsuyume - 457 entries

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

  • Best score: 16
  • Best player score: 27
  • Position: #102 / 175
  • Number of attempts: 1
Almost encrypted - 198 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 6
  • Position: #138 / 144
  • Number of attempts: 1
Make Fancy Header - 1014 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 23
  • Position: #287 / 338
  • Number of attempts: 1
Simple text editing with Vim - 12281 entries

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

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

entered into 104 challenges

contributed 0 challenges