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 - 33616 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 / 7420
  • Number of attempts: 4
Swap values - 4616 entries

Well, swap the values...

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

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Position: #1042 / 3864
  • Number of attempts: 2
Prime Numbers - 374 entries

List the first 100 prime numbers.

  • Best score: 34
  • Best player score: 39
  • Position: #23 / 105
  • Number of attempts: 2
Separate the lines - 182 entries

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

  • Best score: 11
  • Best player score: 14
  • Position: #62 / 92
  • Number of attempts: 1
vim = 22 / 7 - 475 entries

pi square vim

  • Best score: 20
  • Best player score: 23
  • Position: #67 / 135
  • Number of attempts: 3
V to the i - 4802 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1119 / 1893
  • Number of attempts: 1
Split line with dots - 2144 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 16
  • Position: #163 / 634
  • Number of attempts: 1
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: #104 / 380
  • Number of attempts: 1
Every other line - 2910 entries

AaAaAaA

  • Best score: 12
  • Best player score: 17
  • Position: #414 / 703
  • Number of attempts: 2
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: 18
  • Position: #298 / 640
  • Number of attempts: 2
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: 15
  • Position: #443 / 753
  • Number of attempts: 2
Start coding format - 155 entries

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

  • Best score: 22
  • Best player score: 24
  • Position: #40 / 72
  • Number of attempts: 1
Search and Replace 0 - 4989 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #840 / 1624
  • Number of attempts: 2
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #451 / 701
  • Number of attempts: 1
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: #1 / 322
  • Number of attempts: 3
Just the middle - 11454 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Position: #3411 / 4197
  • 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: 38
  • Position: #24 / 44
  • Number of attempts: 1
Team names - 1836 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 18
  • Position: #330 / 588
  • Number of attempts: 3
Make HTML List - 1050 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 50
  • Position: #208 / 273
  • Number of attempts: 1
Learn some german verbs - 533 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: #56 / 133
  • Number of attempts: 2
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: 18
  • Position: #149 / 214
  • Number of attempts: 1
Todo list specification - 399 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: #102 / 179
  • Number of attempts: 1
Subnetting - 131 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 56
  • Position: #37 / 39
  • Number of attempts: 1
For all cases. - 161 entries

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

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

Rules, ... and don't forget !

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

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

  • Best score: 20
  • Best player score: 23
  • Position: #7 / 38
  • Number of attempts: 1
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: 17
  • Position: #105 / 213
  • Number of attempts: 4
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #899 / 1264
  • Number of attempts: 1
Hidden Message - 93 entries

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

  • Best score: 33
  • Best player score: 40
  • Position: #20 / 30
  • Number of attempts: 2
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: #12 / 79
  • Number of attempts: 3
Adam's challenge - 984 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: #141 / 270
  • Number of attempts: 2
Create a table - 332 entries

Convert the given input into a formatted table

  • Best score: 16
  • Best player score: 21
  • Position: #84 / 105
  • Number of attempts: 2
JS notation to Immutable.js notation - 186 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: #48 / 63
  • Number of attempts: 3
FoodCritic023: Prefer conditional attributes - 181 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: #27 / 53
  • 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: 14
  • Position: #163 / 174
  • Number of attempts: 1
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: #1 / 140
  • Number of attempts: 1
replace 2nd column blanks with values in same column if blank - 242 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: #45 / 83
  • Number of attempts: 3
Wrap text in quotes - 368 entries

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

  • Best score: 16
  • Best player score: 25
  • Position: #108 / 122
  • Number of attempts: 2
underscore_to_camelCase - 173 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: #33 / 82
  • Number of attempts: 1
Fun With The Diagonal - 107 entries

change the lowercase characters on the main diagonal to uppercase

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

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Position: #1204 / 2128
  • Number of attempts: 2
Double and switch - 43 entries

Aaaanother case switcher

  • Best score: 18
  • Best player score: 20
  • Position: #13 / 19
  • Number of attempts: 1
