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 - 33483 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: #34 / 7384
  • Number of attempts: 8
Swap values - 4554 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Position: #283 / 1259
  • Number of attempts: 6
One number per line - 18673 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #541 / 3852
  • Number of attempts: 13
Swap values inside brackets - 2477 entries

Easy challenge.

  • Best score: 14
  • Best player score: 14
  • Position: #46 / 573
  • Number of attempts: 4
Unsemantic linewrapping - 901 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: #19 / 226
  • Number of attempts: 9
V to the i - 4771 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1060 / 1887
  • Number of attempts: 5
Applying same text modification in several lines - 2851 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #175 / 843
  • Number of attempts: 5
Add semicolons - 10831 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Position: #133 / 3055
  • Number of attempts: 8
Bad Copy Syntax - 2009 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #85 / 518
  • Number of attempts: 9
Split line with dots - 2131 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 19
  • Position: #350 / 633
  • Number of attempts: 3
remove lines containing the word "reader" - 3556 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #257 / 1151
  • Number of attempts: 6
Box it - 7849 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Position: #164 / 1870
  • Number of attempts: 10
Triangular Numbers - 97 entries

Generate the first 50 triangular numbers.

  • Best score: 18
  • Best player score: 18
  • Position: #13 / 28
  • Number of attempts: 8
Hash staircase - 53 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #9 / 24
  • Number of attempts: 3
Cool or not? - 802 entries

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Position: #43 / 228
  • Number of attempts: 5
multiple cursor alternative - 1488 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
  • Position: #73 / 378
  • Number of attempts: 7
html paragraph to table - 601 entries

reformat html paragraph to table

  • Best score: 48
  • Best player score: 48
  • Position: #11 / 125
  • Number of attempts: 10
Two pairs of cluster of letters creates word - 747 entries

Clean and group.

  • Best score: 17
  • Best player score: 17
  • Position: #33 / 177
  • Number of attempts: 7
Every other line - 2902 entries

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #42 / 702
  • Number of attempts: 8
Copy three lines - 2869 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #132 / 639
  • Number of attempts: 6
Convert Application Output to CSV - 195 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 17
  • Position: #27 / 55
  • Number of attempts: 5
Extract argument from function - 2337 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #236 / 750
  • Number of attempts: 4
Kolakoski sequence -- level 1 - 65 entries

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

  • Best score: 22
  • Best player score: 24
  • Position: #6 / 18
  • Number of attempts: 13
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #307 / 4174
  • Number of attempts: 5
Team names - 1812 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #238 / 585
  • Number of attempts: 4
Make HTML List - 1050 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 33
  • Position: #10 / 273
  • Number of attempts: 13
Back to the roots - 54 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #25 / 37
  • Number of attempts: 1
Basic renumbering - 5605 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #180 / 1260
  • Number of attempts: 8
Add to end of each line... kinda - 329 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: #26 / 173
  • Number of attempts: 4
ninja substitution - 1399 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 14
  • Position: #41 / 265
  • Number of attempts: 8
Vice versa - 7865 entries

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #15 / 2114
  • Number of attempts: 8
Python challenge - 148 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
  • Position: #6 / 45
  • Number of attempts: 15
Change part of a function name in multiple occurrences - 648 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
  • Position: #42 / 205
  • Number of attempts: 4
Reformat Cura settings - 121 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
  • Position: #4 / 23
  • Number of attempts: 9
Build a six - 277 entries

Just enjoy building "a" floors...

  • Best score: 22
  • Best player score: 22
  • Position: #47 / 94
  • Number of attempts: 13
Increment each number - 995 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Position: #33 / 245
  • Number of attempts: 8
Around the clock - 191 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
  • Position: #24 / 76
  • Number of attempts: 5
Join 'em - 251 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #103 / 151
  • Number of attempts: 2
snowflake fractal - 41 entries

From step 0 to step 3 of a fractal

  • Best score: 26
  • Best player score: 26
  • Position: #9 / 19
  • Number of attempts: 3
Delete to the end of the current line - 795 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #164 / 387
  • Number of attempts: 2
Song Transcription Oops - 236 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: #26 / 77
  • Number of attempts: 12
change parenthesis - 287 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #42 / 160
  • Number of attempts: 2
