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

Simple, Practical, and Common - 33609 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: #1343 / 7415
  • Number of attempts: 9
Swap values - 4616 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Position: #231 / 1268
  • Number of attempts: 4
One number per line - 18712 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #420 / 3859
  • Number of attempts: 8
V to the i - 4799 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #559 / 1892
  • Number of attempts: 2
Split line with dots - 2144 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Position: #138 / 634
  • Number of attempts: 5
Wrap the text of an email message to 79 characters - 754 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #236 / 407
  • Number of attempts: 1
multiple cursor alternative - 1519 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: 19
  • Position: #53 / 380
  • Number of attempts: 6
From argument to object - 1505 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: 17
  • Position: #91 / 457
  • Number of attempts: 3
Every other line - 2910 entries

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #13 / 703
  • Number of attempts: 6
Copy three lines - 2872 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #92 / 640
  • Number of attempts: 6
Array propagate - 338 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 23
  • Position: #12 / 119
  • Number of attempts: 3
Extract argument from function - 2355 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #202 / 752
  • Number of attempts: 5
Start coding format - 155 entries

I used to start coding with following format: int main(){ -(cursor here) }

  • Best score: 22
  • Best player score: 23
  • Position: #36 / 72
  • Number of attempts: 2
Search and Replace 0 - 4978 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #516 / 1621
  • Number of attempts: 4
Number Sort - 314 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: #10 / 166
  • Number of attempts: 3
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Position: #178 / 701
  • Number of attempts: 4
comment and uncomment code inline - 1122 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: 9
  • Position: #94 / 322
  • Number of attempts: 3
Just the middle - 11446 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #1109 / 4194
  • Number of attempts: 6
Team names - 1836 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #147 / 588
  • Number of attempts: 3
Make HTML List - 1050 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 33
  • Position: #7 / 273
  • Number of attempts: 5
Learn some german verbs - 533 entries

The list needs to be structured so we can print in verbatim and feel ok about how it looks.

  • Best score: 21
  • Best player score: 21
  • Position: #30 / 133
  • Number of attempts: 3
Un"finnish"ed Work - 116 entries

Replace å by a, ä by a and ö by o.

  • Best score: 14
  • Best player score: 14
  • Position: #18 / 60
  • Number of attempts: 3
Todo list specification - 399 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: #63 / 179
  • Number of attempts: 2
Subnetting - 131 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 29
  • Position: #6 / 39
  • Number of attempts: 3
Python Hello World! Reformatting - 989 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: 39
  • Position: #3 / 379
  • Number of attempts: 4
Remember VimGolf Rules ! - 261 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 7
  • Position: #27 / 141
  • Number of attempts: 1
Stairstep digits - 394 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 9
  • Position: #36 / 145
  • Number of attempts: 2
Missing Library and a Typo - 887 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: 14
  • Best player score: 15
  • Position: #19 / 213
  • Number of attempts: 4
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 12
  • Position: #286 / 1264
  • Number of attempts: 10
Simple addition - 326 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: #40 / 122
  • Number of attempts: 2
Adam's challenge - 984 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: 18
  • Position: #64 / 270
  • Number of attempts: 3
Create a table - 332 entries

Convert the given input into a formatted table

  • Best score: 16
  • Best player score: 16
  • Position: #30 / 105
  • Number of attempts: 3
Fiddle percentages into real numbers - 865 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: #112 / 291
  • Number of attempts: 2
Add to end of each line... kinda - 333 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: 12
  • Position: #91 / 174
  • Number of attempts: 1
Vice versa - 7903 entries

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #362 / 2125
  • Number of attempts: 5
7th Birthday - 202 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: 19
  • Position: #18 / 75
  • Number of attempts: 4
C Reformatting - 690 entries

You may use Visual mode... or not. #uppercase

  • Best score: 30
  • Best player score: 30
  • Position: #15 / 163
  • Number of attempts: 6
Paragraph breaks - 522 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 10
  • Position: #34 / 167
  • Number of attempts: 3
comments galore - 1045 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #247 / 424
  • Number of attempts: 1
Mirrored text - 177 entries

backward and forward, and long enough to be challenging

  • Best score: 14
  • Best player score: 15
  • Position: #28 / 71
  • Number of attempts: 1
Angular naming conventions - 320 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: 18
  • Position: #40 / 118
  • Number of attempts: 4
Scrambled numbers - 807 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 18
  • Position: #35 / 184
  • Number of attempts: 4
Alsa configuration - 513 entries

I'm tweaking my ~/.asoundrc file!

  • Best score: 22
  • Best player score: 22
  • Position: #46 / 128
  • Number of attempts: 4
