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 - 33614 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: #1052 / 7418
  • Number of attempts: 6
Swap values - 4616 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Position: #200 / 1268
  • Number of attempts: 5
One number per line - 18726 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 16
  • Position: #862 / 3863
  • Number of attempts: 8
Split line with dots - 2144 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 19
  • Position: #346 / 634
  • Number of attempts: 3
Wrap the text of an email message to 79 characters - 764 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #229 / 409
  • Number of attempts: 2
multiple cursor alternative - 1519 entries

from: https://www.reddit.com/r/vim/comments/6w5pfa/crosspost_from_remacs_how_would_you_do_this_in_vim/

  • Best score: 19
  • Best player score: 20
  • Position: #134 / 380
  • Number of attempts: 6
From argument to object - 1508 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: #67 / 458
  • Number of attempts: 2
Every other line - 2910 entries

AaAaAaA

  • Best score: 12
  • Best player score: 13
  • Position: #216 / 703
  • Number of attempts: 6
Copy three lines - 2872 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #78 / 640
  • Number of attempts: 10
Array propagate - 338 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 24
  • Position: #35 / 119
  • Number of attempts: 4
Extract argument from function - 2357 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #193 / 753
  • Number of attempts: 5
Search and Replace 0 - 4989 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #505 / 1624
  • Number of attempts: 4
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Position: #171 / 701
  • Number of attempts: 4
comment and uncomment code inline - 1122 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

  • Best score: 9
  • Best player score: 9
  • Position: #76 / 322
  • Number of attempts: 3
Just the middle - 11454 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #1028 / 4197
  • Number of attempts: 3
Team names - 1836 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #61 / 588
  • Number of attempts: 4
Interweave two blocks of text - 659 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: #19 / 214
  • Number of attempts: 5
Missing Library and a Typo - 887 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

  • Best score: 14
  • Best player score: 16
  • Position: #66 / 213
  • Number of attempts: 3
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 20
  • Position: #810 / 1264
  • Number of attempts: 4
Interactive git rebase changing commands - 172 entries

How to change the action of some commits in git rebase dialog.

  • Best score: 14
  • Best player score: 15
  • Position: #46 / 79
  • Number of attempts: 2
Fiddle percentages into real numbers - 865 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: #99 / 291
  • Number of attempts: 4
Add to end of each line... kinda - 333 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

  • Best score: 12
  • Best player score: 12
  • Position: #89 / 174
  • Number of attempts: 1
Wrap text in quotes - 368 entries

All the blocks of text should be wrapped in quotation marks.

  • Best score: 16
  • Best player score: 16
  • Position: #34 / 122
  • Number of attempts: 4
Vice versa - 7904 entries

Little role switching.

  • Best score: 12
  • Best player score: 15
  • Position: #1066 / 2126
  • Number of attempts: 3
Order and join - 983 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 10
  • Position: #43 / 259
  • Number of attempts: 5
comments galore - 1045 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #238 / 424
  • Number of attempts: 2
Scrambled numbers - 807 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 18
  • Position: #31 / 184
  • Number of attempts: 7
Hello ${world} - 324 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 24
  • Position: #21 / 96
  • Number of attempts: 5
Array transposition - 2416 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 17
  • Position: #93 / 447
  • Number of attempts: 10
Swap assigned value - 647 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #87 / 254
  • Number of attempts: 3
Collect List - 4298 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #342 / 1190
  • Number of attempts: 6
readability - 327 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 18
  • Position: #72 / 152
  • Number of attempts: 2
Logging with key - 328 entries

Sometimes it is better to log with meaningful key

  • Best score: 21
  • Best player score: 21
  • Position: #20 / 88
  • Number of attempts: 6
Space out the alphabet - 1657 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 15
  • Position: #79 / 444
  • Number of attempts: 9
Condensed Cases - 804 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 12
  • Position: #50 / 247
  • Number of attempts: 6
Happy TvvO - 426 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #126 / 205
  • Number of attempts: 1
I forgot quotes - 15980 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #669 / 4179
  • Number of attempts: 7
