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

Define to require - 113 entries

When JSHint is enabled, there's a rule that doesn't let you have more than 6 arguments in a function, so the moment you need to add a 7th argument, you need to do a refactoring.

  • Best score: 62
  • Best player score: 98
  • Number of attempts: 1
Recursive Cowsay - 41 entries

Convert 'cowsay' statement to recursive output

  • Best score: 33
  • Best player score: 79
  • Number of attempts: 1
JS notation to Immutable.js notation - 137 entries

Now Immutable.js made its way into many frontends. This challenge consists of a typical refactoring that many of us are facing now.

  • Best score: 35
  • Best player score: 43
  • Number of attempts: 3
C Reformatting - 559 entries

You may use Visual mode... or not. #uppercase

  • Best score: 30
  • Best player score: 41
  • Number of attempts: 3
Dehamlizing - 155 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 40
  • Number of attempts: 2
Prime Numbers - 261 entries

List the first 100 prime numbers.

  • Best score: 34
  • Best player score: 39
  • Number of attempts: 2
Alsa configuration - 439 entries

I'm tweaking my ~/.asoundrc file!

  • Best score: 22
  • Best player score: 35
  • Number of attempts: 2
Hello ${world} - 194 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 30
  • Number of attempts: 1
FoodCritic023: Prefer conditional attributes - 150 entries

FoodCritic (www.foodcritic.io) is a lint tool for your Chef (learn.chef.io) cookbooks. FC023 indicates that you should prefer Chef guards over Ruby conditions. This challenge expects you to be able to fix this issue in a sample cookbook, given the FoodCritic output: ================================================================ FC023: Prefer conditional attributes: cookbooks/foo/recipes/default.rb:25 ================================================================ See http://www.foodcritic.io/#FC023 for more details about the changes being made.

  • Best score: 25
  • Best player score: 30
  • Number of attempts: 4
Generate a list of numbers - 218 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 1
underscore_to_camelCase - 134 entries

Pointy haired boss decided we need to switch to camelCase. Let's get this over with.

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 1
I forgot quotes - 10039 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Number of attempts: 2
Hidden Message - 43 entries

Find the hidden message and replace all other characters with spaces.

  • Best score: 33
  • Best player score: 40
  • Number of attempts: 2
Start coding format - 114 entries

I used to start coding with following format: int main(){ -(cursor here) }

  • Best score: 22
  • Best player score: 24
  • Number of attempts: 1
-a-b-c- - 2325 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1235 entries

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

  • Best score: 8
  • Best player score: 9
  • Number of attempts: 1
Make HTML List - 799 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 50
  • Number of attempts: 1
Ruby 1.9 hashes - 1024 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: 14
  • Number of attempts: 2
Simple text editing with Vim - 9868 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
Extract argument from function - 1791 entries

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

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 2
Don't know what this is - 1571 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: 13
  • Number of attempts: 5
Separate the lines - 116 entries

Every other line is mixed up. Separate them into their original texts.

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 1
Sort files from hosts - 121 entries

Resume files by host. I hope you enjoy with this challenge

  • Best score: 15
  • Best player score: 18
  • Number of attempts: 2
The Cake is a Lie - 1099 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 10
  • Number of attempts: 2
Space out the alphabet - 1251 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 20
  • Number of attempts: 1
Switch function arguments - 1771 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 1
Angular naming conventions - 260 entries

In angular, a directive name follows the camelCase convention. When the directive is used in an HTML template, the words are instead separated by a dash. Go from to the other the fastest!

  • Best score: 18
  • Best player score: 23
  • Number of attempts: 1
Search and Replace 0 - 3819 entries

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

  • Best score: 12
  • Best player score: 13
  • Number of attempts: 2
readability - 278 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 1
Add to end of each line... kinda - 257 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: 14
  • Number of attempts: 1
quotes inside quotes - 2632 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

  • Best score: 2
  • Best player score: 14
  • Number of attempts: 4
Minimalist Limerick - 441 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 35
  • Number of attempts: 3
120 Degrees - 337 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 27
  • Number of attempts: 1
A simple change - 350 entries

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

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 1
Back to the roots - 34 entries

