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 - 33385 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: #430 / 7364
  • Number of attempts: 4
Swap values - 4543 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 13
  • Position: #525 / 1257
  • Number of attempts: 5
One number per line - 18616 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Position: #1035 / 3842
  • Number of attempts: 2
Prime Numbers - 344 entries

List the first 100 prime numbers.

  • Best score: 34
  • Best player score: 39
  • Position: #22 / 102
  • Number of attempts: 2
Separate the lines - 175 entries

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

  • Best score: 11
  • Best player score: 14
  • Position: #61 / 89
  • Number of attempts: 1
vim = 22 / 7 - 447 entries

pi square vim

  • Best score: 20
  • Best player score: 23
  • Position: #65 / 131
  • Number of attempts: 3
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1114 / 1879
  • Number of attempts: 1
Split line with dots - 2125 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 16
  • Position: #162 / 630
  • Number of attempts: 1
multiple cursor alternative - 1474 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: #101 / 376
  • Number of attempts: 1
Every other line - 2886 entries

AaAaAaA

  • Best score: 12
  • Best player score: 17
  • Position: #412 / 700
  • Number of attempts: 2
Copy three lines - 2840 entries

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

  • Best score: 13
  • Best player score: 18
  • Position: #296 / 635
  • Number of attempts: 2
Extract argument from function - 2314 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #438 / 744
  • Number of attempts: 2
Start coding format - 147 entries

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

  • Best score: 22
  • Best player score: 24
  • Position: #38 / 70
  • Number of attempts: 1
Search and Replace 0 - 4792 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #815 / 1585
  • Number of attempts: 2
That hyphen - 2556 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #447 / 695
  • Number of attempts: 1
comment and uncomment code inline - 1069 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: #1 / 314
  • Number of attempts: 3
Just the middle - 11360 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Position: #3387 / 4164
  • Number of attempts: 1
Extract HTML option values from tag values - 98 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
  • Position: #22 / 42
  • Number of attempts: 1
Team names - 1805 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 18
  • Position: #326 / 581
  • Number of attempts: 3
Make HTML List - 1039 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 50
  • Position: #206 / 271
  • Number of attempts: 1
Learn some german verbs - 531 entries

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

  • Best score: 21
  • Best player score: 22
  • Position: #55 / 131
  • Number of attempts: 2
Interweave two blocks of text - 631 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
  • Position: #146 / 211
  • Number of attempts: 1
Todo list specification - 385 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
  • Position: #99 / 176
  • Number of attempts: 1
Subnetting - 111 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 56
  • Position: #34 / 36
  • Number of attempts: 1
For all cases. - 141 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #7 / 100
  • Number of attempts: 1
Remember VimGolf Rules ! - 257 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 7
  • Position: #4 / 138
  • Number of attempts: 2
Back to the roots - 52 entries

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

  • Best score: 22
  • Best player score: 23
  • Position: #5 / 36
  • Number of attempts: 1
Missing Library and a Typo - 856 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
  • Position: #103 / 209
  • Number of attempts: 4
Basic renumbering - 5587 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #893 / 1258
  • Number of attempts: 1
Hidden Message - 77 entries

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

  • Best score: 33
  • Best player score: 40
  • Position: #19 / 29
  • Number of attempts: 2
Interactive git rebase changing commands - 161 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #11 / 77
  • Number of attempts: 3
Adam's challenge - 957 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
  • Position: #138 / 266
  • Number of attempts: 2
Create a table - 325 entries

Convert the given input into a formatted table

  • Best score: 16
  • Best player score: 21
  • Position: #83 / 104
  • Number of attempts: 2
JS notation to Immutable.js notation - 161 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: 34
  • Best player score: 43
  • Position: #45 / 60
  • Number of attempts: 3
FoodCritic023: Prefer conditional attributes - 178 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
  • Position: #26 / 51
  • Number of attempts: 4
Add to end of each line... kinda - 325 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
  • Position: #161 / 171
  • Number of attempts: 1
Combines all items - 303 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #1 / 137
  • Number of attempts: 1
replace 2nd column blanks with values in same column if blank - 231 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
  • Position: #43 / 81
  • Number of attempts: 3
Wrap text in quotes - 349 entries

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

  • Best score: 16
  • Best player score: 25
  • Position: #106 / 120
  • Number of attempts: 2
