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

It's a factor - 75 entries

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

  • Best score: 25
  • Best player score: 92
  • Number of attempts: 2
Applying same text modification in several lines - 1989 entries

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

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 2
Simple text editing with Vim - 10672 entries

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

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 3
Com(m)a Trouble - 2090 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 7
Reorder the groups - 689 entries

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

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 11
Groups magic - 136 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
  • Number of attempts: 1
Vice versa - 6242 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Number of attempts: 2
Words in parens - 11370 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 4
One to Ten - 1278 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
  • Number of attempts: 3
remove lines containing the word "reader" - 2174 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Number of attempts: 3
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
  • Number of attempts: 7
REDRUM - 136 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
  • Number of attempts: 4
Refactor arguments into object argument - 157 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 58
  • Number of attempts: 10
Swap assigned value - 499 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 2
Just the middle - 9665 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 6
One number per line - 14139 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 12
Word frequency alignment - 198 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
  • Number of attempts: 1
Stairs Indenting - 360 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Number of attempts: 2
Song Transcription Oops - 159 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
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 9717 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 3
Change your calendar - 263 entries

Happy New Year!

  • Best score: 18
  • Best player score: 21
  • Number of attempts: 6
switch variable - 4443 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 2
Restore order to the alphabet - 153 entries

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 26
  • Number of attempts: 3
change parenthesis - 186 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Number of attempts: 2
Remove semicolons after expressions - 463 entries

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

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 1
Swap values inside brackets - 1750 entries

Easy challenge.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 5
Sort the VimGolf challenges by popularity - 268 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
  • Number of attempts: 3
Assignment Alignment - 703 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 2
Simple, Practical, and Common - 26788 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
  • Number of attempts: 6
Bad Copy Syntax - 1016 entries

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

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 5
Box it - 4229 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Number of attempts: 7
Add semicolons - 4293 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 162 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
  • Number of attempts: 3
Saving the hashes(#) - 1806 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
  • Number of attempts: 6
Coordinates placeholder - 52 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Number of attempts: 1
Whitespace, empty lines and tabs - 2599 entries

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

  • Best score: 16
  • Best player score: 27
  • Number of attempts: 2
lamb had a little Mary - 499 entries

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

  • Best score: 16
  • Best player score: 31
  • Number of attempts: 4
Exchanging Quotes - 761 entries

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

  • Best score: 30
  • Best player score: 32
  • Number of attempts: 3
Chinese Multiplication Table - 50 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
  • Number of attempts: 7
Reformat/Refactor a Golfer Class - 5569 entries

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

  • Best score: 32
  • Best player score: 39
  • Number of attempts: 2
I forgot quotes - 12707 entries

Oops.

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 5
Minimalist Limerick - 481 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 39
  • Number of attempts: 3
Fibonacci Triangles - 41 entries

Triangles

  • Best score: 40
  • Best player score: 45
  • Number of attempts: 2
Extended Customer 2 - 44 entries

Format the chars

  • Best score: 47
  • Best player score: 61
  • Number of attempts: 5
Prefixes and suffixes - 506 entries

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

  • Best score: 17
  • Best player score: 22
  • Number of attempts: 7
html paragraph to table - 451 entries

reformat html paragraph to table

  • Best score: 7
  • Best player score: 63
  • Number of attempts: 1
199 Fibonacci Numbers - 35 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
  • Number of attempts: 3
Execute immediate SQL - 77 entries

Sql string tranformation ...

  • Best score: 60
  • Best player score: 72
  • Number of attempts: 5
Joel Elkins
Twitter:

entered into 48 challenges

contributed 0 challenges