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

[Real World] PHP To Markdown - 25 entries

Fun refactoring I had to do in the real world. This presents several challenges: - How to create a table that fits the informations exactly - How to keep track of two informations per line while doing the refactoring - Generate the link from the actual text Have fun!

  • Best score: 141
  • Best player score: 141
  • Number of attempts: 7
Turn this csv list into queries - 189 entries

Transform each line of this csv file into a MySQL-ready INSERT query.

  • Best score: 98
  • Best player score: 98
  • Number of attempts: 7
html paragraph to table - 451 entries

reformat html paragraph to table

  • Best score: 7
  • Best player score: 48
  • Number of attempts: 10
Resort and deup a CSV list - 122 entries

I'm always adding items to a sorted list. There has to be a better way dedup and resort the lists. There are multiple lists with varying lengths to discourage manual sorting. Also Australia's animals are weird.

  • Best score: 44
  • Best player score: 44
  • Number of attempts: 6
Pascal's Triangle - 21 entries

Generate the first 17 left-justified rows of Pascal's triangle.

  • Best score: 36
  • Best player score: 36
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 5570 entries

A simple case of removing unneeded code and fixing broken indentation.

  • Best score: 32
  • Best player score: 36
  • Number of attempts: 5
ASCII-art Histogram - 199 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: 34
  • Number of attempts: 5
Make HTML List - 917 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 33
  • Number of attempts: 13
Create a pandoc compatible table - 158 entries

In [this vimcast][1], a featured gist from Tim Pope shows how to quickly make a simple table structure. How fast can you convert it to pandoc's markdown style? [1]: http://vimcasts.org/episodes/aligning-text-with-tabular-vim/

  • Best score: 32
  • Best player score: 32
  • Number of attempts: 10
Multiplication table. - 182 entries

Create a multiplication table.

  • Best score: 31
  • Best player score: 31
  • Number of attempts: 11
Piphilology - 123 entries

Piphilology comprises the creation and use of mnemonic techniques to remember a span of digits of the mathematical constant π. http://en.wikipedia.org/wiki/Piphilology

  • Best score: 29
  • Best player score: 29
  • Number of attempts: 8
snowflake fractal - 34 entries

From step 0 to step 3 of a fractal

  • Best score: 26
  • Best player score: 26
  • Number of attempts: 3
Simple, Practical, and Common - 27216 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
  • Number of attempts: 8
Kolakoski sequence -- level 1 - 51 entries

Generate the Kolakoski sequence as described by its first 75 terms.

  • Best score: 22
  • Best player score: 24
  • Number of attempts: 13
Build a six - 245 entries

Just enjoy building "a" floors...

  • Best score: 22
  • Best player score: 22
  • Number of attempts: 13
Python challenge - 115 entries

Change the types of the variables in the list from str to float, while keeping the truncation.

  • Best score: 31
  • Best player score: 31
  • Number of attempts: 15
Box it - 4489 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Number of attempts: 10
Split line with dots - 1924 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 19
  • Number of attempts: 3
multiple cursor alternative - 1181 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: 19
  • Number of attempts: 7
Bad Copy Syntax - 1112 entries

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

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 9
Kolakoski sequence -- level 2 - 10 entries

This time, the line above describes the line below. Level 1 at: http://www.vimgolf.com/challenges/5c880211ab65cb00065c74eb

  • Best score: 38
  • Best player score: 55
  • Number of attempts: 1
attr_aligner - 3087 entries

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

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 12
replacing each line of a block selection - 2604 entries

replace each line's ../assets/js with /javascripts

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 8
Extract argument from function - 2061 entries

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

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 4
-a-b-c- - 2716 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 3
Reformat Cura settings - 99 entries

Cura settings are weirdly encoded... After mere replacements, you'll have to enquote two strings (infill_pattern & speed_travel) and dont forget booleans in lowercase. #format #json

  • Best score: 50
  • Best player score: 50
  • Number of attempts: 9
convert yml into java pojo field - 720 entries