underscore_to_camelCase - 162 entries

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

  • Best score: 14
  • Best player score: 15
  • Position: #31 / 80
  • Number of attempts: 1
Fun With The Diagonal - 103 entries

change the lowercase characters on the main diagonal to uppercase

  • Best score: 11
  • Best player score: 11
  • Position: #1 / 79
  • Number of attempts: 3
Vice versa - 7805 entries

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Position: #1194 / 2101
  • Number of attempts: 2
Double and switch - 37 entries

Aaaanother case switcher

  • Best score: 18
  • Best player score: 20
  • Position: #11 / 17
  • Number of attempts: 1
Pretty multi-line bash - 218 entries

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

  • Best score: 15
  • Best player score: 31
  • Position: #62 / 75
  • Number of attempts: 1
Free hyphen! - 159 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
  • Position: #40 / 85
  • Number of attempts: 1
C Reformatting - 688 entries

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

  • Best score: 30
  • Best player score: 41
  • Position: #62 / 161
  • Number of attempts: 3
Paragraph sort - 430 entries

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

  • Best score: 14
  • Best player score: 17
  • Position: #46 / 123
  • Number of attempts: 2
SQL to YAML - 45 entries

Should be easy with vim, or not?

  • Best score: 72
  • Best player score: 105
  • Position: #18 / 20
  • Number of attempts: 2
Sorting a glossary - 123 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
  • Position: #1 / 78
  • Number of attempts: 5
Sort files from hosts - 179 entries

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

  • Best score: 15
  • Best player score: 18
  • Position: #39 / 74
  • Number of attempts: 2
Order and join - 956 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #145 / 255
  • Number of attempts: 4
Paragraph breaks - 505 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 13
  • Position: #93 / 165
  • Number of attempts: 2
comments galore - 998 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #161 / 418
  • Number of attempts: 1
Angular naming conventions - 301 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
  • Position: #88 / 114
  • Number of attempts: 1
Replace and keep the case - 407 entries

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

  • Best score: 26
  • Best player score: 29
  • Position: #70 / 115
  • Number of attempts: 3
Change attribute to getter - 133 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 25
  • Position: #34 / 57
  • Number of attempts: 1
Scrambled numbers - 779 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 23
  • Position: #73 / 182
  • Number of attempts: 7
Alsa configuration - 491 entries

I'm tweaking my ~/.asoundrc file!

  • Best score: 22
  • Best player score: 35
  • Position: #105 / 125
  • Number of attempts: 2
Align commas - 1049 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
  • Position: #144 / 241
  • Number of attempts: 2
A grid of punctuation - 124 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #2 / 57
  • Number of attempts: 2
Hello ${world} - 299 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 30
  • Position: #62 / 94
  • Number of attempts: 1
Generate a list of numbers - 283 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 15
  • Position: #74 / 136
  • Number of attempts: 1
ASCII Art - 82 entries

how good are you with simple regex?

  • Best score: 10
  • Best player score: 10
  • Position: #2 / 52
  • Number of attempts: 2
Add Go XML to structure tags - 152 entries

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

  • Best score: 23
  • Best player score: 28
  • Position: #27 / 66
  • Number of attempts: 2
Array transposition - 2378 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 18
  • Position: #176 / 443
  • Number of attempts: 5
Mirror Symmetry - 798 entries

Add backslashes.

  • Best score: 7
  • Best player score: 13
  • Position: #204 / 266
  • Number of attempts: 1
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #172 / 249
  • Number of attempts: 3
From A to B - 564 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 21
  • Position: #117 / 155
  • Number of attempts: 1
Collect List - 4264 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #176 / 1186
  • Number of attempts: 3
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #233 / 343
  • Number of attempts: 1
readability - 312 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 19
  • Position: #121 / 148
  • Number of attempts: 1
Space out the alphabet - 1627 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 20
  • Position: #264 / 440
  • Number of attempts: 1
Fix the XML - 996 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #103 / 284
  • Number of attempts: 2
Line 'em up! - 392 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
  • Position: #26 / 110
  • Number of attempts: 5
Shuffled numbers - 234 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
  • Position: #64 / 93
  • Number of attempts: 2
Mute the second method of this script - 447 entries

prepend a # infront of every line of the second method

  • Best score: 9
  • Best player score: 9
  • Position: #104 / 237
  • Number of attempts: 1
