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

Align the columns of a markdown table

  • Best score: 62
  • Best player score: 169
  • Position: #15 / 33
  • Number of attempts: 1
Paste a column after a column - 1074 entries

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

  • Best score: 14
  • Best player score: 20
  • Position: #118 / 227
  • Number of attempts: 4
Filter number combinations that don't add to 11 - 154 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: #44 / 52
  • Number of attempts: 4
Tabbed Table to Python Array - 374 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: 51
  • Best player score: 66
  • Position: #70 / 107
  • Number of attempts: 2
HS exam question - 1124 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 71
  • Position: #155 / 306
  • Number of attempts: 4
Reformat symbols in list - 1020 entries

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

  • Best score: 24
  • Best player score: 38
  • Position: #166 / 232
  • Number of attempts: 2
Fizzbuzz - 343 entries

type the first 100 lines of the fizzbuzz problem

  • Best score: 47
  • Best player score: 71
  • Position: #43 / 110
  • Number of attempts: 1
Poorly indented Python comments - 866 entries

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

  • Best score: 15
  • Best player score: 22
  • Position: #56 / 168
  • Number of attempts: 3
Many duplicates - 845 entries

Quick and easy

  • Best score: 7
  • Best player score: 10
  • Position: #222 / 285
  • Number of attempts: 2
2 quick changes and a numbered list - 451 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: #70 / 108
  • Number of attempts: 3
delete swap - 1087 entries

delete all swap

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

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #254 / 418
  • Number of attempts: 2
Visual block training - 780 entries

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

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

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

  • Best score: 10
  • Best player score: 13
  • Position: #288 / 457
  • Number of attempts: 3
Wikitext headings to markdown - 781 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 21
  • Position: #50 / 172
  • Number of attempts: 1
hello-world-vimgolf - 1978 entries

Simple number generation

  • Best score: 10
  • Best player score: 14
  • Position: #428 / 563
  • Number of attempts: 1
Learn to ask for :help - 461 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #63 / 107
  • Number of attempts: 1
Plotting some variables in python - 1384 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: #138 / 294
  • Number of attempts: 1
Create a diamond comment - 270 entries

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 41
  • Position: #41 / 65
  • Number of attempts: 1
Lowercase first characters - 421 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: #61 / 152
  • Number of attempts: 3
Inverting Lines - 1562 entries

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

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

Modernise and clean up some C++ code.

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

Put a cross in the square

  • Best score: 20
  • Best player score: 23
  • Position: #52 / 75
  • Number of attempts: 2
HS Final exam vimgolf - 804 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: #114 / 215
  • Number of attempts: 3
Easy modification of ssh config - 305 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 28
  • Position: #52 / 95
  • Number of attempts: 2
Rural Post - 4254 entries

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

  • Best score: 9
  • Best player score: 13
  • Position: #622 / 1044
  • Number of attempts: 1
Satisfy the go linter - 2076 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: #284 / 422
  • Number of attempts: 2
Add quotes to ansible playbook - 845 entries

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

  • Best score: 8
  • Best player score: 10
  • Position: #220 / 267
  • Number of attempts: 1
Multiline to Single Line - 585 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #214 / 260
  • Number of attempts: 2
xrandr outputs and dashes - 624 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 / 205
  • Number of attempts: 1
Replace pattern with 1, 2, 3, ... on each line - 1054 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: #148 / 214
  • Number of attempts: 1
Unsemantic linewrapping - 861 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: #158 / 218
  • Number of attempts: 3
Add string initializers to an enum - 836 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #97 / 246
  • Number of attempts: 2
Bad Copy Syntax - 1952 entries

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

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

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

  • Best score: 5
  • Best player score: 5
  • Position: #284 / 374
  • Number of attempts: 1
Tables, Functions, Sprocs - 121 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: #40 / 42
  • Number of attempts: 2
Hash staircase - 41 entries

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

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #1039 / 1574
  • Number of attempts: 1
That hyphen - 2522 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #479 / 689
  • Number of attempts: 3
Just the middle - 11289 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Position: #3608 / 4144
  • Number of attempts: 1
