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 - 1037 entries

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

  • Best score: 24
  • Best player score: 27
  • Position: #81 / 236
  • Number of attempts: 2
delete swap - 1098 entries

delete all swap

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

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 33
  • Position: #210 / 420
  • Number of attempts: 1
Put a newline after every 10 lines in vim - 1356 entries

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

  • Best score: 10
  • Best player score: 13
  • Position: #312 / 460
  • Number of attempts: 1
Wikitext headings to markdown - 781 entries

Convert the wikitext headings to markdown.

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

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 20
  • Position: #164 / 231
  • Number of attempts: 2
Fill in the chess board - 738 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: #49 / 156
  • Number of attempts: 1
simple replacements - 1264 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 19
  • Position: #64 / 283
  • Number of attempts: 5
Inverting Lines - 1565 entries

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

  • Best score: 10
  • Best player score: 13
  • Position: #278 / 424
  • Number of attempts: 2
Python dataclasses - 798 entries

Simple challenge to extract fields from a Python class

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

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #103 / 157
  • Number of attempts: 1
HS Final exam vimgolf - 815 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: #99 / 215
  • Number of attempts: 1
Python: Def to Lambda - 410 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 22
  • Position: #110 / 142
  • Number of attempts: 2
Rural Post - 4257 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #439 / 1045
  • Number of attempts: 3
Satisfy the go linter - 2076 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: #311 / 422
  • Number of attempts: 1
xrandr outputs and dashes - 624 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 / 205
  • Number of attempts: 3
Yo To Hello - 1082 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #370 / 498
  • Number of attempts: 3
Simple, Practical, and Common - 33142 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: #2362 / 7309
  • Number of attempts: 3
Hogwarts Email Sorting - 850 entries

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

  • Best score: 20
  • Best player score: 22
  • Position: #163 / 247
  • Number of attempts: 1
Get mail address from outlook format - 604 entries

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

  • Best score: 15
  • Best player score: 16
  • Position: #118 / 190
  • Number of attempts: 1
Swap values - 4500 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 15
  • Position: #961 / 1247
  • Number of attempts: 1
prepend * to every non-blank line - 6120 entries

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

  • Best score: 10
  • Best player score: 14
  • Position: #877 / 1493
  • 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 - 185 entries

For the Citizen Hacks 2019 Vim competition.

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

Easy challenge.

  • Best score: 14
  • Best player score: 17
  • Position: #308 / 565
  • Number of attempts: 4
Unsemantic linewrapping - 861 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: #198 / 218
  • Number of attempts: 1
Applying same text modification in several lines - 2793 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #259 / 827
  • Number of attempts: 5
Add string initializers to an enum - 836 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 27
  • Position: #188 / 246
  • Number of attempts: 1
Swap the operands under comparison - 266 entries

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

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

Simply add a semicolon at the end of each line

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

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #486 / 1128
  • Number of attempts: 4
citizen_hacks_2019_challenge3 - 32 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 4
  • Best player score: 4
  • Position: #26 / 29
  • Number of attempts: 1
multiple cursor alternative - 1453 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 / 372
  • Number of attempts: 1
From argument to object - 1441 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: #334 / 441
  • Number of attempts: 1
Copy three lines - 2824 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 / 630
  • 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 - 4753 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #702 / 1575
  • Number of attempts: 1
Number Sort - 299 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 / 159
  • Number of attempts: 2
comment and uncomment code inline - 1037 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: #205 / 305
  • Number of attempts: 2
Make HTML List - 997 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 41
  • Position: #105 / 265
  • Number of attempts: 3
Todo list specification - 373 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 / 170
  • Number of attempts: 3
Python Hello World! Reformatting - 930 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: #245 / 361
  • Number of attempts: 1
Remember VimGolf Rules ! - 247 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 8
  • Position: #122 / 132
  • 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 - 928 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: #158 / 261
  • Number of attempts: 1
Fiddle percentages into real numbers - 825 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 / 281
  • Number of attempts: 3
Add to end of each line... kinda - 314 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 / 165
  • Number of attempts: 1
Combines all items - 292 entries

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

  • Best score: 9
  • Best player score: 11
  • Position: #128 / 132
  • Number of attempts: 2
underscore_to_camelCase - 155 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 / 78
  • Number of attempts: 1
7th Birthday - 185 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 / 72
  • Number of attempts: 1
citizen_hacks_2019_challenge4 - 83 entries

For the Citizen Hacks 2019 Vim competition.

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

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #64 / 135
  • Number of attempts: 2
One to Ten - 2123 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 / 650
  • Number of attempts: 1
Change part of a function name in multiple occurrences - 612 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 / 197
  • Number of attempts: 2
citizen_hacks_2019_challenge5 - 129 entries

For the Citizen Hacks 2019 Vim competition.

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

For the Citizen Hacks 2019 Vim competition.

  • Best score: 3
  • Best player score: 3
  • Position: #40 / 44
  • Number of attempts: 1
Delete to the end of the current line - 723 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 / 355
  • Number of attempts: 2
change parenthesis - 267 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #86 / 151
  • 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 - 826 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 / 222
  • Number of attempts: 2
Collect List - 4212 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 16
  • Position: #865 / 1176
  • Number of attempts: 3
VimGolfNight - 520 entries

Based on "The name of the game".

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

add a prefix on some camelCase variables

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

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2483 / 3647
  • Number of attempts: 1
quotes inside quotes - 3089 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 / 1061
  • Number of attempts: 3
Words in parens - 12790 entries

We should all ace this, right?

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

Transform the series of words into a list.

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

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

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

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #270 / 350
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1534 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: #405 / 432
  • Number of attempts: 1
Stairs Indenting - 440 entries

Indent each line with <line number> whitespaces.

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

Oops, I spelled that wrong.

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

For the Citizen Hacks 2019 Vim competition

  • Best score: 5
  • Best player score: 5
  • Position: #30 / 39
  • 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 - 2389 entries

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

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

How to switch two arguments of a function.

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

Some lines need the semicolon, some don't.

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

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #171 / 190
  • Number of attempts: 1
Remove semicolons after expressions - 584 entries

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

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

how fast can you switch two variable ?

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

Numbers are fun!

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

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #191 / 209
  • Number of attempts: 2
A Simple One - 973 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 / 633
  • Number of attempts: 1
Ruby 1.9 compat - 608 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: #116 / 229
  • Number of attempts: 1
Reverse Simple Deletion - 822 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #364 / 449
  • Number of attempts: 2
Increment, increment, increment.... - 617 entries

Vim likes macros

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

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

  • Best score: 16
  • Best player score: 18
  • Position: #21 / 173
  • Number of attempts: 1
The Cake is a Lie - 1260 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #271 / 505
  • Number of attempts: 2
Context insensitive completion 0 - 486 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: 6
  • Best player score: 7
  • Position: #115 / 228
  • Number of attempts: 2
Context Insensitive completion 1 - 444 entries

Finish writing this simple Python HTTP server.

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

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 21
  • Position: #257 / 335
  • Number of attempts: 1
Reverse characters in a line - 696 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: #215 / 246
  • Number of attempts: 1
Change the content of a string - 1416 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #288 / 540
  • Number of attempts: 1
Simple text editing with Vim - 11906 entries

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

  • Best score: 13
  • Best player score: 20
  • Position: #2684 / 3484
  • Number of attempts: 2
Brandon
Twitter:

entered into 96 challenges

contributed 0 challenges