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

Find fix point of cos - 1013 entries

Write a function to find the fix point of cos. It is not a good code; It is just to use vim. Inspired by the excellent https://mvanier.livejournal.com/2897.html about the Y combinator.

  • Best score: 14
  • Best player score: 17
  • Position: #203 / 295
  • Number of attempts: 1
Filter number combinations that don't add to 11 - 346 entries

Append the sum of each line to its end, alongside an equals sign, and remove any that do not sum to 11. The ordering of lines should stay the same. Note that the combinations are semi-arbitrary and not all 4-number combinations are present in the file.

  • Best score: 27
  • Best player score: 29
  • Position: #76 / 103
  • Number of attempts: 2
Reformat symbols in list - 1393 entries

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

  • Best score: 24
  • Best player score: 27
  • Position: #110 / 309
  • Number of attempts: 2
delete swap - 1443 entries

delete all swap

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

Fix the shell script with the fewest keystrokes!

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

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

  • Best score: 10
  • Best player score: 13
  • Position: #345 / 515
  • Number of attempts: 1
Wikitext headings to markdown - 939 entries

Convert the wikitext headings to markdown.

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

Simple number generation

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

Speak in tongues

  • Best score: 17
  • Best player score: 20
  • Position: #176 / 247
  • Number of attempts: 2
Fill in the chess board - 886 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: #58 / 173
  • Number of attempts: 1
simple replacements - 1498 entries

The goal is to see the replacement commands in action.

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

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

  • Best score: 10
  • Best player score: 13
  • Position: #318 / 480
  • Number of attempts: 2
Python dataclasses - 963 entries

Simple challenge to extract fields from a Python class

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

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #103 / 190
  • Number of attempts: 1
HS Final exam vimgolf - 852 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: #104 / 224
  • Number of attempts: 1
Python: Def to Lambda - 421 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 22
  • Position: #113 / 148
  • Number of attempts: 2
Rural Post - 4342 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #446 / 1062
  • Number of attempts: 3
Satisfy the go linter - 2144 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: #320 / 432
  • Number of attempts: 1
xrandr outputs and dashes - 652 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 / 213
  • Number of attempts: 3
Yo To Hello - 1104 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #370 / 510
  • Number of attempts: 3
Simple, Practical, and Common - 33342 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 / 7355
  • Number of attempts: 3
Hogwarts Email Sorting - 875 entries

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

  • Best score: 20
  • Best player score: 22
  • Position: #168 / 253
  • Number of attempts: 1
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: 16
  • Position: #121 / 196
  • Number of attempts: 1
Swap values - 4534 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 15
  • Position: #967 / 1254
  • Number of attempts: 1
prepend * to every non-blank line - 6191 entries

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

  • Best score: 10
  • Best player score: 14
  • Position: #891 / 1512
  • Number of attempts: 1
citizen_hacks_2019_part1 - 36 entries

For the Citizen Hacks 2019 Vim competition

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

For the Citizen Hacks 2019 Vim competition.

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

Easy challenge.

  • Best score: 14
  • Best player score: 17
  • Position: #311 / 569
  • Number of attempts: 4
Unsemantic linewrapping - 888 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: #202 / 223
  • 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: 13
  • Position: #263 / 840
  • Number of attempts: 5
Add string initializers to an enum - 856 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 27
  • Position: #193 / 253
  • Number of attempts: 1
Swap the operands under comparison - 270 entries

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

  • Best score: 19
  • Best player score: 23
  • Position: #57 / 98
  • Number of attempts: 1
Add semicolons - 10780 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1754 / 3041
  • Number of attempts: 2
remove lines containing the word "reader" - 3528 entries

easy stuff

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

For the Citizen Hacks 2019 Vim competition.

  • Best score: 4
  • Best player score: 4
  • Position: #26 / 32
  • Number of attempts: 1
multiple cursor alternative - 1474 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: #236 / 376
  • Number of attempts: 1
From argument to object - 1469 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: #341 / 449
  • Number of attempts: 1
