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

Quicksort - 1559 entries

We need the numbers in the first row sorted as quickly as possible! Be careful not to disturb the data below the divider though: that must remain unchanged.

  • Best score: 6
  • Best player score: 9
  • Position: #146 / 344
  • Number of attempts: 5
HS exam question - 1510 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 118
  • Position: #353 / 397
  • Number of attempts: 1
Put a newline after every 10 lines in vim - 1578 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #75 / 525
  • Number of attempts: 3
Reordering Lorem Ipsum - 261 entries

Who even sorted this?

  • Best score: 13
  • Best player score: 133
  • Position: #52 / 61
  • Number of attempts: 1
Learn to ask for :help - 541 entries

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

  • Best score: 19
  • Best player score: 62
  • Position: #118 / 122
  • Number of attempts: 1
Plotting some variables in python - 1567 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: 34
  • Position: #6 / 334
  • Number of attempts: 8
Lowercase first characters - 467 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: 44
  • Position: #116 / 175
  • Number of attempts: 2
Migrated to Postgres! - 312 entries

Celebration completion of this project. https://github.com/igrigorik/vimgolf/pull/322

  • Best score: 26
  • Best player score: 29
  • Position: #37 / 122
  • Number of attempts: 2
RUST Cargo.toml version to last - 320 entries

RUST Cargo.toml version to last. rusty practice on vimgolf

  • Best score: 16
  • Best player score: 16
  • Position: #6 / 95
  • Number of attempts: 7
Modernise code - 1334 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 34
  • Position: #12 / 308
  • Number of attempts: 18
swap number pairs - 2011 entries

Swap the numbers in a bunch of 2-element arrays.

  • Best score: 16
  • Best player score: 17
  • Position: #67 / 370
  • Number of attempts: 12
HS Final exam vimgolf - 864 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #5 / 227
  • Number of attempts: 9
Change double quotes to single quotes, but with a twist - 281 entries

Although this challenge is in the context of a Python function, you don't need to know Python to do this challenge. It is to add contexts and interesting constraints. The file contains a function that prints a multi-line string literal. I wrote the string literal with double quotes, but then I decided to use single quotes instead, and that's your challenge. However, interestingly enough, the string itself contains single and double quotes. This means, inside the string literal, the originally escaped double quotes no longer need to be escaped, but the single quotes now need to be escaped. Note that the triple double quotes in the docstring should be left alone.

  • Best score: 22
  • Best player score: 22
  • Position: #6 / 53
  • Number of attempts: 13
Python: Def to Lambda - 423 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #12 / 149
  • Number of attempts: 3
Rural Post - 4368 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #46 / 1072
  • Number of attempts: 5
Satisfy the go linter - 2329 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: #14 / 457
  • Number of attempts: 12
Add quotes to ansible playbook - 930 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #17 / 296
  • Number of attempts: 5
Multiline to Single Line - 668 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #30 / 292
  • Number of attempts: 2
Data reformat - 271 entries

Reformat this copy-paste data! #csv

  • Best score: 38
  • Best player score: 90
  • Position: #50 / 60
  • Number of attempts: 1
xrandr outputs and dashes - 652 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: 15
  • Position: #169 / 213
  • Number of attempts: 5
From a Thunderlink to a Markdown link - 747 entries

ThunderLinks are durable hyperlinks to specific email messages generated from Thunderbird in HTML format. Leverage the power of vim to make them suitable for a markdown-formatted file.

  • Best score: 18
  • Best player score: 26
  • Position: #130 / 166
  • Number of attempts: 3
Yo To Hello - 1115 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #18 / 518
  • Number of attempts: 5
Replace pattern with 1, 2, 3, ... on each line - 1098 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: 28
  • Position: #126 / 225
  • Number of attempts: 7
Simple, Practical, and Common - 33385 entries

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." This challenge is just a simple movement and entering text at a certain place.

  • Best score: 22
  • Best player score: 22
  • Position: #2295 / 7364
  • Number of attempts: 11
