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 - 33385 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 / 7364
  • Number of attempts: 8
Swap values - 4543 entries

Well, swap the values...

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

Just give me the numbers.

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

Easy challenge.

  • Best score: 14
  • Best player score: 14
  • Position: #46 / 569
  • Number of attempts: 4
Unsemantic linewrapping - 890 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 / 224
  • Number of attempts: 9
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1058 / 1879
  • Number of attempts: 5
Applying same text modification in several lines - 2845 entries

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

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

Simply add a semicolon at the end of each line

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

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

  • Best score: 18
  • Best player score: 19
  • Position: #82 / 516
  • Number of attempts: 9
Split line with dots - 2125 entries

This line is too long, split it.

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

easy stuff

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

Create a box around a line.

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

Generate the first 50 triangular numbers.

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

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

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

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Position: #43 / 226
  • Number of attempts: 5
multiple cursor alternative - 1474 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 / 376
  • Number of attempts: 7
html paragraph to table - 590 entries

reformat html paragraph to table

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

Clean and group.

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

AaAaAaA

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

Change the application output to comma-separated values

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

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

  • Best score: 13
  • Best player score: 13
  • Position: #236 / 744
  • 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 - 11360 entries

Delete the instructions at the top and bottom.

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

The team names are misspelled.

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

Turn the comma separated list into an unordered html list.

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

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

  • Best score: 22
  • Best player score: 23
  • Position: #24 / 36
  • Number of attempts: 1
Basic renumbering - 5587 entries

Renumbering Basic.

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

How can you reuse a previous substitution ?

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

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #15 / 2100
  • Number of attempts: 8
Python challenge - 147 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 / 44
  • Number of attempts: 15
Change part of a function name in multiple occurrences - 639 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 / 203
  • Number of attempts: 4
Reformat Cura settings - 112 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 / 21
  • Number of attempts: 9
Build a six - 272 entries

Just enjoy building "a" floors...

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

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Position: #33 / 242
  • Number of attempts: 8
Around the clock - 188 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 / 74
  • Number of attempts: 5
Join 'em - 248 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #100 / 148
  • Number of attempts: 2
snowflake fractal - 40 entries

From step 0 to step 3 of a fractal

  • Best score: 26
  • Best player score: 26
  • Position: #9 / 18
  • Number of attempts: 3
Delete to the end of the current line - 784 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 / 384
  • Number of attempts: 2
Song Transcription Oops - 234 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 / 75
  • Number of attempts: 12
change parenthesis - 278 entries

change the pair of braces into a pair of parentheses

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

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

  • Best score: 16
  • Best player score: 16
  • Position: #14 / 87
  • Number of attempts: 6
Put the months in order - 932 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 / 158
  • Number of attempts: 14
Reorder the groups - 1137 entries

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

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

had trouble with something similar

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

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 16
  • Position: #16 / 443
  • 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 - 4264 entries

Convert to comma separated list.

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

add a prefix on some camelCase variables

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

Try to swap or reverse the line as needed.

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

Don't forget to fix typos!

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

Oops.

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

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #262 / 1129
  • 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 - 1160 entries

Help Joe clean up what Steve has cobbled.

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

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1864 / 3666
  • Number of attempts: 6
attr_aligner - 3444 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #158 / 692
  • Number of attempts: 12
quotes inside quotes - 3125 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 / 1072
  • Number of attempts: 4
Words in parens - 12854 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #363 / 3945
  • Number of attempts: 6
Resort and deup a CSV list - 142 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 / 39
  • 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 - 182 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 / 53
  • Number of attempts: 10
Unwrap the text of an email message - 185 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 - 310 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 / 55
  • Number of attempts: 5
Aligning function arguments to match a specific coding style - 227 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 / 68
  • Number of attempts: 8
replacing each line of a block selection - 2946 entries

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

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

coding a constructor for a simple class

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

how fast can you switch two variable ?

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

Create a multiplication table.

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

Start with a, get up to z.

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

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

  • Best score: 106
  • Best player score: 107
  • Position: #7 / 141
  • Number of attempts: 14
Turn this csv list into queries - 204 entries

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

  • Best score: 98
  • Best player score: 98
  • Position: #4 / 95
  • Number of attempts: 7
Dumb to smart - 96 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 - 12281 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1251 / 3580
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6557 entries

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

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

Play at @lescocksuckers Formateur @twitter

entered into 79 challenges

contributed 0 challenges