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 - 33236 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 / 7330
  • Number of attempts: 8
Swap values - 4513 entries

Well, swap the values...

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

Just give me the numbers.

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

Easy challenge.

  • Best score: 14
  • Best player score: 14
  • Position: #46 / 566
  • Number of attempts: 4
Unsemantic linewrapping - 873 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 / 221
  • Number of attempts: 9
V to the i - 4717 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1055 / 1874
  • Number of attempts: 5
Applying same text modification in several lines - 2820 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #174 / 834
  • Number of attempts: 5
Add semicolons - 10744 entries

Simply add a semicolon at the end of each line

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

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

  • Best score: 18
  • Best player score: 19
  • Position: #79 / 506
  • Number of attempts: 9
Split line with dots - 2113 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 19
  • Position: #349 / 625
  • Number of attempts: 3
remove lines containing the word "reader" - 3502 entries

easy stuff

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

Create a box around a line.

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

Generate the first 50 triangular numbers.

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

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

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

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Position: #43 / 222
  • Number of attempts: 5
multiple cursor alternative - 1460 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 / 374
  • Number of attempts: 7
html paragraph to table - 587 entries

reformat html paragraph to table

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

Clean and group.

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

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #42 / 695
  • Number of attempts: 8
Copy three lines - 2825 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 / 631
  • Number of attempts: 6
Convert Application Output to CSV - 184 entries

Change the application output to comma-separated values

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

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

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

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

  • Best score: 22
  • Best player score: 24
  • Position: #5 / 16
  • Number of attempts: 13
Just the middle - 11318 entries

Delete the instructions at the top and bottom.

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

The team names are misspelled.

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

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 33
  • Position: #10 / 265
  • Number of attempts: 13
Back to the roots - 47 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
  • Position: #23 / 33
  • Number of attempts: 1
Basic renumbering - 5514 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #180 / 1249
  • Number of attempts: 8
Add to end of each line... kinda - 316 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 / 166
  • Number of attempts: 4
ninja substitution - 1350 entries

How can you reuse a previous substitution ?

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

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #15 / 2079
  • Number of attempts: 8
Python challenge - 146 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 / 43
  • Number of attempts: 15
Change part of a function name in multiple occurrences - 627 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 / 200
  • Number of attempts: 4
Reformat Cura settings - 108 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 / 20
  • Number of attempts: 9
Build a six - 268 entries

Just enjoy building "a" floors...

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

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Position: #33 / 240
  • Number of attempts: 8
Around the clock - 187 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 / 73
  • Number of attempts: 5
Join 'em - 243 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #96 / 144
  • Number of attempts: 2
snowflake fractal - 39 entries

From step 0 to step 3 of a fractal

  • Best score: 26
  • Best player score: 26
  • Position: #9 / 17
  • Number of attempts: 3
Delete to the end of the current line - 729 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 / 359
  • Number of attempts: 2
Song Transcription Oops - 229 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 / 73
  • Number of attempts: 12
change parenthesis - 276 entries

change the pair of braces into a pair of parentheses

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

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

  • Best score: 16
  • Best player score: 16
  • Position: #14 / 85
  • Number of attempts: 6
Put the months in order - 926 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 / 157
  • Number of attempts: 14
Reorder the groups - 1128 entries

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

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

had trouble with something similar

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

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 16
  • Position: #16 / 439
  • Number of attempts: 7
convert yml into java pojo field - 829 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 / 223
  • Number of attempts: 4
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
  • Position: #6 / 6
  • Number of attempts: 1
Collect List - 4228 entries

Convert to comma separated list.

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

add a prefix on some camelCase variables

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

Try to swap or reverse the line as needed.

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

Don't forget to fix typos!

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

Oops.

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

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #262 / 1124
  • Number of attempts: 3
Piphilology - 131 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
  • Position: #8 / 51
  • Number of attempts: 8
Mess in revision history - 1157 entries

Help Joe clean up what Steve has cobbled.

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

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1856 / 3653
  • Number of attempts: 6
attr_aligner - 3408 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #158 / 689
  • Number of attempts: 12
quotes inside quotes - 3105 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 / 1066
  • Number of attempts: 4
Words in parens - 12821 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #361 / 3938
  • Number of attempts: 6
Resort and deup a CSV list - 140 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 / 38
  • Number of attempts: 6
[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
  • Position: #2 / 7
  • Number of attempts: 7
Pascal's Triangle - 34 entries

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

  • Best score: 36
  • Best player score: 36
  • Position: #6 / 15
  • Number of attempts: 2
Create a pandoc compatible table - 177 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 / 51
  • Number of attempts: 10
Unwrap the text of an email message - 182 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 / 72
  • Number of attempts: 9
ASCII-art Histogram - 307 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: #11 / 54
  • Number of attempts: 5
Aligning function arguments to match a specific coding style - 218 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 / 66
  • Number of attempts: 8
replacing each line of a block selection - 2907 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #159 / 760
  • Number of attempts: 8
constructor - 178 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 110
  • Position: #40 / 57
  • Number of attempts: 1
switch variable - 5012 entries

how fast can you switch two variable ?

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

Create a multiplication table.

  • Best score: 31
  • Best player score: 31
  • Position: #3 / 63
  • Number of attempts: 11
remove dupes from array - 1324 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 / 328
  • Number of attempts: 4
Generate English Alphabets - 456 entries

Start with a, get up to z.

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

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

  • Best score: 107
  • Best player score: 107
  • Position: #6 / 138
  • Number of attempts: 14
Turn this csv list into queries - 203 entries

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

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

Turn dumb quote to smart vim's way.

  • Best score: 28
  • Best player score: 40
  • Position: #47 / 54
  • Number of attempts: 1
Simple text editing with Vim - 11970 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1240 / 3505
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6338 entries

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

  • Best score: 32
  • Best player score: 36
  • Position: #456 / 1562
  • Number of attempts: 5
Martin Delille
Twitter:

Play at @lescocksuckers Formateur @twitter

entered into 79 challenges

contributed 0 challenges