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 - 34031 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: #694 / 7520
  • Number of attempts: 7
One number per line - 18907 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #122 / 3907
  • Number of attempts: 7
Every other line - 2951 entries

AaAaAaA

  • Best score: 12
  • Best player score: 16
  • Position: #384 / 712
  • Number of attempts: 4
Search and Replace 0 - 5168 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #834 / 1678
  • Number of attempts: 3
Python Hello World! Reformatting - 1057 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: 41
  • Position: #69 / 402
  • Number of attempts: 3
Swap assigned value - 696 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #66 / 264
  • Number of attempts: 6
VimGolfNight - 604 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #169 / 357
  • Number of attempts: 1
I forgot quotes - 16255 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #115 / 4229
  • Number of attempts: 5
-a-b-c- - 3242 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #76 / 1147
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10757 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #266 / 3717
  • Number of attempts: 5
attr_aligner - 3568 entries

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

  • Best score: 19
  • Best player score: 33
  • Position: #528 / 711
  • Number of attempts: 2
Letter case trickery - 1688 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: 16
  • Position: #466 / 526
  • Number of attempts: 1
quotes inside quotes - 3209 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: #140 / 1096
  • Number of attempts: 4
Sort the VimGolf challenges by popularity - 378 entries

"Sort by popularity" is a good order to play the challenges. Not perfect, but you could do a lot worse. ;) Input is a sample copy-pasted from vimgolf.com. Some of the challenge names have digits that will get in your way, so read ":help :sort" for hints on sorting with a regex. When you're done, try your solution on the full list!

  • Best score: 15
  • Best player score: 16
  • Position: #54 / 113
  • Number of attempts: 3
Number an outline - 316 entries

The indent and words are right, but the numbers are all wrong.

  • Best score: 25
  • Best player score: 30
  • Position: #14 / 80
  • Number of attempts: 8
Words in parens - 13063 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1360 / 3995
  • Number of attempts: 6
Pairs of numbers - 388 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

  • Best score: 26
  • Best player score: 49
  • Position: #115 / 139
  • Number of attempts: 1
Hole-in-one - 1041 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: #137 / 308
  • Number of attempts: 2
Parsing with CSV: Unify lines and result. - 199 entries

col1;col2;col3;col4 A;1;4;5 A;3;4; A;1;4; # New output: col1;col2;col3;col4 A;1(2x);3;4(3x);5 any ideas?

  • Best score: 21
  • Best player score: 25
  • Position: #72 / 81
  • Number of attempts: 1
abcd > a b c d - 310 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #127 / 232
  • Number of attempts: 1
NATO phonetic alphabet - 555 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 19
  • Position: #19 / 202
  • Number of attempts: 3
A simple change - 486 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #105 / 200
  • Number of attempts: 3
The Quick Brown Fox Jumps Over The Lazy Vim - 464 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 8
  • Best player score: 11
  • Position: #142 / 201
  • Number of attempts: 1
The name of the game - 707 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #164 / 374
  • Number of attempts: 1
lamb had a little Mary - 660 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #11 / 180
  • Number of attempts: 10
Stairs Indenting - 503 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #49 / 203
  • Number of attempts: 3
Vertical Limit - 2641 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #235 / 780
  • Number of attempts: 6
replacing each line of a block selection - 3069 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #161 / 790
  • Number of attempts: 7
Switch function arguments - 2234 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #491 / 686
  • Number of attempts: 1
Append semicolon after expressions - 1088 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #213 / 427
  • Number of attempts: 2
Reverse and double space - 514 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 14
  • Position: #53 / 204
  • Number of attempts: 4
Remove noise from HTTP log - 760 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: #91 / 282
  • Number of attempts: 2
switch variable - 5132 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #286 / 1766
  • Number of attempts: 2
The meaning - 589 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #225 / 369
  • Number of attempts: 1
Make it more readable - 2041 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 13
  • Position: #53 / 659
  • Number of attempts: 7
remove dupes from array - 1379 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: #57 / 342
  • Number of attempts: 8
imports alignment (python) - 728 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 24
  • Position: #125 / 204
  • Number of attempts: 1
Overall Vimgolf Rank - 224 entries

Suppose you are trying to figure out what your overall rank is at Vimgolf(the sum of all the ranks you got), and as a Vim ninja you decided to use Vim to do the job. Your solution should work for every Vimgolf profile page(The actual input file for this challenge is my Vimgolf profile page). So, direct answer insertion is considered cheating.

  • Best score: 21
  • Best player score: 49
  • Position: #54 / 61
  • Number of attempts: 1
Numbering a List - 1970 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Position: #332 / 662
  • Number of attempts: 1
Ruby 1.9 hashes - 1315 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 12
  • Best player score: 12
  • Position: #64 / 421
  • Number of attempts: 2
Shebangs for all - 2105 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: #21 / 534
  • Number of attempts: 8
A Simple One - 1096 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: #376 / 683
  • Number of attempts: 2
Reverse Simple Deletion - 875 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #295 / 467
  • Number of attempts: 4
The Cake is a Lie - 1422 entries

Correct the capitalization of each word

  • Best score: 8
  • Best player score: 9
  • Position: #177 / 546
  • Number of attempts: 5
Change the content of a string - 1810 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #131 / 659
  • Number of attempts: 4
Sort and add attributes - 1604 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 33
  • Position: #177 / 621
  • Number of attempts: 2
Whitespace, empty lines and tabs - 4082 entries

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

  • Best score: 16
  • Best player score: 22
  • Position: #349 / 871
  • Number of attempts: 8
Simple text editing with Vim - 13681 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #264 / 3919
  • Number of attempts: 9
ZorgroZ
Twitter:

entered into 48 challenges

contributed 0 challenges