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 - 358 entries

Align the columns of a markdown table

  • Best score: 51
  • Best player score: 169
  • Position: #48 / 92
  • Number of attempts: 1
Paste a column after a column - 2413 entries

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

  • Best score: 14
  • Best player score: 20
  • Position: #276 / 523
  • Number of attempts: 4
Filter number combinations that don't add to 11 - 379 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: #100 / 112
  • Number of attempts: 4
Tabbed Table to Python Array - 652 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: #115 / 171
  • Number of attempts: 2
HS exam question - 1523 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 71
  • Position: #202 / 404
  • Number of attempts: 4
Reformat symbols in list - 1507 entries

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

  • Best score: 24
  • Best player score: 38
  • Position: #242 / 334
  • Number of attempts: 2
Fizzbuzz - 539 entries

type the first 100 lines of the fizzbuzz problem

  • Best score: 45
  • Best player score: 71
  • Position: #65 / 162
  • Number of attempts: 1
Poorly indented Python comments - 1275 entries

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

  • Best score: 15
  • Best player score: 22
  • Position: #79 / 213
  • Number of attempts: 3
Many duplicates - 1350 entries

Quick and easy

  • Best score: 7
  • Best player score: 10
  • Position: #335 / 440
  • Number of attempts: 2
2 quick changes and a numbered list - 615 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: #93 / 148
  • Number of attempts: 3
delete swap - 1650 entries

delete all swap

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

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #344 / 569
  • Number of attempts: 2
Visual block training - 1047 entries

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

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

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

  • Best score: 10
  • Best player score: 13
  • Position: #340 / 551
  • Number of attempts: 3
Wikitext headings to markdown - 985 entries

Convert the wikitext headings to markdown.

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

Simple number generation

  • Best score: 10
  • Best player score: 14
  • Position: #524 / 699
  • Number of attempts: 1
Learn to ask for :help - 572 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #75 / 128
  • Number of attempts: 1
Plotting some variables in python - 1605 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: #170 / 345
  • Number of attempts: 1
Create a diamond comment - 336 entries

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 41
  • Position: #48 / 74
  • Number of attempts: 1
Lowercase first characters - 484 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 / 181
  • Number of attempts: 3
Inverting Lines - 1870 entries

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

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

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 44
  • Position: #174 / 316
  • Number of attempts: 1
Enumerate Bullets - 309 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 / 83
  • Number of attempts: 2
Put a cross in the square - 210 entries

Put a cross in the square

  • Best score: 20
  • Best player score: 23
  • Position: #60 / 87
  • Number of attempts: 2
HS Final exam vimgolf - 892 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: #128 / 234
  • Number of attempts: 3
Easy modification of ssh config - 348 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 28
  • Position: #59 / 108
  • Number of attempts: 2
Rural Post - 4427 entries

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

  • Best score: 9
  • Best player score: 13
  • Position: #651 / 1086
  • Number of attempts: 1
Satisfy the go linter - 2360 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: #318 / 465
  • Number of attempts: 2
Add quotes to ansible playbook - 946 entries

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

  • Best score: 8
  • Best player score: 10
  • Position: #246 / 302
  • Number of attempts: 1
Multiline to Single Line - 680 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #214 / 298
  • Number of attempts: 2
xrandr outputs and dashes - 671 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 / 218
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1114 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: #157 / 228
  • Number of attempts: 1
Unsemantic linewrapping - 901 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: #165 / 226
  • Number of attempts: 3
Add string initializers to an enum - 866 entries

Change Typescript enum so that it has string initializers.

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

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

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

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

  • Best score: 5
  • Best player score: 5
  • Position: #284 / 398
  • Number of attempts: 1
Tables, Functions, Sprocs - 129 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: #44 / 46
  • Number of attempts: 2
Hash staircase - 53 entries

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

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #1059 / 1605
  • Number of attempts: 1
That hyphen - 2572 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #485 / 698
  • Number of attempts: 3
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Position: #3632 / 4174
  • Number of attempts: 1
Interweave two blocks of text - 641 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: #203 / 212
  • Number of attempts: 1
Basic renumbering - 5605 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 20
  • Position: #818 / 1260
  • Number of attempts: 1
Around the clock - 191 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: #68 / 76
  • 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 - 287 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #144 / 160
  • Number of attempts: 2
Label grid cells (6x6) - 52 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 / 19
  • Number of attempts: 3
Remove quotes after first field - 367 entries

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

  • Best score: 16
  • Best player score: 25
  • Position: #69 / 90
  • Number of attempts: 1
Condensed Cases - 794 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: #205 / 244
  • Number of attempts: 1
Pretty format for variable declarations - 156 entries

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

  • Best score: 13
  • Best player score: 23
  • Position: #60 / 63
  • Number of attempts: 1
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2373 / 4166
  • Number of attempts: 4
learn vim in short time - 233 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 9
  • Position: #151 / 159
  • Number of attempts: 1
Gray area - 745 entries

It's a golf metaphor or something.

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

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

  • Best score: 25
  • Best player score: 44
  • Position: #27 / 29
  • Number of attempts: 1
Checkerboard case pattern - 149 entries

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

  • Best score: 15
  • Best player score: 25
  • Position: #54 / 59
  • Number of attempts: 1
SFD-ROC: Tic-Tac-Toe - 136 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: #41 / 53
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 175 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: #93 / 104
  • Number of attempts: 1
Let's play some Ivmgolf - 1096 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #334 / 442
  • Number of attempts: 1
Alphabet soup - 425 entries

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

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

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

  • Best score: 18
  • Best player score: 22
  • Position: #434 / 772
  • Number of attempts: 3
Reverse and double space - 498 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #178 / 197
  • Number of attempts: 3
The meaning - 566 entries

Numbers are fun!

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

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #130 / 147
  • 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 - 1955 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #409 / 643
  • Number of attempts: 2
Line Zipper - 454 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 24
  • Position: #206 / 212
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 508 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: #122 / 149
  • 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 - 364 entries

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

  • Best score: 11
  • Best player score: 16
  • Position: #86 / 115
  • Number of attempts: 2
Rotating Philosophers Problem - 392 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: #98 / 165
  • Number of attempts: 2
Numbering a List - 1869 entries

Pretty simple, number the list.

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

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

  • Best score: 16
  • Best player score: 17
  • Position: #184 / 207
  • Number of attempts: 1
Table Reshuffle - 372 entries

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

  • Best score: 22
  • Best player score: 33
  • Position: #80 / 135
  • Number of attempts: 1
Reverse and count - 459 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 / 174
  • Number of attempts: 1
Another Mixed-Up Haiku - 238 entries

VimGolf ... a perfect evening?

  • Best score: 21
  • Best player score: 29
  • Position: #66 / 86
  • Number of attempts: 1
Reverse Simple Deletion - 834 entries

You did the simple deletion, now reverse it.

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

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 11
  • Position: #453 / 517
  • Number of attempts: 2
Almost encrypted - 199 entries

Convert the first paragraph to be even less readable.

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

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #211 / 340
  • Number of attempts: 2
Reverse characters in a line - 732 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: #170 / 257
  • Number of attempts: 1
Get rid of html tags - 378 entries

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

  • Best score: 15
  • Best player score: 17
  • Position: #121 / 222
  • Number of attempts: 1
Reconstruct the Sentence - 1436 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: #385 / 397
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3508 entries

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

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

entered into 83 challenges

contributed 0 challenges