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 - 33483 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: #2665 / 7384
  • Number of attempts: 6
One number per line - 18673 entries

Just give me the numbers.

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

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #182 / 573
  • Number of attempts: 5
Applying same text modification in several lines - 2851 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #395 / 843
  • Number of attempts: 2
Add semicolons - 10831 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #930 / 3055
  • Number of attempts: 1
Bad Copy Syntax - 2009 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #75 / 518
  • Number of attempts: 5
remove lines containing the word "reader" - 3556 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #640 / 1151
  • Number of attempts: 3
Com(m)a Trouble - 3709 entries

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

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

Create a box around a line.

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

reformat html paragraph to table

  • Best score: 48
  • Best player score: 63
  • Position: #81 / 125
  • Number of attempts: 1
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1882 / 4174
  • Number of attempts: 6
Extended Customer 2 - 49 entries

Format the chars

  • Best score: 47
  • Best player score: 61
  • Position: #6 / 21
  • Number of attempts: 5
Vice versa - 7865 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #807 / 2114
  • Number of attempts: 2
One to Ten - 2174 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 / 664
  • Number of attempts: 3
Song Transcription Oops - 236 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 / 77
  • Number of attempts: 2
change parenthesis - 287 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #114 / 160
  • Number of attempts: 2
Reorder the groups - 1146 entries

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

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

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 26
  • Position: #55 / 71
  • Number of attempts: 3
Swap assigned value - 628 entries

Simple problem but looking for interesting solutions.

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

Happy New Year!

  • Best score: 18
  • Best player score: 21
  • Position: #26 / 86
  • Number of attempts: 6
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 11
  • Position: #1187 / 4166
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #747 / 3677
  • Number of attempts: 3
Sort the VimGolf challenges by popularity - 346 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: #40 / 106
  • Number of attempts: 3
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #1004 / 3950
  • Number of attempts: 4
It's a factor - 92 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: #26 / 37
  • Number of attempts: 2
Parsing with CSV: Unify lines and result. - 167 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: #30 / 75
  • Number of attempts: 3
Fibonacci Triangles - 50 entries

Triangles

  • Best score: 40
  • Best player score: 45
  • Position: #9 / 21
  • Number of attempts: 2
Word frequency alignment - 278 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 / 159
  • Number of attempts: 1
Minimalist Limerick - 519 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 39
  • Position: #124 / 173
  • Number of attempts: 3
Coordinates placeholder - 64 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Position: #27 / 37
  • Number of attempts: 1
REDRUM - 151 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 / 63
  • Number of attempts: 4
199 Fibonacci Numbers - 40 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: #14 / 18
  • Number of attempts: 3
Execute immediate SQL - 87 entries

Sql string tranformation ...

  • Best score: 58
  • Best player score: 72
  • Position: #16 / 31
  • Number of attempts: 5
Chinese Multiplication Table - 78 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: #19 / 25
  • Number of attempts: 7
Circle in a square - 141 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: #16 / 53
  • Number of attempts: 7
Groups magic - 157 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: #37 / 92
  • Number of attempts: 1
Prefixes and suffixes - 599 entries

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

  • Best score: 17
  • Best player score: 22
  • Position: #43 / 195
  • Number of attempts: 7
Refactor arguments into object argument - 162 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 58
  • Position: #19 / 66
  • Number of attempts: 10
lamb had a little Mary - 596 entries

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

  • Best score: 16
  • Best player score: 31
  • Position: #53 / 164
  • Number of attempts: 4
Stairs Indenting - 452 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #34 / 195
  • Number of attempts: 2
Saving the hashes(#) - 2008 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: #140 / 476
  • Number of attempts: 6
Exchanging Quotes - 824 entries

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

  • Best score: 30
  • Best player score: 32
  • Position: #62 / 227
  • Number of attempts: 3
Remove semicolons after expressions - 639 entries

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

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

how fast can you switch two variable ?

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

line up the operators. Use spaces, not tabs.

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

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

  • Best score: 16
  • Best player score: 27
  • Position: #435 / 757
  • Number of attempts: 2
Simple text editing with Vim - 12481 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1021 / 3624
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6749 entries

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

  • Best score: 31
  • Best player score: 39
  • Position: #692 / 1652
  • Number of attempts: 2
Joel Elkins
Twitter:

entered into 48 challenges

contributed 0 challenges