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

Easier Align - 406 entries

Align the columns of a markdown table

  • Best score: 51
  • Best player score: 169
  • Position: #50 / 96
  • Number of attempts: 1
Paste a column after a column - 2537 entries

This task is very common while using multi-cursor. What is the elegant vim way ?

  • Best score: 14
  • Best player score: 20
  • Position: #291 / 553
  • Number of attempts: 4
Filter number combinations that don't add to 11 - 408 entries

Append the sum of each line to its end, alongside an equals sign, and remove any that do not sum to 11. The ordering of lines should stay the same. Note that the combinations are semi-arbitrary and not all 4-number combinations are present in the file.

  • Best score: 27
  • Best player score: 35
  • Position: #105 / 117
  • Number of attempts: 4
Tabbed Table to Python Array - 734 entries

Not payed by the hour? So make it fast ;-) The table contains the relative occurencies of bigrams (two consecutive letters) in 1/100,000 in the german language, copy-pasted from http://www.mathe.tu-freiberg.de/~hebisch/cafe/kryptographie/bigramme.html

  • Best score: 50
  • Best player score: 66
  • Position: #121 / 179
  • Number of attempts: 2
HS exam question - 1589 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 71
  • Position: #209 / 417
  • Number of attempts: 4
Reformat symbols in list - 1621 entries

Saw this in some lecture, easy reformatting using multiple cursor in VS Code

  • Best score: 24
  • Best player score: 38
  • Position: #255 / 348
  • Number of attempts: 2
Fizzbuzz - 573 entries

type the first 100 lines of the fizzbuzz problem

  • Best score: 45
  • Best player score: 71
  • Position: #66 / 168
  • Number of attempts: 1
Poorly indented Python comments - 1315 entries

Fix the alignment of some Python comments as quickly as possible.

  • Best score: 15
  • Best player score: 22
  • Position: #82 / 221
  • Number of attempts: 3
Many duplicates - 1445 entries

Quick and easy

  • Best score: 7
  • Best player score: 10
  • Position: #355 / 468
  • Number of attempts: 2
2 quick changes and a numbered list - 647 entries

The ascii will not be lost, but rather numbered in 4 digit blocks with leading zeros.

  • Best score: 37
  • Best player score: 52
  • Position: #94 / 154
  • Number of attempts: 3
delete swap - 1786 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #25 / 555
  • Number of attempts: 5
Fix the shell script! - 2544 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #352 / 589
  • Number of attempts: 2
Visual block training - 1070 entries

You see the input. You see the output. Go.

  • Best score: 17
  • Best player score: 36
  • Position: #107 / 204
  • Number of attempts: 3
Put a newline after every 10 lines in vim - 1657 entries

Goal is to put a newline after every 10 lines in vim.

  • Best score: 10
  • Best player score: 13
  • Position: #341 / 556
  • Number of attempts: 3
Wikitext headings to markdown - 987 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 21
  • Position: #64 / 209
  • Number of attempts: 1
hello-world-vimgolf - 2499 entries

Simple number generation

  • Best score: 10
  • Best player score: 14
  • Position: #532 / 708
  • Number of attempts: 1
Learn to ask for :help - 587 entries

Learn to use the help to reduce your strokes...

  • Best score: 19
  • Best player score: 32
  • Position: #76 / 130
  • Number of attempts: 1
Plotting some variables in python - 1661 entries

4 sets of (x,y) variables to plot. Just increment the numbers! Well, let's change the colors of the lines as well. Oh and we meant to plot the absolute values of course.

  • Best score: 34
  • Best player score: 45
  • Position: #171 / 348
  • Number of attempts: 1
Create a diamond comment - 337 entries

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 41
  • Position: #48 / 75
  • Number of attempts: 1
Lowercase first characters - 487 entries

This is the (abridged) input for Day 3 in Advent of Code 2019. The output is a format more suitable for Prolog programming: the two lines of input become two lists of pairs, joined together in a wires functor.

  • Best score: 33
  • Best player score: 36
  • Position: #73 / 183
  • Number of attempts: 3
Inverting Lines - 1900 entries

A simple challenge to invert all lines, except the first.

  • Best score: 10
  • Best player score: 10
  • Position: #179 / 511
  • Number of attempts: 2