Copy three lines - 2836 entries

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

  • Best score: 13
  • Best player score: 20
  • Position: #421 / 633
  • 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: 27
  • Position: #61 / 115
  • Number of attempts: 1
Search and Replace 0 - 4785 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #702 / 1584
  • Number of attempts: 1
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: #130 / 162
  • Number of attempts: 2
comment and uncomment code inline - 1060 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: #209 / 312
  • Number of attempts: 2
Make HTML List - 1039 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 41
  • Position: #108 / 271
  • Number of attempts: 3
Todo list specification - 385 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 / 176
  • Number of attempts: 3
Python Hello World! Reformatting - 933 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 / 362
  • Number of attempts: 1
Remember VimGolf Rules ! - 257 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 8
  • Position: #123 / 138
  • Number of attempts: 2
Missing Library and a Typo - 846 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: #177 / 208
  • Number of attempts: 2
Simple addition - 307 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 / 116
  • Number of attempts: 1
Adam's challenge - 950 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: #162 / 265
  • 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: 13
  • Position: #155 / 287
  • Number of attempts: 3
Add to end of each line... kinda - 321 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: #150 / 168
  • 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: 11
  • Position: #133 / 137
  • Number of attempts: 2
underscore_to_camelCase - 162 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 / 80
  • Number of attempts: 1
7th Birthday - 186 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 / 73
  • Number of attempts: 1
citizen_hacks_2019_challenge4 - 88 entries

For the Citizen Hacks 2019 Vim competition.

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

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #64 / 136
  • Number of attempts: 2
One to Ten - 2156 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 / 659
  • Number of attempts: 1
Change part of a function name in multiple occurrences - 637 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: #122 / 202
  • Number of attempts: 2
citizen_hacks_2019_challenge5 - 137 entries

For the Citizen Hacks 2019 Vim competition.

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

For the Citizen Hacks 2019 Vim competition.

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

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #86 / 156
  • Number of attempts: 1
Label grid cells (6x6) - 45 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: #12 / 17
  • 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: 31
  • Position: #144 / 223
  • Number of attempts: 2
Collect List - 4260 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 16
  • Position: #872 / 1184
  • Number of attempts: 3
VimGolfNight - 531 entries

Based on "The name of the game".

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

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 17
  • Position: #193 / 274
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10614 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2494 / 3661
  • Number of attempts: 1
quotes inside quotes - 3121 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 / 1070
  • Number of attempts: 3
Words in parens - 12848 entries

We should all ace this, right?

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

Transform the series of words into a list.

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

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

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

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #270 / 354
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1569 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: #409 / 437
  • Number of attempts: 1
Stairs Indenting - 442 entries

Indent each line with <line number> whitespaces.

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

Oops, I spelled that wrong.

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

For the Citizen Hacks 2019 Vim competition

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

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

  • Best score: 21
  • Best player score: 28
  • Position: #589 / 733
  • Number of attempts: 2
Switch function arguments - 2050 entries

How to switch two arguments of a function.

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

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #255 / 400
  • Number of attempts: 2
Reverse and double space - 482 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #173 / 192
  • Number of attempts: 1
Remove semicolons after expressions - 626 entries

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

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

how fast can you switch two variable ?

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

Numbers are fun!

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

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #191 / 210
  • Number of attempts: 2
A Simple One - 995 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 / 640
  • Number of attempts: 1
Ruby 1.9 compat - 609 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 - 829 entries

You did the simple deletion, now reverse it.

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

Vim likes macros

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

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

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

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #271 / 511
  • Number of attempts: 2
Context insensitive completion 0 - 502 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 / 231
  • Number of attempts: 2
Context Insensitive completion 1 - 454 entries

Finish writing this simple Python HTTP server.

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

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 21
  • Position: #257 / 337
  • Number of attempts: 1
Reverse characters in a line - 709 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: #217 / 249
  • Number of attempts: 1
Change the content of a string - 1453 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #295 / 550
  • Number of attempts: 1
Simple text editing with Vim - 12203 entries

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

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

entered into 98 challenges

contributed 0 challenges