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 - 32989 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: #2628 / 7283
  • Number of attempts: 6
One number per line - 18434 entries

Just give me the numbers.

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

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #179 / 563
  • Number of attempts: 5
Applying same text modification in several lines - 2765 entries

Remove identical text at the beginning of several lines and the closing parenthesis.

  • Best score: 12
  • Best player score: 14
  • Position: #382 / 819
  • Number of attempts: 2
Add semicolons - 10709 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #918 / 3014
  • Number of attempts: 1
Bad Copy Syntax - 1948 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #69 / 495
  • Number of attempts: 5
remove lines containing the word "reader" - 3475 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #626 / 1125
  • Number of attempts: 3
Com(m)a Trouble - 3441 entries

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

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

Create a box around a line.

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

reformat html paragraph to table

  • Best score: 48
  • Best player score: 63
  • Position: #77 / 121
  • Number of attempts: 1
Just the middle - 11263 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1872 / 4135
  • 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 - 7588 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #789 / 2055
  • Number of attempts: 2
One to Ten - 2113 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 / 645
  • Number of attempts: 3
Song Transcription Oops - 226 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 / 71
  • Number of attempts: 2
change parenthesis - 256 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #107 / 144
  • Number of attempts: 2
Reorder the groups - 1119 entries

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

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

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 26
  • Position: #50 / 65
  • Number of attempts: 3
Swap assigned value - 566 entries

Simple problem but looking for interesting solutions.

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

Happy New Year!

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

Oops.

  • Best score: 10
  • Best player score: 11
  • Position: #1177 / 4118
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10557 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #747 / 3643
  • Number of attempts: 3
Sort the VimGolf challenges by popularity - 340 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: #38 / 103
  • Number of attempts: 3
Words in parens - 12769 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #998 / 3925
  • 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. - 164 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: #28 / 72
  • 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 - 250 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 / 148
  • Number of attempts: 1
Minimalist Limerick - 507 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 39
  • Position: #122 / 168
  • Number of attempts: 3
Coordinates placeholder - 61 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Position: #26 / 35
  • Number of attempts: 1
REDRUM - 147 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 / 60
  • Number of attempts: 4
199 Fibonacci Numbers - 37 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: #12 / 16
  • Number of attempts: 3
Execute immediate SQL - 84 entries

Sql string tranformation ...

  • Best score: 60
  • Best player score: 72
  • Position: #15 / 29
  • 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 - 125 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 / 48
  • Number of attempts: 7
Groups magic - 144 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 / 86
  • Number of attempts: 1
Prefixes and suffixes - 571 entries

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

  • Best score: 17
  • Best player score: 22
  • Position: #40 / 186
  • Number of attempts: 7
Refactor arguments into object argument - 160 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 58
  • Position: #17 / 64
  • Number of attempts: 10
lamb had a little Mary - 569 entries

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

  • Best score: 16
  • Best player score: 31
  • Position: #51 / 159
  • Number of attempts: 4
Stairs Indenting - 434 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #33 / 186
  • Number of attempts: 2
Saving the hashes(#) - 1973 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 / 468
  • Number of attempts: 6
Exchanging Quotes - 800 entries

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

  • Best score: 30
  • Best player score: 32
  • Position: #59 / 220
  • Number of attempts: 3
Remove semicolons after expressions - 576 entries

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

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

how fast can you switch two variable ?

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

line up the operators. Use spaces, not tabs.

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

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

  • Best score: 16
  • Best player score: 27
  • Position: #381 / 673
  • Number of attempts: 2
Simple text editing with Vim - 11708 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #982 / 3431
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6075 entries

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

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

entered into 48 challenges

contributed 0 challenges