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

Reformat symbols in list - 668 entries

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

  • Best score: 24
  • Best player score: 27
  • Position: #58 / 151
  • Number of attempts: 2
delete swap - 740 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #113 / 253
  • Number of attempts: 1
Fix the shell script! - 1402 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 33
  • Position: #174 / 347
  • 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: 13
  • Position: #279 / 401
  • Number of attempts: 1
Wikitext headings to markdown - 709 entries

Convert the wikitext headings to markdown.

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

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 20
  • Position: #156 / 214
  • Number of attempts: 2
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: 25
  • Position: #46 / 140
  • Number of attempts: 1
simple replacements - 1177 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 19
  • Position: #64 / 262
  • Number of attempts: 4
Inverting Lines - 1447 entries

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

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

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 27
  • Position: #102 / 183
  • Number of attempts: 2
Making 3 line function a one liner. - 197 entries

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #103 / 129
  • Number of attempts: 1
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: #92 / 201
  • Number of attempts: 1
Python: Def to Lambda - 392 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 22
  • Position: #106 / 135
  • Number of attempts: 2
Rural Post - 4160 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #433 / 1030
  • Number of attempts: 3
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: 28
  • Position: #305 / 413
  • Number of attempts: 1
xrandr outputs and dashes - 613 entries

uh oh, different video drivers identify display outputs with more dashes. Quick, need to change this xrandr script!

  • Best score: 12
  • Best player score: 12
  • Position: #131 / 199
  • Number of attempts: 3
Yo To Hello - 1066 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #370 / 489
  • Number of attempts: 3
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: #2363 / 7290
  • Number of attempts: 3
Hogwarts Email Sorting - 841 entries

Given a list of emails, get the students full name and their associated house.

  • Best score: 20
  • Best player score: 22
  • Position: #162 / 243
  • Number of attempts: 1
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: 16
  • Position: #118 / 188
  • Number of attempts: 1
Swap values - 4484 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 15
  • Position: #959 / 1245
  • 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: 14
  • Position: #871 / 1481
  • Number of attempts: 1
citizen_hacks_2019_part1 - 35 entries

For the Citizen Hacks 2019 Vim competition

  • Best score: 52
  • Best player score: 58
  • Position: #9 / 13
  • Number of attempts: 2
citizen_hacks_2019_challenge2 - 180 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #60 / 92
  • Number of attempts: 1
Swap values inside brackets - 2440 entries

Easy challenge.

  • Best score: 14
  • Best player score: 17
  • Position: #308 / 563
  • Number of attempts: 4
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: 15
  • Position: #195 / 215
  • 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: 13
  • Position: #255 / 821
  • Number of attempts: 5
Add string initializers to an enum - 802 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 27
  • Position: #183 / 240
  • Number of attempts: 1
Swap the operands under comparison - 263 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

  • Best score: 19
  • Best player score: 23
  • Position: #56 / 95
  • Number of attempts: 1
Add semicolons - 10715 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1747 / 3019
  • Number of attempts: 2
remove lines containing the word "reader" - 3480 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #487 / 1127
  • Number of attempts: 4
citizen_hacks_2019_challenge3 - 31 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 4
  • Best player score: 4
  • Position: #26 / 28
  • Number of attempts: 1
multiple cursor alternative - 1452 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: #233 / 371
  • Number of attempts: 1
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: 20
  • Position: #333 / 440
  • Number of attempts: 1
Copy three lines - 2819 entries

If the site is up (by some miracle), make the text under every header identical.

  • Best score: 13
  • Best player score: 20
  • Position: #420 / 629
  • 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: 27
  • Position: #60 / 114
  • Number of attempts: 1
Search and Replace 0 - 4722 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #702 / 1562
  • Number of attempts: 1
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: #130 / 157
  • Number of attempts: 2
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: 10
  • Position: #203 / 301
  • Number of attempts: 2
Make HTML List - 994 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 41
  • Position: #105 / 264
  • Number of attempts: 3
Todo list specification - 368 entries

The every item on the todo list must be done today. Modify the list to reflect that.

  • Best score: 37
  • Best player score: 37
  • Position: #94 / 169
  • Number of attempts: 3
Python Hello World! Reformatting - 910 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 44
  • Position: #241 / 355
  • Number of attempts: 1
Remember VimGolf Rules ! - 242 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 8
  • Position: #121 / 130
  • Number of attempts: 2
Missing Library and a Typo - 838 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

  • Best score: 15
  • Best player score: 22
  • Position: #175 / 206
  • Number of attempts: 2
Simple addition - 301 entries

The right side of the equation is already there. We just need the left one now.

  • Best score: 12
  • Best player score: 12
  • Position: #55 / 112
  • Number of attempts: 1
Adam's challenge - 922 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

  • Best score: 18
  • Best player score: 21
  • Position: #157 / 260
  • 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: 13
  • Position: #155 / 276
  • Number of attempts: 3
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: #146 / 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: 11
  • Position: #127 / 131
  • Number of attempts: 2
underscore_to_camelCase - 154 entries