Johnny has a file with more integers. He wants to change each number with its square root. Can you help him?

  • Best score: 5
  • Best player score: 23
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 9017 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 1
Just the middle - 8429 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 1
Counting in binary - 322 entries

"a" represents 0; "A" represents 1. Start from zero and count to 15.

  • Best score: 16
  • Best player score: 34
  • Number of attempts: 2
Mute the second method of this script - 393 entries

prepend a # infront of every line of the second method

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
NATO phonetic alphabet - 381 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 21
  • Number of attempts: 3
From A to B - 477 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 21
  • Number of attempts: 1
V to the i - 3499 entries

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

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 1
For all cases. - 91 entries

In this case... change it! :) Watch the line.

  • Best score: 8
  • Best player score: 8
  • Number of attempts: 1
comments galore - 854 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 1
Paragraph breaks - 377 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 13
  • Number of attempts: 2
Gray area - 602 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Replace and keep the case - 319 entries

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

  • Best score: 26
  • Best player score: 29
  • Number of attempts: 3
Make it more readable - 1703 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 2
Fun With The Diagonal - 74 entries

change the lowercase characters on the main diagonal to uppercase

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 3
Align commas - 734 entries

There are 15,000 aligning challenges on vimgolf.com, and they're all exactly the same. I hope this one is a little different.

  • Best score: 11
  • Best player score: 17
  • Number of attempts: 2
Combines all items - 222 entries

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

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Hole-in-one - 929 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: 20
  • Number of attempts: 3
Array Transposition - 110 entries

Transpose four arrays into two.

  • Best score: 7
  • Best player score: 46
  • Number of attempts: 1
Count both ways - 846 entries

Right AND down.

  • Best score: 13
  • Best player score: 16
  • Number of attempts: 1
Remember VimGolf Rules ! - 177 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 2
Remove noise from HTTP log - 583 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
  • Number of attempts: 2
Split line with dots - 1685 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
Interactive git rebase changing commands - 133 entries

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

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 3
Happy TvvO - 339 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 1
A grid of punctuation - 110 entries

Create a checkerboard of = and - in an 80×24 grid!

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 2
ASCII Art - 67 entries

how good are you with simple regex?

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 2
Mess in revision history - 919 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 27
  • Number of attempts: 2
Pretty multi-line bash - 189 entries

Bash line continuations are much prettier when they're column aligned.

  • Best score: 15
  • Best player score: 31
  • Number of attempts: 1
That hyphen - 1841 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Number of attempts: 1
Swap values - 3076 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 13
  • Number of attempts: 5
Swap assigned value - 482 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 3
Reverse Simple Deletion - 692 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Collect List - 3124 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 3
Let's play some Ivmgolf - 856 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 12
  • Number of attempts: 2
Mirror Symmetry - 676 entries

Add backslashes.

  • Best score: 7
  • Best player score: 13
  • Number of attempts: 1
comment and uncomment code inline - 621 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
  • Number of attempts: 3
multiple cursor alternative - 863 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
  • Number of attempts: 1
Change the content of a string - 1195 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 24
  • Number of attempts: 2
VimGolfNight - 447 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 1
Where should I put the Newline? - 781 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 1
Shuffled numbers - 195 entries

Each number is paired with the number it should follow. That's enough information to put them in order.

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 2
SQL to YAML - 32 entries

Should be easy with vim, or not?

  • Best score: 72
  • Best player score: 105
  • Number of attempts: 2
Get rid of html tags - 303 entries

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

  • Best score: 15
  • Best player score: 17
  • Number of attempts: 2
Make Fancy Header - 874 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 17
  • Number of attempts: 2
Order and join - 660 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 4
Line 'em up! - 268 entries

It can be so hard to keep everything neatly lined-up. Somebody clearly hasn't bothered here. Tidy it up, please!

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 5
Reformat some Python - 496 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 40
  • Number of attempts: 1
Free hyphen! - 109 entries

Just like "Inner hyphens", but I'm giving you a free hyphen to play with. Will your solution be any different?

  • Best score: 9
  • Best player score: 11
  • Number of attempts: 1
Paragraph sort - 288 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 2
Fix the XML - 821 entries

The challenge consists in having a valid xml from an incomplete source.

  • Best score: 18
  • Best player score: 23
  • Number of attempts: 2