Pretty multi-line bash - 235 entries

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

  • Best score: 15
  • Best player score: 31
  • Position: #64 / 77
  • Number of attempts: 1
Free hyphen! - 169 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: #42 / 89
  • Number of attempts: 1
C Reformatting - 690 entries

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

  • Best score: 30
  • Best player score: 41
  • Position: #63 / 163
  • Number of attempts: 3
Paragraph sort - 450 entries

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

  • Best score: 14
  • Best player score: 17
  • Position: #48 / 125
  • Number of attempts: 2
SQL to YAML - 52 entries

Should be easy with vim, or not?

  • Best score: 71
  • Best player score: 105
  • Position: #20 / 22
  • Number of attempts: 2
Sorting a glossary - 131 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 / 81
  • Number of attempts: 5
Sort files from hosts - 188 entries

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

  • Best score: 15
  • Best player score: 18
  • Position: #41 / 76
  • Number of attempts: 2
Order and join - 983 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #148 / 259
  • Number of attempts: 4
Paragraph breaks - 522 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 13
  • Position: #95 / 167
  • Number of attempts: 2
comments galore - 1045 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #161 / 424
  • Number of attempts: 1
Angular naming conventions - 320 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: #92 / 118
  • 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: 29
  • Position: #73 / 118
  • Number of attempts: 3
Change attribute to getter - 140 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 25
  • Position: #35 / 59
  • Number of attempts: 1
Scrambled numbers - 807 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 23
  • Position: #75 / 184
  • Number of attempts: 7
Alsa configuration - 513 entries

I'm tweaking my ~/.asoundrc file!

  • Best score: 22
  • Best player score: 35
  • Position: #107 / 128
  • Number of attempts: 2
Align commas - 1095 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: #148 / 246
  • Number of attempts: 2
A grid of punctuation - 137 entries

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

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

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 30
  • Position: #64 / 96
  • Number of attempts: 1
Generate a list of numbers - 295 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 15
  • Position: #76 / 140
  • Number of attempts: 1
ASCII Art - 87 entries

how good are you with simple regex?

  • Best score: 10
  • Best player score: 10
  • Position: #2 / 54
  • Number of attempts: 2
Add Go XML to structure tags - 170 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: #29 / 69
  • Number of attempts: 2
Array transposition - 2417 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 18
  • Position: #179 / 448
  • Number of attempts: 5
Mirror Symmetry - 822 entries

Add backslashes.

  • Best score: 7
  • Best player score: 13
  • Position: #207 / 269
  • Number of attempts: 1
Swap assigned value - 647 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #175 / 254
  • Number of attempts: 3
From A to B - 591 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 21
  • Position: #120 / 159
  • Number of attempts: 1
Collect List - 4298 entries

Convert to comma separated list.

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

Based on "The name of the game".

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

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 19
  • Position: #124 / 152
  • Number of attempts: 1
Space out the alphabet - 1657 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 20
  • Position: #266 / 444
  • Number of attempts: 1
Fix the XML - 1039 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #105 / 290
  • Number of attempts: 2
Line 'em up! - 421 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 / 114
  • Number of attempts: 5
Shuffled numbers - 246 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: #66 / 96
  • Number of attempts: 2
Mute the second method of this script - 455 entries

prepend a # infront of every line of the second method

  • Best score: 8
  • Best player score: 9
  • Position: #105 / 239
  • Number of attempts: 1
Happy TvvO - 427 entries

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

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

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

  • Best score: 18
  • Best player score: 21
  • Position: #19 / 22
  • Number of attempts: 1
I forgot quotes - 15983 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2128 / 4180
  • Number of attempts: 2
vim1001 - 307 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: #70 / 110
  • Number of attempts: 2
-a-b-c- - 3213 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #616 / 1137
  • Number of attempts: 2
Count both ways - 1022 entries

