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

Well, swap the values...

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

Just give me the numbers.

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

Easy challenge.

  • Best score: 14
  • Best player score: 14
  • Position: #46 / 579
  • Number of attempts: 4
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: #19 / 231
  • Number of attempts: 9
V to the i - 4802 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1063 / 1893
  • Number of attempts: 5
Applying same text modification in several lines - 2880 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #177 / 851
  • Number of attempts: 5
Add semicolons - 10852 entries

Simply add a semicolon at the end of each line

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

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

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

This line is too long, split it.

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

easy stuff

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

Create a box around a line.

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

Generate the first 50 triangular numbers.

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

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

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

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Position: #43 / 230
  • Number of attempts: 5
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: 19
  • Position: #73 / 380
  • Number of attempts: 7
html paragraph to table - 606 entries

reformat html paragraph to table

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

Clean and group.

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

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #42 / 703
  • Number of attempts: 8
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: 13
  • Position: #132 / 640
  • Number of attempts: 6
Convert Application Output to CSV - 203 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 17
  • Position: #27 / 56
  • Number of attempts: 5
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: 13
  • Position: #236 / 753
  • Number of attempts: 4
Kolakoski sequence -- level 1 - 74 entries

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

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

Delete the instructions at the top and bottom.

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

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #238 / 588
  • 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 - 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: #26 / 38
  • Number of attempts: 1
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #180 / 1264
  • Number of attempts: 8
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: #26 / 174
  • Number of attempts: 4
ninja substitution - 1420 entries

How can you reuse a previous substitution ?

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

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #15 / 2128
  • Number of attempts: 8
Python challenge - 172 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 / 46
  • Number of attempts: 15
Change part of a function name in multiple occurrences - 662 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 / 208
  • Number of attempts: 4
Reformat Cura settings - 132 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 / 24
  • Number of attempts: 9
Build a six - 294 entries

Just enjoy building "a" floors...

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

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Position: #33 / 248
  • Number of attempts: 8
Around the clock - 199 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 / 77
  • 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 - 51 entries

From step 0 to step 3 of a fractal

  • Best score: 26
  • Best player score: 26
  • Position: #9 / 20
  • Number of attempts: 3
Delete to the end of the current line - 812 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 / 391
  • Number of attempts: 2
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: #26 / 78
  • Number of attempts: 12
change parenthesis - 296 entries

change the pair of braces into a pair of parentheses

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

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

  • Best score: 16
  • Best player score: 16
  • Position: #14 / 91
  • Number of attempts: 6
Put the months in order - 974 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 / 163
  • Number of attempts: 14
Reorder the groups - 1181 entries

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

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

had trouble with something similar

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

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 16
  • Position: #16 / 448
  • Number of attempts: 7
convert yml into java pojo field - 857 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 / 227
  • Number of attempts: 4
Kolakoski sequence -- level 2 - 16 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: #8 / 8
  • Number of attempts: 1
Collect List - 4298 entries

Convert to comma separated list.

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

add a prefix on some camelCase variables

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

Try to swap or reverse the line as needed.

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

Don't forget to fix typos!

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

Oops.

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

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #262 / 1137
  • Number of attempts: 3
Piphilology - 144 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 - 1184 entries

Help Joe clean up what Steve has cobbled.

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

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1872 / 3683
  • Number of attempts: 6
attr_aligner - 3520 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #158 / 702
  • Number of attempts: 12
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: #325 / 1078
  • Number of attempts: 4
Words in parens - 12935 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #367 / 3963
  • Number of attempts: 6
Resort and deup a CSV list - 167 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 / 43
  • Number of attempts: 6
[Real World] PHP To Markdown - 33 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 / 9
  • Number of attempts: 7
Pascal's Triangle - 38 entries

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

  • Best score: 36
  • Best player score: 36
  • Position: #6 / 17
  • Number of attempts: 2
Create a pandoc compatible table - 214 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 / 56
  • Number of attempts: 10
Unwrap the text of an email message - 192 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 / 75
  • 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 - 247 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 / 71
  • Number of attempts: 8
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #164 / 777
  • Number of attempts: 8
constructor - 182 entries

coding a constructor for a simple class

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

how fast can you switch two variable ?

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

Create a multiplication table.

  • Best score: 31
  • Best player score: 31
  • Position: #3 / 68
  • Number of attempts: 11
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: 17
  • Position: #76 / 336
  • Number of attempts: 4
Generate English Alphabets - 487 entries

Start with a, get up to z.

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

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

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

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

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

Turn dumb quote to smart vim's way.

  • Best score: 28
  • Best player score: 40
  • Position: #49 / 56
  • Number of attempts: 1
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: #1285 / 3694
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6982 entries

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

  • Best score: 28
  • Best player score: 36
  • Position: #475 / 1706
  • Number of attempts: 5
Martin Delille
Twitter:

Play at @lescocksuckers Formateur @twitter

entered into 79 challenges

contributed 0 challenges