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 - 33354 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: 23
  • Position: #2658 / 7358
  • Number of attempts: 6
One number per line - 18615 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #539 / 3841
  • Number of attempts: 12
Swap values inside brackets - 2464 entries

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #180 / 569
  • Number of attempts: 5
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: 14
  • Position: #394 / 840
  • Number of attempts: 2
Add semicolons - 10785 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #926 / 3042
  • Number of attempts: 1
Bad Copy Syntax - 1999 entries

Copy should be from right to left, but sometimes you type it wrong.

  • Best score: 18
  • Best player score: 19
  • Position: #72 / 514
  • Number of attempts: 5
remove lines containing the word "reader" - 3528 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #633 / 1142
  • Number of attempts: 3
Com(m)a Trouble - 3654 entries

Someone was real stupid when placing his commas. Can you fix it?

  • Best score: 12
  • Best player score: 12
  • Position: #55 / 821
  • Number of attempts: 7
Box it - 7818 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Position: #155 / 1861
  • Number of attempts: 7
html paragraph to table - 590 entries

reformat html paragraph to table

  • Best score: 48
  • Best player score: 63
  • Position: #79 / 123
  • Number of attempts: 1
Just the middle - 11346 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1878 / 4160
  • Number of attempts: 6
Extended Customer 2 - 44 entries

Format the chars

  • Best score: 47
  • Best player score: 61
  • Position: #4 / 19
  • Number of attempts: 5
Vice versa - 7778 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #803 / 2095
  • Number of attempts: 2
One to Ten - 2159 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: #145 / 660
  • Number of attempts: 3
Song Transcription Oops - 234 entries

When transcribing vocal music to Canjo Tab you can start by finding the lowest note and assigning that to zero and working your way up from there. However, without fail, I tend to miscount the notes and when I am near done I find a lower note. I mark this with a "z". This means I have to increase all the previous ones by 1. just a sting of numbers :)

  • Best score: 15
  • Best player score: 15
  • Position: #11 / 75
  • Number of attempts: 2
change parenthesis - 278 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #111 / 156
  • Number of attempts: 2
Reorder the groups - 1137 entries

Change the order so that the groups of fruit come before the vegetables.

  • Best score: 14
  • Best player score: 14
  • Position: #33 / 259
  • Number of attempts: 11
Restore order to the alphabet - 188 entries

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 26
  • Position: #52 / 68
  • Number of attempts: 3
Swap assigned value - 614 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #34 / 247
  • Number of attempts: 2
Change your calendar - 352 entries

Happy New Year!

  • Best score: 18
  • Best player score: 21
  • Position: #25 / 83
  • Number of attempts: 6
I forgot quotes - 15923 entries

Oops.

  • Best score: 10
  • Best player score: 11
  • Position: #1185 / 4159
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10616 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #747 / 3663
  • Number of attempts: 3
Sort the VimGolf challenges by popularity - 345 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: #39 / 105
  • Number of attempts: 3
Words in parens - 12850 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #1003 / 3944
  • Number of attempts: 4
It's a factor - 91 entries

Flaunt your macro prowess by factoring some numbers. Too hard? It takes less than 30 strokes, I promise.

  • Best score: 24
  • Best player score: 92
  • Position: #25 / 36
  • Number of attempts: 2
Parsing with CSV: Unify lines and result. - 165 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: 22
  • Position: #29 / 73
  • Number of attempts: 3
Fibonacci Triangles - 49 entries

Triangles

  • Best score: 40
  • Best player score: 45
  • Position: #8 / 20
  • Number of attempts: 2
Word frequency alignment - 273 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

  • Best score: 5
  • Best player score: 5
  • Position: #48 / 156
  • Number of attempts: 1
Minimalist Limerick - 516 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 39
  • Position: #123 / 171
  • Number of attempts: 3
Coordinates placeholder - 62 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Position: #26 / 36
  • Number of attempts: 1
REDRUM - 149 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: #10 / 61
  • Number of attempts: 4
199 Fibonacci Numbers - 39 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: 69
  • Position: #13 / 17
  • Number of attempts: 3
Execute immediate SQL - 85 entries

Sql string tranformation ...

  • Best score: 60
  • Best player score: 72
  • Position: #15 / 30
  • Number of attempts: 5
Chinese Multiplication Table - 77 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: 117
  • Position: #18 / 24
  • Number of attempts: 7
Circle in a square - 140 entries

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

  • Best score: 23
  • Best player score: 26
  • Position: #15 / 52
  • Number of attempts: 7
Groups magic - 146 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: #35 / 88
  • Number of attempts: 1
Prefixes and suffixes - 591 entries

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

  • Best score: 17
  • Best player score: 22
  • Position: #42 / 192
  • Number of attempts: 7
Refactor arguments into object argument - 161 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 58
  • Position: #18 / 65
  • Number of attempts: 10
lamb had a little Mary - 582 entries

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

  • Best score: 16
  • Best player score: 31
  • Position: #52 / 161
  • Number of attempts: 4
Stairs Indenting - 446 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #34 / 193
  • Number of attempts: 2
Saving the hashes(#) - 1992 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: 25
  • Position: #139 / 473
  • Number of attempts: 6
Exchanging Quotes - 820 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 32
  • Position: #61 / 224
  • Number of attempts: 3
Remove semicolons after expressions - 628 entries

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

  • Best score: 6
  • Best player score: 6
  • Position: #52 / 258
  • Number of attempts: 1
switch variable - 5028 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #140 / 1734
  • Number of attempts: 2
Assignment Alignment - 829 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #29 / 215
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3290 entries

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

  • Best score: 16
  • Best player score: 27
  • Position: #415 / 729
  • Number of attempts: 2
Simple text editing with Vim - 12233 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1006 / 3567
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6512 entries

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

  • Best score: 32
  • Best player score: 39
  • Position: #677 / 1603
  • Number of attempts: 2
Joel Elkins
Twitter:

entered into 48 challenges

contributed 0 challenges