Align commas - 1092 entries

There are 15,000 aligning challenges on vimgolf.com, and they're all exactly the same. I hope this one is a little different.

  • Best score: 11
  • Best player score: 11
  • Position: #70 / 245
  • Number of attempts: 5
Hello ${world} - 324 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 24
  • Position: #23 / 96
  • Number of attempts: 3
Generate a list of numbers - 295 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #49 / 140
  • Number of attempts: 1
Separating firstname & lastname - 138 entries

Seperate named with equal tabs.

  • Best score: 19
  • Best player score: 19
  • Position: #5 / 57
  • Number of attempts: 5
Array transposition - 2416 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 17
  • Position: #116 / 447
  • Number of attempts: 7
Mirror Symmetry - 822 entries

Add backslashes.

  • Best score: 7
  • Best player score: 7
  • Position: #80 / 269
  • Number of attempts: 5
Swap assigned value - 643 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #91 / 253
  • Number of attempts: 1
From A to B - 591 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 16
  • Position: #46 / 159
  • Number of attempts: 4
Cartesian product - 255 entries

{1,2,3,4,5} X {1,2,3,4,5}

  • Best score: 24
  • Best player score: 24
  • Position: #5 / 95
  • Number of attempts: 3
Collect List - 4298 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #368 / 1190
  • Number of attempts: 2
camel riding - 793 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 15
  • Position: #63 / 281
  • Number of attempts: 3
readability - 327 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 18
  • Position: #74 / 152
  • Number of attempts: 2
Space out the alphabet - 1657 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 15
  • Position: #87 / 444
  • Number of attempts: 4
Fix the XML - 1039 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #51 / 290
  • Number of attempts: 6
Line 'em up! - 421 entries

It can be so hard to keep everything neatly lined-up. Somebody clearly hasn't bothered here. Tidy it up, please!

  • Best score: 17
  • Best player score: 17
  • Position: #33 / 114
  • Number of attempts: 5
Condensed Cases - 804 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 12
  • Position: #52 / 247
  • Number of attempts: 3
Simple Maths - 57 entries

Not much to say, discover by yourself!

  • Best score: 26
  • Best player score: 33
  • Position: #11 / 27
  • Number of attempts: 2
Happy TvvO - 426 entries

Don’t forget the past, learn from it. Happy New Year.

  • Best score: 12
  • Best player score: 12
  • Position: #132 / 205
  • Number of attempts: 2
range(10) digit rotation - 38 entries

This is a data generator challenge or some kind of gift..

  • Best score: 18
  • Best player score: 18
  • Position: #12 / 22
  • Number of attempts: 2
I forgot quotes - 15977 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #750 / 4177
  • Number of attempts: 5
-a-b-c- - 3213 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #233 / 1137
  • Number of attempts: 4
Count both ways - 1022 entries

Right AND down.

  • Best score: 13
  • Best player score: 13
  • Position: #47 / 354
  • Number of attempts: 4
Do you demand a shrubbery? - 1158 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 15
  • Position: #66 / 300
  • Number of attempts: 11
Don't know what this is - 2020 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

  • Best score: 11
  • Best player score: 11
  • Position: #96 / 584
  • Number of attempts: 5
Where should I put the Newline? - 881 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Position: #200 / 437
  • Number of attempts: 2
Piphilology - 144 entries

Piphilology comprises the creation and use of mnemonic techniques to remember a span of digits of the mathematical constant π. http://en.wikipedia.org/wiki/Piphilology

  • Best score: 28
  • Best player score: 29
  • Position: #7 / 52
  • Number of attempts: 4
Mess in revision history - 1183 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 17
  • Position: #52 / 249
  • Number of attempts: 7
A HAPPY NEW YEAR 2014 ! - 10658 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1266 / 3680
  • Number of attempts: 3
attr_aligner - 3511 entries

Two attr keywords. Two separate indentations. Align the colons.

  • Best score: 19
  • Best player score: 19
  • Position: #144 / 698
  • Number of attempts: 10
quotes inside quotes - 3159 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: #291 / 1078
  • Number of attempts: 4
Words in parens - 12929 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #881 / 3961
  • Number of attempts: 4
Delete unwanted lines - 411 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #168 / 229
  • Number of attempts: 2
Fibonacci Triangles - 59 entries

Triangles

  • Best score: 40
  • Best player score: 42
  • Position: #9 / 22
  • Number of attempts: 2
Minimalist Limerick - 520 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 31
  • Position: #28 / 174
  • Number of attempts: 3
REDRUM - 164 entries