Modernise code - 1400 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 44
  • Position: #179 / 323
  • Number of attempts: 1
Enumerate Bullets - 323 entries

We will need to refer to the bullet points in our document explicitly later, so we need to assign them some ID's!

  • Best score: 20
  • Best player score: 31
  • Position: #55 / 87
  • Number of attempts: 2
Put a cross in the square - 225 entries

Put a cross in the square

  • Best score: 20
  • Best player score: 23
  • Position: #62 / 89
  • Number of attempts: 2
HS Final exam vimgolf - 897 entries

Change the initial file to a single line containing all names comma-separated with numbers inside parentheses.

  • Best score: 21
  • Best player score: 27
  • Position: #129 / 236
  • Number of attempts: 3
Easy modification of ssh config - 371 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 28
  • Position: #62 / 112
  • Number of attempts: 2
Rural Post - 4479 entries

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

  • Best score: 9
  • Best player score: 13
  • Position: #658 / 1097
  • Number of attempts: 1
Satisfy the go linter - 2391 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: 27
  • Position: #323 / 471
  • Number of attempts: 2
Add quotes to ansible playbook - 954 entries

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

  • Best score: 8
  • Best player score: 10
  • Position: #247 / 305
  • Number of attempts: 1
Multiline to Single Line - 700 entries

Convert a multiline, indented file to a single line with no whitespace

  • Best score: 5
  • Best player score: 5
  • Position: #214 / 302
  • Number of attempts: 2
xrandr outputs and dashes - 704 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: #135 / 221
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1146 entries

For each line replace a search pattern (in this case $) with numbers starting at 1 and then increasing by 1 for each replaced match. a$b$c$ -> a0b1c2

  • Best score: 21
  • Best player score: 31
  • Position: #158 / 229
  • Number of attempts: 1
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: 11
  • Position: #167 / 231
  • Number of attempts: 3
Add string initializers to an enum - 872 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #100 / 258
  • Number of attempts: 2
Bad Copy Syntax - 2037 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #274 / 525
  • Number of attempts: 2
Wrap the text of an email message to 79 characters - 766 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #284 / 410
  • Number of attempts: 1
Tables, Functions, Sprocs - 135 entries

In order to load some scripts into my database in the correct order I need to load tables first (t_), then functions (fn_), then stored procedures (sp_). The order of the t_ lines and the order of the sp_ lines should also match. Reorder the lines so they will load correctly.

  • Best score: 10
  • Best player score: 13
  • Position: #45 / 47
  • Number of attempts: 2
Hash staircase - 56 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #25 / 25
  • Number of attempts: 2
Search and Replace 0 - 4989 entries

Replace every instance of 'aaa' with 'xaaax'.

  • Best score: 12
  • Best player score: 14
  • Position: #1074 / 1624
  • Number of attempts: 1
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #486 / 701
  • Number of attempts: 3
Just the middle - 11454 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Position: #3648 / 4197
  • Number of attempts: 1
Interweave two blocks of text - 659 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

  • Best score: 15
  • Best player score: 26
  • Position: #205 / 214
  • Number of attempts: 1
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 20
  • Position: #822 / 1264
  • Number of attempts: 1
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: 16
  • Position: #69 / 77
  • Number of attempts: 1
Join 'em - 251 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 4
  • Position: #17 / 151
  • 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: #145 / 161
  • Number of attempts: 2
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: 61
  • Position: #18 / 20
  • Number of attempts: 3
Remove quotes after first field - 380 entries

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

  • Best score: 16
  • Best player score: 25
  • Position: #70 / 91
  • Number of attempts: 1
Condensed Cases - 804 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 17
  • Position: #206 / 247
  • Number of attempts: 1
Pretty format for variable declarations - 170 entries

Project standards demand the equal signs must be aligned for better readability.

  • Best score: 13
  • Best player score: 23
  • Position: #61 / 64
  • Number of attempts: 1
I forgot quotes - 15983 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2379 / 4180
  • Number of attempts: 4
learn vim in short time - 240 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 9
  • Position: #152 / 161
  • Number of attempts: 1
Gray area - 747 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 15
  • Position: #251 / 271
  • Number of attempts: 1
Sort by your own sum - 86 entries

