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

Rural Post - 4352 entries

Simple challenge to remove all but the post code on each line

  • Best score: 9
  • Best player score: 17
  • Position: #766 / 1066
  • Number of attempts: 2
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: 22
  • Position: #1420 / 7358
  • Number of attempts: 9
prepend * to every non-blank line - 6202 entries

Prepend an asterisk to every non-blank line in the input file.

  • Best score: 10
  • Best player score: 15
  • Position: #954 / 1514
  • Number of attempts: 4
One number per line - 18615 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 19
  • Position: #1808 / 3841
  • Number of attempts: 4
Wget failed to download redirections - 184 entries

Output of a wget session, where 302 where not properly handled due to certificate problems, has been saved to a file. Keep the correct URLs to start again downloading.

  • Best score: 15
  • Best player score: 20
  • Position: #36 / 63
  • Number of attempts: 5
Swap values inside brackets - 2464 entries

Easy challenge.

  • Best score: 14
  • Best player score: 18
  • Position: #313 / 569
  • Number of attempts: 6
V to the i - 4743 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 8
  • Position: #963 / 1878
  • Number of attempts: 1
Swap the operands under comparison - 270 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

  • Best score: 19
  • Best player score: 26
  • Position: #73 / 98
  • Number of attempts: 1
Add semicolons - 10785 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 15
  • Position: #2303 / 3042
  • Number of attempts: 2
Wrap the text of an email message to 79 characters - 676 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #184 / 384
  • Number of attempts: 1
Extract argument from function - 2308 entries

The aim is to see if you can do some refactoring very fast.

  • Best score: 13
  • Best player score: 22
  • Position: #712 / 742
  • Number of attempts: 1
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #757 / 1585
  • Number of attempts: 5
Preferably without multi-cursor plugin - 538 entries

Originally asked as question on reddit by kpthunder: https://www.reddit.com/r/vim/comments/9fvsro/what_is_the_most_efficient_way_to_go_about/

  • Best score: 30
  • Best player score: 39
  • Position: #97 / 127
  • Number of attempts: 3
Number Sort - 303 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

  • Best score: 9
  • Best player score: 9
  • Position: #21 / 162
  • 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: #1600 / 4160
  • Number of attempts: 10
Team names - 1805 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 18
  • Position: #370 / 581
  • Number of attempts: 5
Python Hello World! Reformatting - 936 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: 42
  • Position: #111 / 363
  • Number of attempts: 9
Vice versa - 7778 entries

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Position: #1341 / 2095
  • Number of attempts: 3
Reorder the groups - 1137 entries

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

  • Best score: 14
  • Best player score: 23
  • Position: #196 / 259
  • Number of attempts: 2
readability - 312 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 18
  • Position: #20 / 148
  • Number of attempts: 2
Happy TvvO - 403 entries

Don’t forget the past, learn from it. Happy New Year.

  • Best score: 12
  • Best player score: 12
  • Position: #41 / 200
  • Number of attempts: 1
I forgot quotes - 15923 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1479 / 4159
  • Number of attempts: 5
learn vim in short time - 229 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Position: #58 / 157
  • Number of attempts: 2
-a-b-c- - 3170 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #516 / 1127
  • Number of attempts: 1
Gray area - 724 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 14
  • Position: #208 / 267
  • Number of attempts: 1
Refactor static member invocation - 198 entries

Someone used a static method. Refactor the method into a static import while fixing the assertion.

  • Best score: 28
  • Best player score: 50
  • Position: #59 / 63
  • Number of attempts: 2
Do you demand a shrubbery? - 1120 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 28
  • Position: #194 / 293
  • Number of attempts: 3
Split the words - 356 entries

Add the spaces manually if you must, but if you use Vim's spell checking feature wisely, I think you'll save a LARGE number of strokes.

  • Best score: 18
  • Best player score: 36
  • Position: #43 / 108
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10616 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1943 / 3663
  • Number of attempts: 3
Letter case trickery - 1594 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: 10
  • Position: #157 / 511
  • Number of attempts: 5
Words in parens - 12850 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 16
  • Position: #1897 / 3944
  • Number of attempts: 4
Hole-in-one - 1012 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: 19
  • Position: #150 / 302
  • Number of attempts: 4
Delete unwanted lines - 396 entries

Delete all lines which does not end in "o.."

  • Best score: 9
  • Best player score: 9
  • Position: #27 / 225
  • Number of attempts: 2
abcd > a b c d - 279 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #171 / 217
  • Number of attempts: 2
The name of the game - 646 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #235 / 354
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1569 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 9
  • Position: #178 / 437
  • Number of attempts: 3
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: 27
  • Position: #228 / 473
  • Number of attempts: 5
Let's play some Ivmgolf - 1084 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 12
  • Position: #383 / 440
  • Number of attempts: 1
Switch function arguments - 2064 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 16
  • Position: #583 / 647
  • Number of attempts: 3
Remove noise from HTTP log - 693 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: 17
  • Position: #228 / 270
  • Number of attempts: 3
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #250 / 640
  • Number of attempts: 4
Case preserving word replacement - 453 entries

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

  • Best score: 19
  • Best player score: 23
  • Position: #148 / 179
  • Number of attempts: 1
Numbering a List - 1855 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Position: #325 / 638
  • Number of attempts: 2
CSV to JSON - 163 entries

A search for shortest vimissh way to convert CSV to JSON.

  • Best score: 56
  • Best player score: 155
  • Position: #51 / 64
  • Number of attempts: 2
Reverse Simple Deletion - 832 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #271 / 454
  • Number of attempts: 3
Increment, increment, increment.... - 643 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #254 / 398
  • Number of attempts: 1
Hatsuyume - 450 entries

http://en.wikipedia.org/wiki/Hatsuyume

  • Best score: 16
  • Best player score: 24
  • Position: #66 / 174
  • Number of attempts: 1
Almost encrypted - 198 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 5
  • Position: #98 / 144
  • Number of attempts: 1
Reverse characters in a line - 709 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 12
  • Best player score: 22
  • Position: #209 / 249
  • Number of attempts: 2
Get rid of html tags - 368 entries

Want to read more about Vim's background? Then get rid of those html tags...

  • Best score: 15
  • Best player score: 17
  • Position: #86 / 217
  • Number of attempts: 1
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: 13
  • Position: #532 / 3567
  • Number of attempts: 10
Reformat/Refactor a Golfer Class - 6512 entries

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

  • Best score: 32
  • Best player score: 44
  • Position: #1046 / 1603
  • Number of attempts: 2
Dr Rev J. “I am not a bot!” Kirchartz, KSC, KHS
Twitter:

Post-Post-Modern Renaissance man. #botALLY #SubGenius #Pope maker of @YinzBot (RIP) and https://t.co/qhd7qT8Dj9 pronouns: he/him

entered into 52 challenges

contributed 0 challenges