How fast vim can create fields for java pojo i.e class declaration referring to a (simple) yml file

  • Best score: 29
  • Best player score: 29
  • Number of attempts: 4
Copy three lines - 2256 entries

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

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 6
Dumb to smart - 81 entries

Turn dumb quote to smart vim's way.

  • Best score: 28
  • Best player score: 40
  • Number of attempts: 1
Triangular Numbers - 59 entries

Generate the first 50 triangular numbers.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 8
Every other line - 2259 entries

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 8
Remove quotes after first field - 189 entries

Remove the quotes around each field except for the first field.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 6
Vice versa - 6313 entries

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 8
A HAPPY NEW YEAR 2014 ! - 9782 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 6
Unsemantic linewrapping - 486 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
  • Number of attempts: 9
Around the clock - 150 entries

You'll want to use 2 special commands to complete this. If you haven't yet, read through 'input.txt', especially :help simple-changes

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 5
Swap values - 3790 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 6
Add to end of each line... kinda - 266 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
  • Number of attempts: 4
Simple text editing with Vim - 10706 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: 6
Add semicolons - 4857 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 8
Basic renumbering - 4854 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 8
camel riding - 713 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 6
Just the middle - 9765 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 5
Collect List - 3634 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 4
Convert Application Output to CSV - 135 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 5
Applying same text modification in several lines - 2040 entries

Remove identical text at the beginning of several lines and the closing parenthesis.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 5
Join 'em - 186 entries

This shouldn't be too tough

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 2
Mess in revision history - 1015 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 11
I forgot quotes - 12879 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 6
Unwrap the text of an email message - 150 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 9
constructor - 162 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 110
  • Number of attempts: 1
Array transposition - 1770 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 7
Delete to the end of the current line - 565 entries

Delete to the end of the current line, but keep the character under the cursor.

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 2
remove lines containing the word "reader" - 2259 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 6
switch variable - 4453 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 6
Change part of a function name in multiple occurrences - 481 entries

Change the middle part of the function name in multiple places, preferably using the next and dot commands.

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 4
Words in parens - 11444 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 6
quotes inside quotes - 2845 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
  • Number of attempts: 4
Reorder the groups - 740 entries

Change the order so that the groups of fruit come before the vegetables.

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 8
Back to the roots - 38 entries

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

  • Best score: 23
  • Best player score: 23
  • Number of attempts: 1
One number per line - 14428 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 13
ninja substitution - 792 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 8
move titles next to url, in quotes - 355 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 5
change parenthesis - 192 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 2
Swap values inside brackets - 1795 entries

Easy challenge.

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 4
Increment each number - 605 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 8
82 bottles of beer on the wall - 261 entries

Take them down. (sorry, only 82 bottles because the problem size is limited!)

  • Best score: 107
  • Best player score: 107
  • Number of attempts: 14
Put the months in order - 603 entries

Our contractor thought that months should be in alphabetical order. Put them in calendar order please.

  • Best score: 20
  • Best player score: 20
  • Number of attempts: 14
Song Transcription Oops - 164 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
  • Number of attempts: 12
Hash staircase - 36 entries

Can you use a strategy to come up with this pattern?

  • Best score: 21
  • Best player score: 21
  • Number of attempts: 3
Cool or not? - 562 entries

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 5
V to the i - 4155 entries

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

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 5
Aligning function arguments to match a specific coding style - 159 entries

Most projects have specific coding style guidelines. In this case, the argument list must be broken into a new line for each argument, with the argument names right aligned, taking into account pointers.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 8
Generate English Alphabets - 413 entries

Start with a, get up to z.

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 10
ASCII box - 300 entries

Don't forget to fix typos!

  • Best score: 23
  • Best player score: 23
  • Number of attempts: 7
swap or reverse - 91 entries

Try to swap or reverse the line as needed.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 3
Two pairs of cluster of letters creates word - 540 entries

Clean and group.

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 7
Team names - 1539 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 4
remove dupes from array - 1253 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
  • Number of attempts: 4
Martin Delille
Twitter:

Founding member of OpenAPI Generator

entered into 79 challenges

contributed 0 challenges