Same numbers as last time, but you'll have to add them yourself.

  • Best score: 24
  • Best player score: 44
  • Position: #28 / 30
  • Number of attempts: 1
Checkerboard case pattern - 164 entries

All the squares are white. Make some of them black. But only the right ones.

  • Best score: 15
  • Best player score: 25
  • Position: #55 / 61
  • Number of attempts: 1
SFD-ROC: Tic-Tac-Toe - 159 entries

Tic-Tac-Toe You are 'X', and it is your turn. Stop 'O' from winning, and complete the game. Draw a diagonal line through your winning row of three X's.

  • Best score: 25
  • Best player score: 38
  • Position: #42 / 54
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 193 entries

Someone has vandalized our text (again). Please fix to read: The Quick Brown Fox Jumps Over The Lazy Dog.

  • Best score: 24
  • Best player score: 29
  • Position: #95 / 106
  • Number of attempts: 1
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #336 / 445
  • Number of attempts: 1
Alphabet soup - 429 entries

Create a column of all alphabet characters organized in a funky way

  • Best score: 25
  • Best player score: 41
  • Position: #86 / 108
  • Number of attempts: 2
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 22
  • Position: #437 / 777
  • Number of attempts: 3
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #179 / 199
  • Number of attempts: 3
The meaning - 575 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #310 / 363
  • Number of attempts: 1
Sort the cardinal numbers - 310 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #131 / 148
  • Number of attempts: 1
formatted text to markdown - 184 entries

You're converting some posts from an old blog to markdown. The formatted text is far closer to the finished product than the html markup, so it seems like a good place to start. Word wrapping seems to be the main area for optimization.

  • Best score: 70
  • Best player score: 83
  • Position: #59 / 67
  • Number of attempts: 1
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #414 / 650
  • Number of attempts: 2
Line Zipper - 473 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 24
  • Position: #209 / 215
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 545 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

  • Best score: 23
  • Best player score: 46
  • Position: #123 / 150
  • Number of attempts: 2
Case preserving word replacement - 454 entries

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

  • Best score: 19
  • Best player score: 21
  • Position: #115 / 180
  • Number of attempts: 2
Sort entries based on date - 392 entries

Sort some entries in a Ledger-file based on date.

  • Best score: 11
  • Best player score: 16
  • Position: #88 / 117
  • Number of attempts: 2
Rotating Philosophers Problem - 410 entries

Can you help the philosophers find a good place to sit before they get five forks and spaghetti?

  • Best score: 29
  • Best player score: 31
  • Position: #99 / 166
  • Number of attempts: 2
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #79 / 652
  • Number of attempts: 2
The holy-grail may help - 366 entries

Can you find it in less than 20 strokes, Arthur?

  • Best score: 16
  • Best player score: 17
  • Position: #187 / 209
  • Number of attempts: 1
Table Reshuffle - 429 entries

Fix the column order in this table... also append the new 'username' column.

  • Best score: 22
  • Best player score: 33
  • Position: #82 / 139
  • Number of attempts: 1
Reverse and count - 473 entries

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

  • Best score: 18
  • Best player score: 21
  • Position: #27 / 176
  • Number of attempts: 1
Another Mixed-Up Haiku - 265 entries

VimGolf ... a perfect evening?

  • Best score: 21
  • Best player score: 29
  • Position: #68 / 90
  • Number of attempts: 1
Reverse Simple Deletion - 847 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #368 / 458
  • Number of attempts: 2
The Cake is a Lie - 1346 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 11
  • Position: #461 / 527
  • Number of attempts: 2
Almost encrypted - 204 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 5
  • Position: #123 / 146
  • Number of attempts: 3
Make Fancy Header - 1052 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #214 / 344
  • Number of attempts: 2
Reverse characters in a line - 771 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 12
  • Best player score: 17
  • Position: #175 / 265
  • Number of attempts: 1
Get rid of html tags - 398 entries

Want to read more about Vim's background? Then get rid of those html tags...

  • Best score: 12
  • Best player score: 17
  • Position: #125 / 230
  • Number of attempts: 1
Reconstruct the Sentence - 1507 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 20
  • Best player score: 46
  • Position: #396 / 412
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3665 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 31
  • Position: #568 / 787
  • Number of attempts: 1
steve
Twitter:

entered into 83 challenges

contributed 0 challenges