Happy TvvO - 407 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #108 / 201
  • Number of attempts: 1
range(10) digit rotation - 32 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #17 / 20
  • Number of attempts: 1
I forgot quotes - 15931 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2120 / 4161
  • Number of attempts: 2
vim1001 - 275 entries

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

  • Best score: 17
  • Best player score: 23
  • Position: #68 / 107
  • Number of attempts: 2
-a-b-c- - 3176 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #612 / 1129
  • Number of attempts: 2
Count both ways - 1001 entries

Right AND down.

  • Best score: 13
  • Best player score: 16
  • Position: #243 / 351
  • Number of attempts: 1
120 Degrees - 468 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 27
  • Position: #123 / 143
  • Number of attempts: 1
Gray area - 732 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Position: #93 / 268
  • 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: #200 / 293
  • Number of attempts: 2
Don't know what this is - 1978 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
  • Position: #258 / 578
  • Number of attempts: 5
Two become one - 710 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
  • Position: #175 / 205
  • Number of attempts: 1
Where should I put the Newline? - 863 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #372 / 431
  • Number of attempts: 1
Vim tetris - 352 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 28
  • Position: #68 / 101
  • Number of attempts: 3
Mess in revision history - 1161 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 27
  • Position: #165 / 247
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 14
  • Position: #2749 / 3666
  • Number of attempts: 1
Counting in binary - 477 entries

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

  • Best score: 16
  • Best player score: 34
  • Position: #60 / 113
  • Number of attempts: 2
quotes inside quotes - 3125 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: 14
  • Best player score: 14
  • Position: #232 / 1072
  • Number of attempts: 4
Recursive Cowsay - 58 entries

Convert 'cowsay' statement to recursive output

  • Best score: 33
  • Best player score: 79
  • Position: #16 / 17
  • Number of attempts: 1
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: 20
  • Position: #199 / 302
  • Number of attempts: 3
Minimalist Limerick - 516 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 35
  • Position: #79 / 171
  • Number of attempts: 3
Coordinates placeholder - 62 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Position: #30 / 36
  • Number of attempts: 1
Define to require - 118 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
  • Position: #34 / 48
  • Number of attempts: 1
Block Fun 1 - 189 entries

Manipulate the columns to produce desired result.

  • Best score: 14
  • Best player score: 32
  • Position: #67 / 73
  • Number of attempts: 1
Dehamlizing - 180 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 40
  • Position: #33 / 69
  • Number of attempts: 2
NATO phonetic alphabet - 501 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 21
  • Position: #96 / 191
  • Number of attempts: 3
A simple change - 442 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #111 / 189
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1581 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: #225 / 439
  • Number of attempts: 1
Array Transposition - 177 entries

Transpose four arrays into two.

  • Best score: 27
  • Best player score: 46
  • Position: #36 / 53
  • Number of attempts: 1
Let's play some Ivmgolf - 1091 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 12
  • Position: #398 / 441
  • Number of attempts: 2
Vertical Limit - 2440 entries

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

  • Best score: 21
  • Best player score: 24
  • Position: #287 / 737
  • Number of attempts: 3
Switch function arguments - 2082 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #484 / 652
  • Number of attempts: 1
Remove noise from HTTP log - 695 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: #102 / 270
  • Number of attempts: 2
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #289 / 640
  • Number of attempts: 2
Numbering a List - 1859 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 26
  • Position: #560 / 639
  • Number of attempts: 1
Ruby 1.9 hashes - 1221 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
  • Position: #236 / 401
  • 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: #319 / 454
  • Number of attempts: 1
The Cake is a Lie - 1286 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 10
  • Position: #361 / 512
  • Number of attempts: 2
Compile C - 365 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 23
  • Position: #96 / 132
  • Number of attempts: 2
Make Fancy Header - 1014 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 17
  • Position: #187 / 338
  • Number of attempts: 2
Reformat some Python - 579 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 40
  • Position: #89 / 229
  • Number of attempts: 1
Remember FizzBuzz? - 654 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 56
  • Position: #74 / 177
  • 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: #105 / 217
  • Number of attempts: 2
Change the content of a string - 1476 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 24
  • Position: #325 / 558
  • Number of attempts: 2
Simple text editing with Vim - 12290 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1469 / 3581
  • Number of attempts: 3
Cristian Lupașcu
Twitter:

entered into 120 challenges

contributed 0 challenges