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 - 33988 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: 28
  • Position: #4240 / 7509
  • Number of attempts: 2
One number per line - 18896 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 16
  • Position: #848 / 3902
  • Number of attempts: 12
V to the i - 4864 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #443 / 1912
  • Number of attempts: 4
Split line with dots - 2174 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 26
  • Position: #549 / 638
  • Number of attempts: 1
Box it - 7999 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 24
  • Position: #852 / 1899
  • Number of attempts: 2
Every other line - 2945 entries

AaAaAaA

  • Best score: 12
  • Best player score: 15
  • Position: #331 / 710
  • Number of attempts: 4
Copy three lines - 2911 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #221 / 645
  • Number of attempts: 7
Extract argument from function - 2401 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #180 / 768
  • Number of attempts: 4
Search and Replace 0 - 5124 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1044 / 1670
  • Number of attempts: 2
That hyphen - 2624 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #469 / 708
  • Number of attempts: 4
Just the middle - 11613 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #824 / 4253
  • Number of attempts: 2
Make HTML List - 1071 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 41
  • Position: #109 / 275
  • Number of attempts: 1
Basic renumbering - 5731 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 24
  • Position: #1134 / 1277
  • Number of attempts: 2
Combines all items - 316 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #108 / 141
  • Number of attempts: 2
replace 2nd column blanks with values in same column if blank - 248 entries

Where ,SOMELOGB and ,SOMELOGC replaces each /r carriage return if 2nd column is blank. The replace only happens if 2nd column is blank though and should replace up to the non blank row.

  • Best score: 15
  • Best player score: 17
  • Position: #58 / 84
  • Number of attempts: 2
Wrap text in quotes - 374 entries

All the blocks of text should be wrapped in quotation marks.

  • Best score: 16
  • Best player score: 17
  • Position: #66 / 123
  • Number of attempts: 3
Pretty multi-line bash - 240 entries

Bash line continuations are much prettier when they're column aligned.

  • Best score: 15
  • Best player score: 31
  • Position: #71 / 78
  • Number of attempts: 1
Free hyphen! - 192 entries

Just like "Inner hyphens", but I'm giving you a free hyphen to play with. Will your solution be any different?

  • Best score: 9
  • Best player score: 9
  • Position: #13 / 95
  • Number of attempts: 3
Paragraph sort - 456 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

  • Best score: 14
  • Best player score: 18
  • Position: #92 / 126
  • Number of attempts: 2
Sorting a glossary - 134 entries

Sort a glossary. Glossary head contains a header phrase ending with ':' and glossary body has multi line text indented with a tab.

  • Best score: 6
  • Best player score: 6
  • Position: #52 / 83
  • Number of attempts: 1
Sort files from hosts - 202 entries

Resume files by host. I hope you enjoy with this challenge

  • Best score: 15
  • Best player score: 18
  • Position: #58 / 78
  • Number of attempts: 3
Order and join - 1030 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 11
  • Position: #107 / 264
  • Number of attempts: 2
Paragraph breaks - 534 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 13
  • Position: #130 / 170
  • Number of attempts: 2
comments galore - 1079 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 11
  • Position: #362 / 431
  • Number of attempts: 3
Change attribute to getter - 172 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 34
  • Position: #60 / 65
  • Number of attempts: 1
Scrambled numbers - 829 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 23
  • Position: #98 / 186
  • Number of attempts: 3
Align commas - 1105 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: 18
  • Position: #188 / 248
  • Number of attempts: 2
Generate a list of numbers - 302 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 17
  • Position: #130 / 142
  • Number of attempts: 1
Restore order to the alphabet - 209 entries

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 15
  • Position: #49 / 73
  • Number of attempts: 2
Mirror Symmetry - 830 entries

Add backslashes.

  • Best score: 7
  • Best player score: 7
  • Position: #70 / 270
  • Number of attempts: 5
From A to B - 605 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 19
  • Position: #115 / 161
  • Number of attempts: 3
camel riding - 798 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 16
  • Position: #134 / 283
  • Number of attempts: 3
Space out the alphabet - 1691 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 21
  • Position: #289 / 455
  • Number of attempts: 2