Right AND down.

  • Best score: 13
  • Best player score: 16
  • Position: #245 / 354
  • Number of attempts: 1
120 Degrees - 493 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 27
  • Position: #125 / 145
  • Number of attempts: 1
Gray area - 747 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Position: #94 / 271
  • Number of attempts: 2
Do you demand a shrubbery? - 1158 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 28
  • Position: #203 / 300
  • Number of attempts: 2
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: 13
  • Position: #262 / 585
  • Number of attempts: 5
Two become one - 713 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: #177 / 208
  • Number of attempts: 1
Where should I put the Newline? - 881 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #375 / 437
  • Number of attempts: 1
Vim tetris - 353 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 28
  • Position: #69 / 102
  • Number of attempts: 3
Mess in revision history - 1184 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 27
  • Position: #168 / 250
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10663 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 14
  • Position: #2762 / 3683
  • Number of attempts: 1
Counting in binary - 526 entries

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

  • Best score: 16
  • Best player score: 34
  • Position: #62 / 117
  • Number of attempts: 2
quotes inside quotes - 3159 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 / 1078
  • Number of attempts: 4
Recursive Cowsay - 64 entries

Convert 'cowsay' statement to recursive output

  • Best score: 33
  • Best player score: 79
  • Position: #18 / 19
  • Number of attempts: 1
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: 20
  • Position: #200 / 304
  • Number of attempts: 3
Minimalist Limerick - 520 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 35
  • Position: #80 / 174
  • Number of attempts: 3
Coordinates placeholder - 73 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 26
  • Position: #32 / 38
  • Number of attempts: 1
Define to require - 127 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: #35 / 50
  • Number of attempts: 1
Block Fun 1 - 210 entries

Manipulate the columns to produce desired result.

  • Best score: 14
  • Best player score: 32
  • Position: #69 / 75
  • Number of attempts: 1
Dehamlizing - 185 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 40
  • Position: #34 / 72
  • Number of attempts: 2
NATO phonetic alphabet - 529 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 21
  • Position: #98 / 196
  • Number of attempts: 3
A simple change - 461 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #113 / 191
  • Number of attempts: 1
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: 9
  • Position: #229 / 446
  • Number of attempts: 1
Array Transposition - 201 entries

Transpose four arrays into two.

  • Best score: 27
  • Best player score: 46
  • Position: #39 / 56
  • Number of attempts: 1
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 12
  • Position: #401 / 445
  • Number of attempts: 2
Vertical Limit - 2538 entries

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

  • Best score: 21
  • Best player score: 24
  • Position: #295 / 754
  • Number of attempts: 3
Switch function arguments - 2139 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Position: #494 / 663
  • Number of attempts: 1
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: #102 / 273
  • Number of attempts: 2
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #293 / 650
  • Number of attempts: 2
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 26
  • Position: #570 / 652
  • Number of attempts: 1
Ruby 1.9 hashes - 1244 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: #240 / 406
  • Number of attempts: 2
Reverse Simple Deletion - 847 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #320 / 458
  • Number of attempts: 1
The Cake is a Lie - 1346 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 10
  • Position: #371 / 527
  • Number of attempts: 2
Compile C - 430 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 23
  • Position: #102 / 141
  • Number of attempts: 2
Make Fancy Header - 1052 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #192 / 344
  • Number of attempts: 2
Reformat some Python - 609 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 40
  • Position: #92 / 236
  • Number of attempts: 1
Remember FizzBuzz? - 725 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 56
  • Position: #82 / 190
  • Number of attempts: 2
Get rid of html tags - 398 entries

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

  • Best score: 12
  • Best player score: 17
  • Position: #112 / 230
  • Number of attempts: 2
Change the content of a string - 1580 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 24
  • Position: #345 / 588
  • Number of attempts: 2
Simple text editing with Vim - 12811 entries

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

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

entered into 120 challenges

contributed 0 challenges