If you remember "The Shinning", the first time you saw the bloody word REDRUM you probably thinked "What the Hell is that?" Well, then you know that you need a little help from a looking-glass to make sense of it. Now it's time to use vim like a mirror to reveal the message.

  • Best score: 14
  • Best player score: 14
  • Position: #18 / 64
  • Number of attempts: 2
199 Fibonacci Numbers - 41 entries

Generate 199 Fibonacci Numbers using, if you like, the function S(x,y), a vimscript to sum two big numbers in reverse order.

  • Best score: 51
  • Best player score: 74
  • Position: #16 / 18
  • Number of attempts: 1
Chinese Multiplication Table - 81 entries

Print a Chinese multiplication table in Vim. In China, every kid is asked to memorize this table. And thanks to the mono-syllabism of Chinese characters, it is not that hard. Printing the multiplication table is also a good exercise for programming beginners. For-loop, escaped characters, etc... There should be some special ways to print it in Vim.

  • Best score: 39
  • Best player score: 49
  • Position: #8 / 26
  • Number of attempts: 3
Circle in a square - 152 entries

Probably looks more like "Egg in a rectangle" in most fonts, but it's actually 23x23.

  • Best score: 23
  • Best player score: 23
  • Position: #11 / 54
  • Number of attempts: 5
Groups magic - 158 entries

Regexp or macros for string converting: (a) -> ___ (abc) -> ____ (abcd) -> ______ All in the '(' replace to _ multiply by char count + ()

  • Best score: 13
  • Best player score: 14
  • Position: #65 / 93
  • Number of attempts: 1
NATO phonetic alphabet - 526 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 19
  • Position: #37 / 195
  • Number of attempts: 5
Create a pandoc compatible table - 214 entries

In [this vimcast][1], a featured gist from Tim Pope shows how to quickly make a simple table structure. How fast can you convert it to pandoc's markdown style? [1]: http://vimcasts.org/episodes/aligning-text-with-tabular-vim/

  • Best score: 32
  • Best player score: 32
  • Position: #9 / 56
  • Number of attempts: 4
A simple change - 461 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #119 / 191
  • Number of attempts: 2
SFD-ROC: The Quick Brown Fox - 193 entries

Someone has vandalized our text (again). Please fix to read: The Quick Brown Fox Jumps Over The Lazy Dog.

  • Best score: 24
  • Best player score: 25
  • Position: #17 / 106
  • Number of attempts: 2
The name of the game - 665 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #236 / 360
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1606 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #96 / 446
  • Number of attempts: 3
Stairs Indenting - 473 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #54 / 197
  • Number of attempts: 2
Unwrap the text of an email message - 189 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 16
  • Position: #27 / 74
  • Number of attempts: 2
Saving the hashes(#) - 2063 entries

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

  • Best score: 20
  • Best player score: 20
  • Position: #55 / 480
  • Number of attempts: 8
Convert pandoc unordered list to a numbered list - 166 entries

I know it's possible to use #. in pandoc to auto-generate numbered lists, but then it's not easy to tell how many items there are when reading it in Markdown. How fast can you make the switch?

  • Best score: 20
  • Best player score: 22
  • Position: #11 / 57
  • Number of attempts: 1
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #116 / 445
  • Number of attempts: 2
Vertical Limit - 2538 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #71 / 754
  • Number of attempts: 5
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #104 / 777
  • Number of attempts: 4
Switch function arguments - 2130 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #152 / 661
  • Number of attempts: 5
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #505 / 1748
  • Number of attempts: 2
Ugly spreadsheet copy/paste to CSV - 1009 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #7 / 193
  • Number of attempts: 6
Make it more readable - 1995 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 13
  • Position: #89 / 649
  • Number of attempts: 7
remove dupes from array - 1354 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

  • Best score: 17
  • Best player score: 17
  • Position: #74 / 335
  • Number of attempts: 7
Complete the hex array data (Part II) - 166 entries

Do not use external tools(e.g. tac, seq) [My interpretation of Rule #7]

  • Best score: 20
  • Best player score: 21
  • Position: #5 / 69
  • Number of attempts: 1
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #31 / 652
  • Number of attempts: 1
Shebangs for all - 1998 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

  • Best score: 11
  • Best player score: 11
  • Position: #50 / 515
  • Number of attempts: 4
A Simple One - 1047 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: #473 / 662
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3614 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 16
  • Position: #14 / 780
  • Number of attempts: 10
Simple text editing with Vim - 12744 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #529 / 3681
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 6937 entries

A simple case of removing unneeded code and fixing broken indentation.

  • Best score: 28
  • Best player score: 35
  • Position: #386 / 1699
  • Number of attempts: 7
Daniël De Koker
Twitter:

entered into 107 challenges

contributed 0 challenges