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

Rural Post - 4515 entries

Simple challenge to remove all but the post code on each line

  • Best score: 9
  • Best player score: 10
  • Position: #305 / 1106
  • Number of attempts: 1
Levenshtein distance - 105 entries

Compute distance for each pair. Notice that this recursive implementation is very inefficient. Wagner-Fischer algorithm is iterative and much faster. #vimscript

  • Best score: 27
  • Best player score: 36
  • Position: #21 / 37
  • Number of attempts: 3
Satisfy the go linter - 2437 entries

You just came up with this briliant go vars package. But dang, you forgot to add comments to the exported variables. Can you add a comment over each variable with a TODO-placeholder?

  • Best score: 20
  • Best player score: 20
  • Position: #6 / 481
  • Number of attempts: 2
Add quotes to ansible playbook - 1001 entries

You created an ansible playbook, but forgot to add quotes. Can you fix it?

  • Best score: 8
  • Best player score: 9
  • Position: #107 / 316
  • Number of attempts: 1
Data reformat - 294 entries

Reformat this copy-paste data! #csv

  • Best score: 36
  • Best player score: 42
  • Position: #22 / 65
  • Number of attempts: 2
xrandr outputs and dashes - 716 entries

uh oh, different video drivers identify display outputs with more dashes. Quick, need to change this xrandr script!

  • Best score: 12
  • Best player score: 12
  • Position: #30 / 224
  • Number of attempts: 1
Yo To Hello - 1137 entries

Simply Turn Yo To Hello

  • Best score: 8
  • Best player score: 11
  • Position: #422 / 528
  • Number of attempts: 1
Get mail address from outlook format - 649 entries

Create a mail list space separated of mail list formatted by outlook

  • Best score: 15
  • Best player score: 16
  • Position: #86 / 204
  • Number of attempts: 2
Swap values - 4643 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 13
  • Position: #607 / 1274
  • Number of attempts: 2
prepend * to every non-blank line - 6337 entries

Prepend an asterisk to every non-blank line in the input file.

  • Best score: 10
  • Best player score: 11
  • Position: #455 / 1546
  • Number of attempts: 1
Right Align Part of the line - 133 entries

The challenge is to right align a part of the line - this is useful in some SQL queries where it's more clear which are the fields displayed

  • Best score: 19
  • Best player score: 23
  • Position: #33 / 42
  • Number of attempts: 1
citizen_hacks_2019_challenge2 - 195 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 7
  • Position: #73 / 102
  • Number of attempts: 1
Applying same text modification in several lines - 2893 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #137 / 856
  • Number of attempts: 1
Add string initializers to an enum - 873 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 24
  • Position: #125 / 259
  • Number of attempts: 1
Bad Copy Syntax - 2044 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #40 / 530
  • Number of attempts: 2
remove lines containing the word "reader" - 3604 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #162 / 1169
  • Number of attempts: 1
Com(m)a Trouble - 3875 entries

Someone was real stupid when placing his commas. Can you fix it?

  • Best score: 12
  • Best player score: 13
  • Position: #244 / 876
  • Number of attempts: 2
Extract wireshark capture filter - 216 entries

Extract wireshark capture filter from IP plan

  • Best score: 25
  • Best player score: 26
  • Position: #11 / 72
  • Number of attempts: 4
Cool or not? - 829 entries

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 15
  • Position: #22 / 230
  • Number of attempts: 1
html paragraph to table - 606 entries

reformat html paragraph to table

  • Best score: 48
  • Best player score: 53
  • Position: #39 / 126
  • Number of attempts: 3
From argument to object - 1513 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

  • Best score: 17
  • Best player score: 18
  • Position: #231 / 460
  • Number of attempts: 1
Convert Application Output to CSV - 203 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 19
  • Position: #43 / 56
  • Number of attempts: 1
Array propagate - 338 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 25
  • Position: #51 / 119
  • Number of attempts: 1
comment and uncomment code inline - 1124 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

  • Best score: 9
  • Best player score: 10
  • Position: #188 / 323
  • Number of attempts: 1
Flip the bit - 129 entries

Change the specific 0 to a 1.

  • Best score: 8
  • Best player score: 8
  • Position: #20 / 74
  • Number of attempts: 1
