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 - 33385 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: #416 / 7364
  • Number of attempts: 7
One number per line - 18616 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #13 / 3842
  • Number of attempts: 3
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #285 / 1879
  • Number of attempts: 2
Every other line - 2886 entries

AaAaAaA

  • Best score: 12
  • Best player score: 20
  • Position: #606 / 700
  • Number of attempts: 2
Search and Replace 0 - 4792 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #413 / 1585
  • Number of attempts: 6
Just the middle - 11360 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #445 / 4164
  • Number of attempts: 3
Adam's challenge - 957 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: #14 / 266
  • Number of attempts: 3
JS notation to Immutable.js notation - 161 entries

Now Immutable.js made its way into many frontends. This challenge consists of a typical refactoring that many of us are facing now.

  • Best score: 34
  • Best player score: 46
  • Position: #49 / 60
  • 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: 12
  • Position: #55 / 171
  • Number of attempts: 3
Vice versa - 7805 entries

Little role switching.

  • Best score: 12
  • Best player score: 14
  • Position: #873 / 2101
  • Number of attempts: 4
comments galore - 998 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #45 / 418
  • Number of attempts: 2
Mirrored text - 163 entries

backward and forward, and long enough to be challenging

  • Best score: 14
  • Best player score: 14
  • Position: #18 / 69
  • Number of attempts: 5
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: #57 / 115
  • Number of attempts: 4
O Christmas Tree - 108 entries

Design a macro that makes trees grow (or ASCII triangles, if that's too hard).

  • Best score: 22
  • Best player score: 25
  • Position: #7 / 42
  • Number of attempts: 6
From A to B - 564 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 17
  • Position: #66 / 155
  • Number of attempts: 5
Collect List - 4264 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 15
  • Position: #695 / 1186
  • Number of attempts: 3
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #134 / 343
  • Number of attempts: 2
camel riding - 769 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 15
  • Position: #42 / 274
  • Number of attempts: 5
readability - 312 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 19
  • Position: #118 / 148
  • Number of attempts: 1
Fill visual area - 82 entries

Just have fun!

  • Best score: 20
  • Best player score: 20
  • Position: #5 / 36
  • Number of attempts: 5
I forgot quotes - 15931 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #274 / 4161
  • Number of attempts: 4
-a-b-c- - 3176 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #124 / 1129
  • Number of attempts: 5
Count both ways - 1001 entries

Right AND down.

  • Best score: 13
  • Best player score: 17
  • Position: #305 / 351
  • Number of attempts: 2
Do you demand a shrubbery? - 1120 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 15
  • Position: #39 / 293
  • Number of attempts: 10
Vim tetris - 352 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 23
  • Position: #34 / 101
  • Number of attempts: 3
Split the words - 356 entries

Add the spaces manually if you must, but if you use Vim's spell checking feature wisely, I think you'll save a LARGE number of strokes.

  • Best score: 18
  • Best player score: 36
  • Position: #53 / 108
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #815 / 3666
  • Number of attempts: 3
attr_aligner - 3444 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #454 / 692
  • Number of attempts: 2
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: 12
  • Position: #305 / 511
  • Number of attempts: 2
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: 14
  • Position: #209 / 1072
  • Number of attempts: 5
Assign list - 169 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 49
  • Position: #37 / 59
  • Number of attempts: 1
Minimalist Limerick - 516 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 34
  • Position: #65 / 171
  • Number of attempts: 1
abcd > a b c d - 280 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #117 / 218
  • Number of attempts: 2
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #152 / 356
  • Number of attempts: 4
lamb had a little Mary - 586 entries

"Mary" and "lamb" are swapped. Unswap them. Fast as you can.

  • Best score: 16
  • Best player score: 32
  • Position: #62 / 163
  • Number of attempts: 6
Stairs Indenting - 448 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 12
  • Position: #9 / 193
  • Number of attempts: 3
Vertical Limit - 2440 entries

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

  • Best score: 21
  • Best player score: 22
  • Position: #151 / 737
  • Number of attempts: 6
replacing each line of a block selection - 2947 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #256 / 768
  • Number of attempts: 7
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: 15
  • Position: #85 / 270
  • Number of attempts: 4
un-C-escape string - 56 entries

Convert escape sequences to characters

  • Best score: 12
  • Best player score: 12
  • Position: #38 / 50
  • Number of attempts: 1
switch variable - 5036 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #874 / 1736
  • Number of attempts: 4
Shebangs for all - 1912 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: 16
  • Position: #307 / 500
  • Number of attempts: 2
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: 24
  • Position: #73 / 172
  • Number of attempts: 6
The Cake is a Lie - 1286 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #163 / 512
  • Number of attempts: 2
Simple text editing with Vim - 12290 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1154 / 3581
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6560 entries

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

  • Best score: 32
  • Best player score: 42
  • Position: #927 / 1616
  • Number of attempts: 2
Domingue Justin
Twitter:

entered into 46 challenges

contributed 0 challenges