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

Easier Align - 406 entries

Align the columns of a markdown table

  • Best score: 51
  • Best player score: 86
  • Position: #25 / 96
  • Number of attempts: 3
Reformat symbols in list - 1625 entries

Saw this in some lecture, easy reformatting using multiple cursor in VS Code

  • Best score: 24
  • Best player score: 27
  • Position: #159 / 349
  • Number of attempts: 5
Simple, Practical, and Common - 33724 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: #678 / 7442
  • Number of attempts: 9
Swap values - 4643 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 14
  • Position: #701 / 1274
  • Number of attempts: 3
One number per line - 18755 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #547 / 3870
  • Number of attempts: 14
Unsemantic linewrapping - 928 entries

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

  • Best score: 9
  • Best player score: 9
  • Position: #30 / 231
  • Number of attempts: 1
V to the i - 4813 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #419 / 1897
  • Number of attempts: 5
Add semicolons - 10881 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1000 / 3072
  • Number of attempts: 3
Bad Copy Syntax - 2044 entries

Copy should be from right to left, but sometimes you type it wrong.

  • Best score: 18
  • Best player score: 19
  • Position: #102 / 530
  • Number of attempts: 4
Split line with dots - 2154 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 22
  • Position: #453 / 635
  • Number of attempts: 4
Box it - 7916 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 25
  • Position: #998 / 1881
  • Number of attempts: 1
Cool or not? - 829 entries

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Position: #45 / 230
  • Number of attempts: 3
Every other line - 2915 entries

AaAaAaA

  • Best score: 12
  • Best player score: 13
  • Position: #130 / 704
  • Number of attempts: 4
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: 15
  • Position: #214 / 641
  • Number of attempts: 3
Extract argument from function - 2364 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #176 / 755
  • Number of attempts: 9
Start coding format - 155 entries

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

  • Best score: 22
  • Best player score: 22
  • Position: #10 / 72
  • Number of attempts: 4
Search and Replace 0 - 5004 entries

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

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

"vim vi improved"

  • Best score: 9
  • Best player score: 11
  • Position: #345 / 701
  • Number of attempts: 2
Just the middle - 11484 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #2294 / 4209
  • Number of attempts: 1
Make HTML List - 1061 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 36
  • Position: #69 / 274
  • Number of attempts: 6
Python Hello World! Reformatting - 1000 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 41
  • Position: #70 / 382
  • Number of attempts: 4
Basic renumbering - 5683 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #45 / 1269
  • Number of attempts: 5
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: 26
  • Position: #16 / 53
  • Number of attempts: 5
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: #86 / 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: #31 / 140
  • Number of attempts: 2
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: 16
  • Position: #34 / 83
  • Number of attempts: 2
Vice versa - 7945 entries

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #225 / 2138
  • Number of attempts: 7
7th Birthday - 202 entries

We have a bunch of numbers written from 0 to 9 in the order present in the text input file. The task is to create 7 by replacing the numbers with dashes.

  • Best score: 19
  • Best player score: 19
  • Position: #11 / 75
  • Number of attempts: 7
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: #72 / 89
  • Number of attempts: 2
C Reformatting - 690 entries

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

  • Best score: 30
  • Best player score: 32
  • Position: #42 / 163
  • Number of attempts: 7
Paragraph sort - 450 entries

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

  • Best score: 14
  • Best player score: 14
  • Position: #25 / 125
  • Number of attempts: 3
Vim's not included features - 240 entries

Filter not included (-) features in a hypothetical installation of vim.

  • Best score: 23
  • Best player score: 23
  • Position: #3 / 65
  • Number of attempts: 6
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: #50 / 81
  • Number of attempts: 1
Order and join - 985 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #162 / 260
  • Number of attempts: 2
Paragraph breaks - 522 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 11
  • Position: #66 / 167
  • Number of attempts: 3
Array of characters - 175 entries

We all copy paste things off the internet, but the syntax doesn't look right. Fix it as fast as possible.

  • Best score: 33
  • Best player score: 41
  • Position: #30 / 47
  • Number of attempts: 3
comments galore - 1048 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #206 / 425
  • Number of attempts: 4
Inner hyphens - 136 entries

Yet another hyphen challenge. Adding 5 hyphens to a file shouldn't be too hard.

  • Best score: 11
  • Best player score: 12
  • Position: #64 / 82
  • Number of attempts: 2
Scrambled numbers - 807 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 20
  • Position: #65 / 184
  • Number of attempts: 6
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: 15
  • Position: #121 / 246
  • Number of attempts: 2
Generate a list of numbers - 295 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #37 / 140
  • Number of attempts: 5
One to Ten - 2227 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

  • Best score: 12
  • Best player score: 12
  • Position: #162 / 677
  • Number of attempts: 4
Song Transcription Oops - 243 entries

When transcribing vocal music to Canjo Tab you can start by finding the lowest note and assigning that to zero and working your way up from there. However, without fail, I tend to miscount the notes and when I am near done I find a lower note. I mark this with a "z". This means I have to increase all the previous ones by 1. just a sting of numbers :)

  • Best score: 15
  • Best player score: 15
  • Position: #31 / 78
  • Number of attempts: 5
Collect List - 4305 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #253 / 1191
  • Number of attempts: 4
VimGolfNight - 566 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #244 / 348
  • Number of attempts: 2
Space out the alphabet - 1658 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 17
  • Position: #188 / 445
  • 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: #111 / 290
  • Number of attempts: 3
I forgot quotes - 16022 entries

Oops.

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

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #183 / 1138
  • Number of attempts: 3
120 Degrees - 493 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 16
  • Position: #44 / 145
  • Number of attempts: 4
Gray area - 747 entries

It's a golf metaphor or something.

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

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 18
  • Position: #149 / 300
  • Number of attempts: 7
Don't know what this is - 2024 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: 12
  • Position: #203 / 586
  • Number of attempts: 4
Where should I put the Newline? - 881 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Position: #184 / 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: 23
  • Position: #140 / 250
  • Number of attempts: 4
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: 14
  • Position: #48 / 104
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10682 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1030 / 3689
  • Number of attempts: 2
attr_aligner - 3522 entries

Two attr keywords. Two separate indentations. Align the colons.

  • Best score: 19
  • Best player score: 19
  • Position: #125 / 703
  • Number of attempts: 12
Words in parens - 12967 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1569 / 3969
  • Number of attempts: 3
ASCII-art Histogram - 320 entries

Create an ASCCI-art histogram for the given numbers. Make sure not to leave trailing whitespaces. Thanks to VimGolf I recently discovered a feature of Vim thAT blew my mind. I'm curious to see what real ninjas make of it ;-)

  • Best score: 33
  • Best player score: 41
  • Position: #31 / 57
  • 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: #108 / 480
  • Number of attempts: 6
Let's play some Ivmgolf - 1122 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #296 / 446
  • Number of attempts: 2
Exchanging Quotes - 858 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 37
  • Position: #134 / 230
  • Number of attempts: 4
Switch function arguments - 2142 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #134 / 665
  • Number of attempts: 3
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: 16
  • Position: #190 / 273
  • Number of attempts: 2
switch variable - 5079 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #442 / 1749
  • Number of attempts: 2
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: 20
  • Position: #137 / 336
  • Number of attempts: 3
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: 14
  • Position: #243 / 407
  • Number of attempts: 2
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: #439 / 667
  • 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: #35 / 460
  • Number of attempts: 5
Make Fancy Header - 1063 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #198 / 346
  • Number of attempts: 3
Bill Ruddock
Twitter:

Software engineer, Scout, circus skills freak

entered into 71 challenges

contributed 0 challenges