Just the middle - 11483 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #2664 / 4209
  • Number of attempts: 2
Team names - 1841 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 17
  • Position: #299 / 589
  • Number of attempts: 1
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: #25 / 38
  • Number of attempts: 1
Long prime list - filter version - 34 entries

I've used the maximum input/diff/output size allowed by vimgolf to get a list of integers up to 1460 separated by newlines, and your goal is to only keep the lines containing primes. There are 232 of them I hope some of you will golf vimscript itself to create some function to run as a primality check for each line, which is a good exercise if you haven't done much vimscript yet! You're invited to also try copy-pasting and doing other non-smart text manipulation. Even more interesting would be to see a solution that uses text manipulation to do the filtering! Whether you use vimscript, normal-mode primality checks, or text manipulation, as long as the end result is valid, your answer will be valid! Let's see which method does better here. Best of luck!

  • Best score: 27
  • Best player score: 39
  • Position: #7 / 10
  • Number of attempts: 3
Basic renumbering - 5683 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #117 / 1269
  • Number of attempts: 2
Adam's challenge - 987 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

  • Best score: 18
  • Best player score: 19
  • Position: #119 / 271
  • Number of attempts: 2
Fiddle percentages into real numbers - 867 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

  • Best score: 13
  • Best player score: 14
  • Position: #184 / 292
  • Number of attempts: 1
ninja substitution - 1420 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 16
  • Position: #149 / 267
  • Number of attempts: 2
Vice versa - 7945 entries

Little role switching.

  • Best score: 12
  • Best player score: 14
  • Position: #949 / 2138
  • Number of attempts: 2
Order and join - 985 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #167 / 260
  • Number of attempts: 1
comments galore - 1048 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #256 / 425
  • Number of attempts: 2
Change attribute to getter - 140 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 25
  • Position: #41 / 59
  • Number of attempts: 1
One to Ten - 2227 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

  • Best score: 12
  • Best player score: 14
  • Position: #467 / 677
  • Number of attempts: 1
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: #30 / 208
  • Number of attempts: 1
Increment each number - 1025 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 18
  • Position: #107 / 249
  • Number of attempts: 1
ASCII Art - 87 entries

how good are you with simple regex?

  • Best score: 10
  • Best player score: 10
  • Position: #27 / 54
  • Number of attempts: 1
Delete to the end of the current line - 829 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #115 / 400
  • Number of attempts: 1
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: 16
  • Position: #60 / 78
  • Number of attempts: 2
change parenthesis - 296 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #99 / 161
  • Number of attempts: 1
Label grid cells (6x6) - 53 entries

Label the cells of a grid with its coordinates. Rows are labelled top to bottom from A to F, and columns left to right from A to F. Each cell has a coordinate MN, where M is the row letter and N is the column letter.

  • Best score: 31
  • Best player score: 63
  • Position: #19 / 20
  • Number of attempts: 3
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: 23
  • Position: #27 / 163
  • Number of attempts: 3
Array transposition - 2425 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 20
  • Position: #227 / 449
  • Number of attempts: 1
unknown command - 167 entries

I want change 5 words

  • Best score: 7
  • Best player score: 7
  • Position: #46 / 87
  • Number of attempts: 1
Collect List - 4305 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #369 / 1191
  • Number of attempts: 2
Remove hard line breaks - 74 entries

Text files with Hard breaks are not good for e-readers. We need remove all hard line breaks and have long lines.

  • Best score: 10
  • Best player score: 14
  • Position: #21 / 34
  • Number of attempts: 1
I forgot quotes - 16022 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1769 / 4189
  • Number of attempts: 1
-a-b-c- - 3216 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #677 / 1138
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10682 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2317 / 3689
  • Number of attempts: 1
Words in parens - 12967 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 16
  • Position: #2444 / 3969
  • Number of attempts: 1
calculations - 312 entries

Complete these (weird) calculations.

  • Best score: 38
  • Best player score: 60
  • Position: #52 / 68
  • Number of attempts: 2
replacing each line of a block selection - 3001 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #278 / 778
  • Number of attempts: 1
switch variable - 5079 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #939 / 1749
  • Number of attempts: 1
Norbert
Twitter:

entered into 57 challenges

contributed 0 challenges