Lisp Condense - 460 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 13
  • Position: #45 / 158
  • Number of attempts: 3
Gray area - 747 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Position: #105 / 271
  • Number of attempts: 4
Don't know what this is - 2022 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

  • Best score: 11
  • Best player score: 11
  • Position: #89 / 585
  • Number of attempts: 6
Where should I put the Newline? - 881 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Position: #195 / 437
  • Number of attempts: 2
Mess in revision history - 1184 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 17
  • Position: #48 / 250
  • Number of attempts: 7
Shuffle puzzle - 346 entries

Sort the lines in each indent group, and sort the groups. That's the pattern. Or just move lines around manually to get a better score.

  • Best score: 13
  • Best player score: 13
  • Position: #17 / 104
  • Number of attempts: 6
Going underground.... - 356 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

  • Best score: 22
  • Best player score: 27
  • Position: #24 / 128
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10663 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1171 / 3683
  • Number of attempts: 3
Letter case trickery - 1630 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: 9
  • Position: #15 / 518
  • Number of attempts: 5
Words in parens - 12930 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #815 / 3962
  • Number of attempts: 4
Hole-in-one - 1018 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: 16
  • Position: #89 / 304
  • Number of attempts: 7
NATO phonetic alphabet - 529 entries

Transform the series of words into a list.

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

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

  • Best score: 12
  • Best player score: 12
  • Position: #37 / 191
  • Number of attempts: 3
The name of the game - 665 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #227 / 360
  • Number of attempts: 1
lamb had a little Mary - 609 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #16 / 168
  • Number of attempts: 8
SFD-ROC: vimvimvim - 1606 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #93 / 446
  • Number of attempts: 6
Stairs Indenting - 473 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 12
  • Position: #18 / 197
  • Number of attempts: 5
Saving the hashes(#) - 2063 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: 21
  • Position: #115 / 480
  • Number of attempts: 6
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #112 / 445
  • Number of attempts: 3
Switch function arguments - 2139 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #145 / 663
  • Number of attempts: 5
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #113 / 419
  • Number of attempts: 3
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 14
  • Position: #60 / 199
  • Number of attempts: 4
Remove noise from HTTP log - 717 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: 15
  • Position: #114 / 273
  • Number of attempts: 2
Remove semicolons after expressions - 654 entries

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

  • Best score: 6
  • Best player score: 6
  • Position: #96 / 263
  • Number of attempts: 2
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #490 / 1748
  • Number of attempts: 4
The meaning - 575 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #272 / 363
  • Number of attempts: 1
Replacing some words - 428 entries

How fast could it be?

  • Best score: 17
  • Best player score: 17
  • Position: #27 / 151
  • Number of attempts: 8
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 13
  • Position: #86 / 650
  • Number of attempts: 6
remove dupes from array - 1358 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

  • Best score: 17
  • Best player score: 17
  • Position: #72 / 336
  • Number of attempts: 10
imports alignment (python) - 700 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 17
  • Position: #45 / 198
  • Number of attempts: 9
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #26 / 652
  • Number of attempts: 9
Assignment Alignment - 883 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #46 / 220
  • Number of attempts: 10
Shebangs for all - 1998 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

  • Best score: 11
  • Best player score: 11
  • Position: #48 / 515
  • Number of attempts: 7
Ruby 1.9 compat - 629 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: #58 / 234
  • Number of attempts: 6
The Cake is a Lie - 1344 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #238 / 526
  • Number of attempts: 3
Make Fancy Header - 1046 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 16
  • Position: #110 / 343
  • Number of attempts: 4
Reverse characters in a line - 771 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: 13
  • Position: #75 / 265
  • Number of attempts: 6
Change the content of a string - 1575 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #172 / 587
  • Number of attempts: 5
Reconstruct the Sentence - 1498 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 20
  • Best player score: 20
  • Position: #104 / 411
  • Number of attempts: 5
Simple text editing with Vim - 12787 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #495 / 3688
  • Number of attempts: 3
BarbaJol
Twitter:

A ja, ha, čujte....

entered into 77 challenges

contributed 0 challenges