Interweave two blocks of text - 615 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: #201 / 210
  • Number of attempts: 1
Basic renumbering - 5489 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 20
  • Position: #805 / 1245
  • Number of attempts: 1
Around the clock - 186 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: #64 / 72
  • Number of attempts: 1
Join 'em - 238 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 4
  • Position: #17 / 141
  • Number of attempts: 2
change parenthesis - 267 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 10
  • Position: #137 / 151
  • Number of attempts: 2
Label grid cells (6x6) - 34 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: #14 / 15
  • Number of attempts: 3
Remove quotes after first field - 332 entries

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

  • Best score: 16
  • Best player score: 25
  • Position: #62 / 83
  • Number of attempts: 1
Condensed Cases - 775 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: #200 / 239
  • Number of attempts: 1
Pretty format for variable declarations - 148 entries

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

  • Best score: 13
  • Best player score: 23
  • Position: #55 / 58
  • Number of attempts: 1
I forgot quotes - 15852 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2357 / 4136
  • Number of attempts: 4
learn vim in short time - 222 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 9
  • Position: #146 / 153
  • Number of attempts: 1
Gray area - 712 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 15
  • Position: #245 / 264
  • Number of attempts: 1
Sort by your own sum - 69 entries

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

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

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

  • Best score: 15
  • Best player score: 25
  • Position: #52 / 57
  • Number of attempts: 1
SFD-ROC: Tic-Tac-Toe - 132 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 / 50
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 165 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: #91 / 99
  • Number of attempts: 1
Let's play some Ivmgolf - 1053 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #328 / 431
  • Number of attempts: 1
Alphabet soup - 402 entries

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

  • Best score: 25
  • Best player score: 41
  • Position: #80 / 98
  • Number of attempts: 2
replacing each line of a block selection - 2883 entries

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

  • Best score: 18
  • Best player score: 22
  • Position: #425 / 756
  • Number of attempts: 3
Reverse and double space - 471 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #172 / 190
  • Number of attempts: 3
The meaning - 538 entries

Numbers are fun!

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

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #127 / 143
  • Number of attempts: 1
formatted text to markdown - 181 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: #57 / 66
  • Number of attempts: 1
Make it more readable - 1930 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #405 / 636
  • Number of attempts: 2
Line Zipper - 449 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 24
  • Position: #204 / 209
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 505 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 / 146
  • Number of attempts: 2
Case preserving word replacement - 444 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: #113 / 178
  • Number of attempts: 2
Sort entries based on date - 359 entries

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

  • Best score: 11
  • Best player score: 16
  • Position: #85 / 113
  • Number of attempts: 2
Rotating Philosophers Problem - 386 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: #97 / 163
  • Number of attempts: 2
Numbering a List - 1845 entries

Pretty simple, number the list.

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

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

  • Best score: 16
  • Best player score: 17
  • Position: #181 / 201
  • Number of attempts: 1
Table Reshuffle - 366 entries

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

  • Best score: 22
  • Best player score: 33
  • Position: #79 / 132
  • Number of attempts: 1
Reverse and count - 432 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: #24 / 168
  • Number of attempts: 1
Another Mixed-Up Haiku - 232 entries

VimGolf ... a perfect evening?

  • Best score: 21
  • Best player score: 29
  • Position: #64 / 84
  • Number of attempts: 1
Reverse Simple Deletion - 822 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #367 / 449
  • Number of attempts: 2
The Cake is a Lie - 1260 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 11
  • Position: #445 / 505
  • Number of attempts: 2
Almost encrypted - 195 entries

Convert the first paragraph to be even less readable.

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

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 17
  • Position: #209 / 335
  • Number of attempts: 2
Reverse characters in a line - 696 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: #162 / 246
  • Number of attempts: 1
Get rid of html tags - 356 entries

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

  • Best score: 15
  • Best player score: 17
  • Position: #117 / 213
  • Number of attempts: 1
Reconstruct the Sentence - 1220 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: #351 / 358
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3107 entries

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

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

entered into 83 challenges

contributed 0 challenges