Hogwarts Email Sorting - 877 entries

Given a list of emails, get the students full name and their associated house.

  • Best score: 20
  • Best player score: 24
  • Position: #190 / 254
  • Number of attempts: 3
prepend * to every non-blank line - 6208 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #343 / 1517
  • Number of attempts: 8
One number per line - 18616 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Position: #1320 / 3842
  • Number of attempts: 11
Quote modules - 1054 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 21
  • Position: #32 / 274
  • Number of attempts: 12
Swap values inside brackets - 2464 entries

Easy challenge.

  • Best score: 14
  • Best player score: 14
  • Position: #98 / 569
  • Number of attempts: 17
V to the i - 4751 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 7
  • Position: #762 / 1879
  • Number of attempts: 3
Add semicolons - 10792 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1656 / 3044
  • Number of attempts: 9
Bad Copy Syntax - 2001 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #25 / 516
  • Number of attempts: 8
Com(m)a Trouble - 3675 entries

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

  • Best score: 12
  • Best player score: 43
  • Position: #776 / 827
  • Number of attempts: 2
Just the middle - 11360 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3091 / 4164
  • Number of attempts: 4
Sorting a glossary - 123 entries

Sort a glossary. Glossary head contains a header phrase ending with ':' and glossary body has multi line text indented with a tab.

  • Best score: 6
  • Best player score: 6
  • Position: #22 / 78
  • Number of attempts: 1
One to Ten - 2165 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: 12
  • Position: #308 / 662
  • Number of attempts: 15
Array transposition - 2378 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 37
  • Position: #396 / 443
  • Number of attempts: 9
Swap assigned value - 626 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 12
  • Position: #193 / 250
  • Number of attempts: 2
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #176 / 343
  • Number of attempts: 1
Condensed Cases - 788 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: 19
  • Position: #209 / 242
  • Number of attempts: 1
I forgot quotes - 15931 entries

Oops.

  • Best score: 10
  • Best player score: 17
  • Position: #2728 / 4161
  • Number of attempts: 3
Change name of a variable - 169 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 10
  • Position: #128 / 132
  • Number of attempts: 2
Where should I put the Newline? - 863 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #236 / 431
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10628 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 15
  • Position: #2903 / 3667
  • Number of attempts: 1
Words in parens - 12858 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #1150 / 3946
  • Number of attempts: 3
Minimalist Limerick - 516 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 41
  • Position: #143 / 171
  • Number of attempts: 4
Define to require - 118 entries

When JSHint is enabled, there's a rule that doesn't let you have more than 6 arguments in a function, so the moment you need to add a 7th argument, you need to do a refactoring.

  • Best score: 62
  • Best player score: 119
  • Position: #43 / 48
  • Number of attempts: 3
Enumerate words - 250 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 30
  • Position: #78 / 89
  • Number of attempts: 1
Groups magic - 153 entries

Regexp or macros for string converting: (a) -> ___ (abc) -> ____ (abcd) -> ______ All in the '(' replace to _ multiply by char count + ()

  • Best score: 13
  • Best player score: 18
  • Position: #89 / 91
  • Number of attempts: 1
Prefixes and suffixes - 593 entries

Generate all prefixes of "vimchallenge", then all suffixes.

  • Best score: 17
  • Best player score: 33
  • Position: #168 / 193
  • Number of attempts: 1
Refactor arguments into object argument - 161 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 75
  • Position: #47 / 65
  • Number of attempts: 3
abcd > a b c d - 280 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #8 / 218
  • Number of attempts: 1
Python: Lots of function arguments - 102 entries

The function definition is too long for one line. The modeline helps you with some typical Python indent settings.

  • Best score: 13
  • Best player score: 31
  • Position: #45 / 46
  • Number of attempts: 2
Readable Rubyhash - 244 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 23
  • Best player score: 38
  • Position: #82 / 92
  • Number of attempts: 5