Remove quotes after first field - 367 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #14 / 90
  • Number of attempts: 6
Put the months in order - 972 entries

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

  • Best score: 20
  • Best player score: 20
  • Position: #4 / 161
  • Number of attempts: 14
Reorder the groups - 1146 entries

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

  • Best score: 14
  • Best player score: 14
  • Position: #39 / 262
  • Number of attempts: 8
move titles next to url, in quotes - 510 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 19
  • Position: #4 / 137
  • Number of attempts: 5
Array transposition - 2407 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 16
  • Position: #16 / 445
  • Number of attempts: 7
convert yml into java pojo field - 837 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
  • Position: #71 / 225
  • Number of attempts: 4
Kolakoski sequence -- level 2 - 12 entries

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

  • Best score: 37
  • Best player score: 55
  • Position: #7 / 7
  • Number of attempts: 1
Collect List - 4267 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #438 / 1188
  • Number of attempts: 4
camel riding - 775 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 15
  • Position: #67 / 277
  • Number of attempts: 6
swap or reverse - 118 entries

Try to swap or reverse the line as needed.

  • Best score: 16
  • Best player score: 16
  • Position: #47 / 68
  • Number of attempts: 3
ASCII box - 333 entries

Don't forget to fix typos!

  • Best score: 23
  • Best player score: 23
  • Position: #27 / 106
  • Number of attempts: 7
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #188 / 4166
  • Number of attempts: 6
-a-b-c- - 3183 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #262 / 1132
  • Number of attempts: 3
Piphilology - 143 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: 28
  • Best player score: 29
  • Position: #9 / 52
  • Number of attempts: 8
Mess in revision history - 1183 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 17
  • Position: #57 / 249
  • Number of attempts: 11
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1869 / 3677
  • Number of attempts: 6
attr_aligner - 3454 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #158 / 695
  • Number of attempts: 12
quotes inside quotes - 3128 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: #325 / 1073
  • Number of attempts: 4
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #364 / 3950
  • Number of attempts: 6
Resort and deup a CSV list - 146 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
  • Position: #10 / 41
  • Number of attempts: 6
[Real World] PHP To Markdown - 26 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
  • Position: #2 / 8
  • Number of attempts: 7
Pascal's Triangle - 35 entries

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

  • Best score: 36
  • Best player score: 36
  • Position: #6 / 16
  • Number of attempts: 2
Create a pandoc compatible table - 185 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
  • Position: #10 / 55
  • Number of attempts: 10
Unwrap the text of an email message - 188 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
  • Position: #29 / 73
  • Number of attempts: 9
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: 34
  • Position: #13 / 57
  • Number of attempts: 5
Aligning function arguments to match a specific coding style - 230 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
  • Position: #4 / 70
  • Number of attempts: 8
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #162 / 772
  • Number of attempts: 8
constructor - 181 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 110
  • Position: #41 / 59
  • Number of attempts: 1
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #291 / 1742
  • Number of attempts: 6
Multiplication table. - 206 entries

Create a multiplication table.

  • Best score: 31
  • Best player score: 31
  • Position: #3 / 64
  • Number of attempts: 11
remove dupes from array - 1345 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
  • Position: #76 / 333
  • Number of attempts: 4
Generate English Alphabets - 476 entries

Start with a, get up to z.

  • Best score: 19
  • Best player score: 19
  • Position: #8 / 205
  • Number of attempts: 10
82 bottles of beer on the wall - 307 entries

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

  • Best score: 106
  • Best player score: 107
  • Position: #8 / 143
  • Number of attempts: 14
Turn this csv list into queries - 205 entries

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

  • Best score: 98
  • Best player score: 98
  • Position: #4 / 96
  • Number of attempts: 7
Dumb to smart - 97 entries

Turn dumb quote to smart vim's way.

  • Best score: 28
  • Best player score: 40
  • Position: #48 / 55
  • Number of attempts: 1
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1265 / 3626
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6749 entries

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

  • Best score: 31
  • Best player score: 36
  • Position: #469 / 1652
  • Number of attempts: 5
Martin Delille
Twitter:

Play at @lescocksuckers Formateur @twitter

entered into 79 challenges

contributed 0 challenges