Pointy haired boss decided we need to switch to camelCase. Let's get this over with.

  • Best score: 14
  • Best player score: 15
  • Position: #56 / 77
  • Number of attempts: 1
7th Birthday - 183 entries

We have a bunch of numbers written from 0 to 9 in the order present in the text input file. The task is to create 7 by replacing the numbers with dashes.

  • Best score: 19
  • Best player score: 23
  • Position: #43 / 71
  • Number of attempts: 1
citizen_hacks_2019_challenge4 - 77 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 5
  • Best player score: 5
  • Position: #44 / 54
  • Number of attempts: 1
Generate a list of numbers - 280 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #64 / 134
  • Number of attempts: 2
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: #346 / 647
  • Number of attempts: 1
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: 15
  • Position: #119 / 196
  • Number of attempts: 2
citizen_hacks_2019_challenge5 - 123 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #42 / 66
  • Number of attempts: 1
citizen_hacks_2019_challenge6 - 53 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 3
  • Best player score: 3
  • Position: #40 / 43
  • Number of attempts: 1
Delete to the end of the current line - 718 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #247 / 352
  • Number of attempts: 2
change parenthesis - 260 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #86 / 147
  • Number of attempts: 1
Label grid cells (6x6) - 34 entries

Label the cells of a grid with its coordinates. Rows are labelled top to bottom from A to F, and columns left to right from A to F. Each cell has a coordinate MN, where M is the row letter and N is the column letter.

  • Best score: 31
  • Best player score: 48
  • Position: #10 / 15
  • 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: 31
  • Position: #143 / 220
  • Number of attempts: 2
Collect List - 4203 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 16
  • Position: #864 / 1173
  • Number of attempts: 3
VimGolfNight - 510 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #282 / 335
  • Number of attempts: 1
camel riding - 757 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 17
  • Position: #190 / 271
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10560 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2482 / 3645
  • 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: 14
  • Position: #352 / 1055
  • Number of attempts: 3
Words in parens - 12775 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 13
  • Position: #9 / 3926
  • Number of attempts: 3
NATO phonetic alphabet - 490 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 20
  • Position: #57 / 185
  • Number of attempts: 3
A simple change - 429 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #126 / 184
  • Number of attempts: 1
The name of the game - 636 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #270 / 348
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1527 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 15
  • Position: #403 / 429
  • Number of attempts: 1
Stairs Indenting - 439 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #56 / 188
  • Number of attempts: 2
Let's play some Ivmgolf - 1036 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #132 / 425
  • Number of attempts: 3
citizen_hacks_2019_challenge1 - 43 entries

For the Citizen Hacks 2019 Vim competition

  • Best score: 5
  • Best player score: 5
  • Position: #30 / 37
  • 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: 28
  • Position: #50 / 110
  • Number of attempts: 2
Vertical Limit - 2386 entries

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

  • Best score: 21
  • Best player score: 28
  • Position: #581 / 723
  • Number of attempts: 2
Switch function arguments - 1996 entries

How to switch two arguments of a function.

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

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #251 / 393
  • Number of attempts: 2
Reverse and double space - 456 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #169 / 187
  • Number of attempts: 1
Remove semicolons after expressions - 580 entries

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

  • Best score: 6
  • Best player score: 6
  • Position: #127 / 245
  • Number of attempts: 1
switch variable - 4974 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #656 / 1715
  • Number of attempts: 6
The meaning - 526 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #305 / 340
  • Number of attempts: 2
Line Zipper - 448 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #191 / 208
  • Number of attempts: 2
A Simple One - 968 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #551 / 629
  • Number of attempts: 1
Ruby 1.9 compat - 598 entries

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

  • Best score: 14
  • Best player score: 15
  • Position: #114 / 227
  • Number of attempts: 1
Reverse Simple Deletion - 799 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #361 / 440
  • Number of attempts: 2
Increment, increment, increment.... - 600 entries

Vim likes macros

  • Best score: 10
  • Best player score: 10
  • Position: #53 / 382
  • Number of attempts: 1
Hatsuyume - 430 entries

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

  • Best score: 16
  • Best player score: 18
  • Position: #19 / 170
  • Number of attempts: 1
The Cake is a Lie - 1238 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #271 / 497
  • Number of attempts: 2
Context insensitive completion 0 - 479 entries

Buried in the lines you're not supposed to add is the line "Add this line!" Add that line to the top of the file.

  • Best score: 7
  • Best player score: 7
  • Position: #114 / 225
  • Number of attempts: 2
Context Insensitive completion 1 - 437 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #153 / 224
  • Number of attempts: 1
Make Fancy Header - 984 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 21
  • Position: #255 / 332
  • Number of attempts: 1
Reverse characters in a line - 666 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 12
  • Best player score: 24
  • Position: #210 / 241
  • Number of attempts: 1
Change the content of a string - 1393 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #284 / 531
  • 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: 20
  • Position: #2661 / 3447
  • Number of attempts: 2
Brandon
Twitter:

entered into 96 challenges

contributed 0 challenges