Fix the XML - 1050 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #42 / 291
  • Number of attempts: 4
Mute the second method of this script - 461 entries

prepend a # infront of every line of the second method

  • Best score: 8
  • Best player score: 9
  • Position: #120 / 243
  • Number of attempts: 2
Condensed Cases - 821 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: 14
  • Position: #146 / 252
  • Number of attempts: 2
I forgot quotes - 16187 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2198 / 4222
  • Number of attempts: 4
learn vim in short time - 246 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Position: #93 / 166
  • Number of attempts: 1
-a-b-c- - 3237 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #653 / 1145
  • Number of attempts: 4
Count both ways - 1037 entries

Right AND down.

  • Best score: 13
  • Best player score: 15
  • Position: #121 / 359
  • Number of attempts: 2
Gray area - 757 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Position: #100 / 274
  • Number of attempts: 4
Do you demand a shrubbery? - 1187 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 32
  • Position: #283 / 307
  • Number of attempts: 1
Don't know what this is - 2048 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: 13
  • Position: #268 / 592
  • Number of attempts: 4
Where should I put the Newline? - 898 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Position: #187 / 446
  • Number of attempts: 2
Shuffle puzzle - 361 entries

Sort the lines in each indent group, and sort the groups. That's the pattern. Or just move lines around manually to get a better score.

  • Best score: 13
  • Best player score: 15
  • Position: #70 / 106
  • Number of attempts: 3
attr_aligner - 3565 entries

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

  • Best score: 19
  • Best player score: 34
  • Position: #579 / 709
  • Number of attempts: 1
Letter case trickery - 1664 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: 10
  • Position: #155 / 523
  • Number of attempts: 4
quotes inside quotes - 3200 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: 17
  • Position: #902 / 1091
  • Number of attempts: 1
Words in parens - 13034 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1582 / 3988
  • Number of attempts: 2
Hole-in-one - 1040 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 18
  • Position: #148 / 307
  • Number of attempts: 4
Delete unwanted lines - 441 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #161 / 235
  • Number of attempts: 1
Block Fun 1 - 225 entries

Manipulate the columns to produce desired result.

  • Best score: 14
  • Best player score: 23
  • Position: #49 / 77
  • Number of attempts: 2
Prefixes and suffixes - 664 entries

Generate all prefixes of "vimchallenge", then all suffixes.

  • Best score: 17
  • Best player score: 23
  • Position: #64 / 206
  • Number of attempts: 1
Stairs Indenting - 483 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #53 / 200
  • Number of attempts: 2
Let's play some Ivmgolf - 1153 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #305 / 457
  • Number of attempts: 2
Vertical Limit - 2634 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #54 / 776
  • Number of attempts: 6
replacing each line of a block selection - 3050 entries

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

  • Best score: 18
  • Best player score: 22
  • Position: #438 / 787
  • Number of attempts: 3
Switch function arguments - 2204 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #300 / 681
  • Number of attempts: 3
Remove semicolons after expressions - 676 entries

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

  • Best score: 6
  • Best player score: 8
  • Position: #226 / 268
  • Number of attempts: 1
switch variable - 5120 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 13
  • Position: #1206 / 1761
  • Number of attempts: 2
The meaning - 581 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #263 / 366
  • Number of attempts: 1
Make it more readable - 2036 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #305 / 657
  • Number of attempts: 3
remove dupes from array - 1375 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: 20
  • Position: #139 / 340
  • Number of attempts: 5
Numbering a List - 1944 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 18
  • Position: #149 / 659
  • Number of attempts: 3
Shebangs for all - 2098 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: 14
  • Position: #243 / 531
  • Number of attempts: 4
Reverse characters in a line - 832 entries

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

  • Best score: 8
  • Best player score: 18
  • Position: #203 / 278
  • Number of attempts: 1
Simple text editing with Vim - 13576 entries

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

  • Best score: 13
  • Best player score: 19
  • Position: #2854 / 3892
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 7649 entries

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

  • Best score: 7
  • Best player score: 48
  • Position: #1410 / 1882
  • Number of attempts: 1
Yann
Twitter:

entered into 68 challenges

contributed 0 challenges