Todo list specification - 272 entries

The every item on the todo list must be done today. Modify the list to reflect that.

  • Best score: 37
  • Best player score: 39
  • Number of attempts: 1
Block Fun 1 - 158 entries

Manipulate the columns to produce desired result.

  • Best score: 14
  • Best player score: 32
  • Number of attempts: 1
Every other line - 1764 entries

AaAaAaA

  • Best score: 12
  • Best player score: 17
  • Number of attempts: 2
Vice versa - 5300 entries

Little role switching.

  • Best score: 2
  • Best player score: 16
  • Number of attempts: 2
replace 2nd column blanks with values in same column if blank - 173 entries

Where ,SOMELOGB and ,SOMELOGC replaces each /r carriage return if 2nd column is blank. The replace only happens if 2nd column is blank though and should replace up to the non blank row.

  • Best score: 15
  • Best player score: 17
  • Number of attempts: 3
Missing Library and a Typo - 573 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: 15
  • Best player score: 17
  • Number of attempts: 4
Copy three lines - 1672 entries

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

  • Best score: 13
  • Best player score: 18
  • Number of attempts: 2
Create a table - 207 entries

Convert the given input into a formatted table

  • Best score: 16
  • Best player score: 21
  • Number of attempts: 2
Interweave two blocks of text - 472 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: 18
  • Number of attempts: 1
Vertical Limit - 1995 entries

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

  • Best score: 21
  • Best player score: 24
  • Number of attempts: 3
Team names - 1193 entries

The team names are misspelled.

  • Best score: 13
  • Best player score: 18
  • Number of attempts: 3
Compile C - 275 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 23
  • Number of attempts: 2
Double and switch - 35 entries

Aaaanother case switcher

  • Best score: 18
  • Best player score: 20
  • Number of attempts: 1
Extract HTML option values from tag values - 73 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: 38
  • Number of attempts: 1
Scrambled numbers - 681 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 23
  • Number of attempts: 7
range(10) digit rotation - 27 entries

This is a data generator challenge or some kind of gift..

  • Best score: 18
  • Best player score: 21
  • Number of attempts: 1
Subnetting - 56 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 56
  • Number of attempts: 1
Adam's challenge - 632 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

  • Best score: 18
  • Best player score: 21
  • Number of attempts: 2
Two become one - 631 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 38
  • Number of attempts: 1
Add Go XML to structure tags - 123 entries

The Go programming language can directly map XML to structure fields. Add the correct XML tag after each field.

  • Best score: 24
  • Best player score: 28
  • Number of attempts: 2
One number per line - 10275 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 2
Sorting a glossary - 99 entries

Sort a glossary. Glossary head contains a header phrase ending with ':' and glossary body has multi line text indented with a tab.

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 5
Simple, Practical, and Common - 20860 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: 5
  • Best player score: 22
  • Number of attempts: 4
Learn some german verbs - 316 entries

The list needs to be structured so we can print in verbatim and feel ok about how it looks.

  • Best score: 11
  • Best player score: 22
  • Number of attempts: 2
vim1001 - 221 entries

change number 1001 into a "vim1001 sequence". (My first challenge, hope it is not too bad... )

  • Best score: 17
  • Best player score: 23
  • Number of attempts: 2
vim = 22 / 7 - 391 entries

pi square vim

  • Best score: 20
  • Best player score: 23
  • Number of attempts: 3
Basic renumbering - 4076 entries

Renumbering Basic.

  • Best score: 2
  • Best player score: 21
  • Number of attempts: 1
Wrap text in quotes - 264 entries

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

  • Best score: 16
  • Best player score: 25
  • Number of attempts: 2
Array transposition - 1241 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 18
  • Number of attempts: 5
Change attribute to getter - 84 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 25
  • Number of attempts: 1
Numbering a List - 1684 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 26
  • Number of attempts: 1
Coordinates placeholder - 49 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Number of attempts: 1
Vim tetris - 301 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 28
  • Number of attempts: 3
Remember FizzBuzz? - 512 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 56
  • Number of attempts: 2
Do you demand a shrubbery? - 963 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 28
  • Number of attempts: 2
Cristian Lupașcu
Twitter:

entered into 120 challenges

contributed 0 challenges