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 - 357 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 - 2367 entries

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

  • Best score: 14
  • Best player score: 20
  • Position: #269 / 514
  • 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 - 646 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: #114 / 168
  • Number of attempts: 2
HS exam question - 1517 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 71
  • Position: #201 / 401
  • Number of attempts: 4
Reformat symbols in list - 1482 entries

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

  • Best score: 24
  • Best player score: 38
  • Position: #240 / 328
  • Number of attempts: 2
Fizzbuzz - 534 entries

type the first 100 lines of the fizzbuzz problem

  • Best score: 45
  • Best player score: 71
  • Position: #63 / 160
  • Number of attempts: 1
Poorly indented Python comments - 1263 entries

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

  • Best score: 15
  • Best player score: 22
  • Position: #78 / 211
  • Number of attempts: 3
Many duplicates - 1308 entries

Quick and easy

  • Best score: 7
  • Best player score: 10
  • Position: #324 / 429
  • Number of attempts: 2
2 quick changes and a numbered list - 613 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 / 147
  • Number of attempts: 3
delete swap - 1616 entries

delete all swap

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

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #341 / 559
  • Number of attempts: 2
Visual block training - 1041 entries

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

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

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

  • Best score: 10
  • Best player score: 13
  • Position: #339 / 544
  • Number of attempts: 3
Wikitext headings to markdown - 984 entries

Convert the wikitext headings to markdown.

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

Simple number generation

  • Best score: 10
  • Best player score: 14
  • Position: #517 / 690
  • Number of attempts: 1
Learn to ask for :help - 571 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #74 / 127
  • Number of attempts: 1
Plotting some variables in python - 1597 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: #168 / 342
  • Number of attempts: 1
Create a diamond comment - 335 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 - 482 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: #72 / 180
  • Number of attempts: 3
Inverting Lines - 1866 entries

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

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

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 44
  • Position: #173 / 313
  • Number of attempts: 1
Enumerate Bullets - 308 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 - 209 entries

Put a cross in the square

  • Best score: 20
  • Best player score: 23
  • Position: #59 / 86
  • Number of attempts: 2
HS Final exam vimgolf - 887 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: #127 / 233
  • Number of attempts: 3
Easy modification of ssh config - 343 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 28
  • Position: #58 / 106
  • Number of attempts: 2
Rural Post - 4410 entries

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

  • Best score: 9
  • Best player score: 13
  • Position: #649 / 1083
  • Number of attempts: 1
Satisfy the go linter - 2350 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: #316 / 462
  • Number of attempts: 2
Add quotes to ansible playbook - 940 entries

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

  • Best score: 8
  • Best player score: 10
  • Position: #245 / 300
  • Number of attempts: 1
Multiline to Single Line - 679 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #214 / 297
  • 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 - 1113 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 - 865 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #99 / 255
  • Number of attempts: 2
Bad Copy Syntax - 2008 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 - 691 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #284 / 390
  • Number of attempts: 1
Tables, Functions, Sprocs - 128 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: #43 / 45
  • Number of attempts: 2
Hash staircase - 52 entries

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

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #1055 / 1597
  • Number of attempts: 1
That hyphen - 2564 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #484 / 697
  • Number of attempts: 3
Just the middle - 11371 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Position: #3628 / 4169
  • 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 - 190 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: #67 / 75
  • 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) - 50 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: #17 / 18
  • 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 - 793 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: #204 / 243
  • Number of attempts: 1
Pretty format for variable declarations - 155 entries

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

  • Best score: 13
  • Best player score: 23
  • Position: #59 / 62
  • Number of attempts: 1
I forgot quotes - 15943 entries

Oops.

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

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 9
  • Position: #150 / 158
  • 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 - 134 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: #40 / 51
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 174 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: #92 / 103
  • 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 - 2960 entries

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

  • Best score: 18
  • Best player score: 22
  • Position: #432 / 770
  • Number of attempts: 3
Reverse and double space - 497 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #177 / 196
  • Number of attempts: 3
The meaning - 565 entries

Numbers are fun!

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

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #129 / 146
  • Number of attempts: 1
formatted text to markdown - 183 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: #58 / 66
  • Number of attempts: 1
Make it more readable - 1953 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #408 / 641
  • Number of attempts: 2
Line Zipper - 450 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 24
  • Position: #204 / 210
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 507 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: #121 / 148
  • Number of attempts: 2
Case preserving word replacement - 453 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: #114 / 179
  • Number of attempts: 2
Sort entries based on date - 363 entries

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

  • Best score: 11
  • Best player score: 16
  • Position: #85 / 114
  • 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 - 1863 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #79 / 643
  • 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 - 1300 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 11
  • Position: #452 / 516
  • 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 - 1018 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #210 / 339
  • Number of attempts: 2
Reverse characters in a line - 731 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 / 256
  • Number of attempts: 1
Get rid of html tags - 376 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 / 221
  • Number of attempts: 1
Reconstruct the Sentence - 1402 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: #379 / 390
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3413 entries

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

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

entered into 83 challenges

contributed 0 challenges