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 - 33722 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: #284 / 7442
  • Number of attempts: 6
One number per line - 18755 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #130 / 3870
  • Number of attempts: 7
V to the i - 4813 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #315 / 1897
  • Number of attempts: 5
Split line with dots - 2154 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Position: #135 / 635
  • Number of attempts: 3
Wrap the text of an email message to 79 characters - 799 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #231 / 421
  • Number of attempts: 2
From argument to object - 1513 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

  • Best score: 17
  • Best player score: 17
  • Position: #85 / 460
  • Number of attempts: 7
Every other line - 2915 entries

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #6 / 704
  • Number of attempts: 10
Copy three lines - 2875 entries

If the site is up (by some miracle), make the text under every header identical.

  • Best score: 13
  • Best player score: 17
  • Position: #283 / 641
  • Number of attempts: 3
Search and Replace 0 - 5004 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #513 / 1630
  • Number of attempts: 6
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Position: #102 / 701
  • Number of attempts: 4
Just the middle - 11483 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #544 / 4209
  • Number of attempts: 1
Extract HTML option values from tag values - 110 entries

Generate HTML option values from the text in the option tag. If the text contains multiple words, replace the spaces with an underscore and convert all capital letters to small letters.

  • Best score: 34
  • Best player score: 34
  • Position: #5 / 44
  • Number of attempts: 4
Team names - 1841 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #127 / 589
  • Number of attempts: 4
Interweave two blocks of text - 661 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

  • Best score: 15
  • Best player score: 15
  • Position: #20 / 215
  • Number of attempts: 5
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 67 entries

I bumped into this in a dailywtf code: http://pastebin.com/QApa5ycS I didn't want to translate a string whenever I wanted to be [Ss][Aa][Rr][Cc][Aa][Ss][Tt][Ii][Cc] on slack, so I figured a script (python, sed, whatever) would be helpful. Well, or a few vim keystroke!

  • Best score: 18
  • Best player score: 18
  • Position: #16 / 39
  • Number of attempts: 4
Basic renumbering - 5683 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #103 / 1269
  • Number of attempts: 17
Fiddle percentages into real numbers - 867 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

  • Best score: 13
  • Best player score: 13
  • Position: #15 / 292
  • Number of attempts: 4
Combines all items - 313 entries

For each line that starts with the same number I want to combine its contents

  • Best score: 9
  • Best player score: 9
  • Position: #47 / 140
  • Number of attempts: 6
Vice versa - 7945 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #702 / 2138
  • Number of attempts: 4
comments galore - 1048 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #103 / 425
  • Number of attempts: 1
Replace and keep the case - 437 entries

Replace all instance of plugin and Plugin to device and Device.

  • Best score: 26
  • Best player score: 26
  • Position: #18 / 118
  • Number of attempts: 7
Change attribute to getter - 140 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 24
  • Position: #17 / 59
  • Number of attempts: 3
Array transposition - 2425 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 17
  • Position: #108 / 449
  • Number of attempts: 9
Swap assigned value - 655 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #90 / 256
  • Number of attempts: 8
Cartesian product - 259 entries

{1,2,3,4,5} X {1,2,3,4,5}

  • Best score: 24
  • Best player score: 24
  • Position: #4 / 97
  • Number of attempts: 5
Collect List - 4305 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #159 / 1191
  • Number of attempts: 11
I forgot quotes - 16022 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #337 / 4189
  • Number of attempts: 3
-a-b-c- - 3216 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #143 / 1138
  • Number of attempts: 6
A HAPPY NEW YEAR 2014 ! - 10682 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #515 / 3689
  • Number of attempts: 5
Words in parens - 12967 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #644 / 3969
  • Number of attempts: 5
Word frequency alignment - 291 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: #101 / 161
  • Number of attempts: 3
Circle in a square - 152 entries

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

  • Best score: 23
  • Best player score: 23
  • Position: #10 / 54
  • Number of attempts: 1
NATO phonetic alphabet - 529 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 19
  • Position: #35 / 196
  • Number of attempts: 6
A simple change - 468 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 12
  • Position: #38 / 193
  • Number of attempts: 8
SFD-ROC: The Quick Brown Fox - 200 entries

Someone has vandalized our text (again). Please fix to read: The Quick Brown Fox Jumps Over The Lazy Dog.

  • Best score: 24
  • Best player score: 26
  • Position: #21 / 107
  • Number of attempts: 3
Let's play some Ivmgolf - 1122 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #115 / 446
  • Number of attempts: 4
Recursively Palindrome - 267 entries

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 21
  • Position: #2 / 75
  • Number of attempts: 1
Vertical Limit - 2552 entries

transform a succession of one word lines to a an array of strings

  • Best score: 21
  • Best player score: 23
  • Position: #242 / 757
  • Number of attempts: 6
replacing each line of a block selection - 3001 entries

replace each line's ../assets/js with /javascripts

  • Best score: 18
  • Best player score: 20
  • Position: #277 / 778
  • Number of attempts: 5
Remove semicolons after expressions - 654 entries

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

  • Best score: 6
  • Best player score: 6
  • Position: #97 / 263
  • Number of attempts: 6
switch variable - 5079 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #937 / 1749
  • Number of attempts: 3
Sort the cardinal numbers - 315 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 12
  • Position: #43 / 149
  • Number of attempts: 7
Make it more readable - 2009 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 17
  • Position: #491 / 652
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 545 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

  • Best score: 23
  • Best player score: 23
  • Position: #23 / 150
  • Number of attempts: 10
Ruby 1.9 hashes - 1249 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 12
  • Best player score: 12
  • Position: #85 / 407
  • Number of attempts: 3
A Simple One - 1057 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #471 / 667
  • Number of attempts: 1
Ruby 1.9 compat - 634 entries

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

  • Best score: 14
  • Best player score: 14
  • Position: #59 / 235
  • Number of attempts: 1
Reverse Simple Deletion - 854 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 11
  • Position: #41 / 460
  • Number of attempts: 2
Increment, increment, increment.... - 692 entries

Vim likes macros

  • Best score: 10
  • Best player score: 10
  • Position: #16 / 410
  • Number of attempts: 2
Context Insensitive completion 1 - 506 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #133 / 247
  • Number of attempts: 2
Make Fancy Header - 1059 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 16
  • Position: #113 / 345
  • Number of attempts: 4
Reformat most common surnames - 743 entries

Reformat copy-pasted table into a list of the most common surnames

  • Best score: 23
  • Best player score: 25
  • Position: #66 / 215
  • Number of attempts: 6
Sort and add attributes - 1477 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 35
  • Position: #418 / 575
  • Number of attempts: 1
Simple text editing with Vim - 12989 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #395 / 3737
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 7154 entries

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

  • Best score: 28
  • Best player score: 41
  • Position: #922 / 1754
  • Number of attempts: 2
Evgeny`s Kindle
Twitter:

Цитаты из книг.

entered into 55 challenges

contributed 0 challenges