Checkerboard case pattern - 148 entries

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

  • Best score: 15
  • Best player score: 25
  • Position: #49 / 58
  • Number of attempts: 2
NATO phonetic alphabet - 501 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 41
  • Position: #190 / 191
  • Number of attempts: 2
A simple change - 442 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 21
  • Position: #174 / 189
  • Number of attempts: 2
Add links to an existing HTML table - 77 entries

Add these links at that top to the respective table cell. First link, first cell, etc.

  • Best score: 42
  • Best player score: 104
  • Position: #29 / 29
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 169 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: 28
  • Position: #22 / 101
  • Number of attempts: 1
Extract text from xml - 109 entries

Extract text from xml file (ignoring commented out elements) and create a one line regex.

  • Best score: 28
  • Best player score: 46
  • Position: #33 / 44
  • Number of attempts: 4
The Quick Brown Fox Jumps Over The Lazy Vim - 401 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 8
  • Best player score: 12
  • Position: #161 / 188
  • Number of attempts: 4
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 14
  • Position: #335 / 356
  • Number of attempts: 3
SFD-ROC: vimvimvim - 1581 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 14
  • Position: #309 / 439
  • Number of attempts: 2
Stairs Indenting - 448 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 19
  • Position: #172 / 193
  • Number of attempts: 2
Unwrap the text of an email message - 185 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 36
  • Position: #70 / 72
  • Number of attempts: 3
Saving the hashes(#) - 1992 entries

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

  • Best score: 20
  • Best player score: 34
  • Position: #423 / 473
  • Number of attempts: 1
Convert pandoc unordered list to a numbered list - 165 entries

I know it's possible to use #. in pandoc to auto-generate numbered lists, but then it's not easy to tell how many items there are when reading it in Markdown. How fast can you make the switch?

  • Best score: 20
  • Best player score: 51
  • Position: #55 / 56
  • Number of attempts: 2
SFD-ROC: ROT13 Phonics - 98 entries

A is for apple, b is for ball, etc... This familiar phonics poem has been rotated 13 characters. Make the letter match the word.

  • Best score: 6
  • Best player score: 6
  • Position: #5 / 71
  • Number of attempts: 1
Let's play some Ivmgolf - 1091 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 10
  • Position: #351 / 441
  • Number of attempts: 3
Inconsistent real estate paste - 184 entries

Format a hand-typed real estate listing that uses inconsistent punctuation into four sections

  • Best score: 24
  • Best player score: 60
  • Position: #51 / 55
  • Number of attempts: 3
Vertical Limit - 2448 entries

transform a succession of one word lines to a an array of strings

  • Best score: 21
  • Best player score: 38
  • Position: #711 / 738
  • Number of attempts: 3
Make the circuit grid! - 87 entries

Copy this command for a circuit layout program to create 10 total smd commands. Increment the number in quotes to name each pad, and add 0.7 to each of the (X Y) coordinates at the end of each line.

  • Best score: 26
  • Best player score: 89
  • Position: #48 / 48
  • Number of attempts: 2
Exchanging Quotes - 821 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 53
  • Position: #216 / 225
  • Number of attempts: 4
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #274 / 640
  • Number of attempts: 3
Rotating Philosophers Problem - 390 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: 36
  • Position: #151 / 163
  • Number of attempts: 2
Simple text editing with Vim - 12290 entries

Make the pairs of lines match up by making each second line same as first

  • Best score: 13
  • Best player score: 39
  • Position: #3419 / 3581
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 6560 entries

A simple case of removing unneeded code and fixing broken indentation.

  • Best score: 32
  • Best player score: 44
  • Position: #1042 / 1616
  • Number of attempts: 3
Ravi S Sinha
Twitter:

I aspire to be a fit, athletic, healthy, creative technologist. PhD. Connoisseur. Senior Software Engineer at @Adobe. Personal account and views.

entered into 77 challenges

contributed 0 challenges