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

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: 41
  • Position: #93 / 175
  • Number of attempts: 3
Simple, Practical, and Common - 33379 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: #928 / 7363
  • Number of attempts: 2
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: 12
  • Position: #760 / 1517
  • Number of attempts: 3
One number per line - 18616 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 22
  • Position: #2762 / 3842
  • Number of attempts: 1
Aliases for cd - 849 entries

Create these beautiful aliases with as few strokes as possible. Are you up for the challenge?

  • Best score: 30
  • Best player score: 45
  • Position: #71 / 150
  • Number of attempts: 1
vim = 22 / 7 - 447 entries

pi square vim

  • Best score: 20
  • Best player score: 20
  • Position: #2 / 131
  • Number of attempts: 4
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #860 / 1879
  • Number of attempts: 2
Add semicolons - 10792 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 12
  • Position: #1853 / 3044
  • Number of attempts: 1
remove lines containing the word "reader" - 3537 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #570 / 1144
  • Number of attempts: 2
Box it - 7827 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 22
  • Position: #524 / 1864
  • Number of attempts: 3
From argument to object - 1474 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

  • Best score: 17
  • Best player score: 18
  • Position: #171 / 450
  • Number of attempts: 1
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #171 / 1585
  • Number of attempts: 3
Across-Down Flip - 53 entries

Do this instead of the Sunday crossword.

  • Best score: 23
  • Best player score: 28
  • Position: #11 / 24
  • Number of attempts: 3
comment and uncomment code inline - 1069 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

  • Best score: 9
  • Best player score: 10
  • Position: #159 / 314
  • Number of attempts: 1
Stairstep digits - 376 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 13
  • Position: #85 / 141
  • Number of attempts: 1
Nesting SASS - 261 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 11
  • Position: #47 / 93
  • Number of attempts: 2
Scrambled numbers - 779 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 24
  • Position: #108 / 182
  • Number of attempts: 2
Sierpinski's Triangle - 83 entries

Build the famous fractal, Sierpinski's Triangle.

  • Best score: 25
  • Best player score: 25
  • Position: #2 / 25
  • Number of attempts: 4
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #12 / 249
  • Number of attempts: 4
Cartesian product - 221 entries

{1,2,3,4,5} X {1,2,3,4,5}

  • Best score: 24
  • Best player score: 26
  • Position: #22 / 92
  • Number of attempts: 4
Change your calendar - 359 entries

Happy New Year!

  • Best score: 18
  • Best player score: 19
  • Position: #13 / 84
  • Number of attempts: 3
I forgot quotes - 15931 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #132 / 4161
  • Number of attempts: 2
Lisp Condense - 438 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 13
  • Position: #26 / 154
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1731 / 3666
  • Number of attempts: 1
Letter case trickery - 1594 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 12
  • Position: #322 / 511
  • Number of attempts: 1
quotes inside quotes - 3125 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

  • Best score: 14
  • Best player score: 17
  • Position: #800 / 1072
  • Number of attempts: 1
Change The Perspective - 36 entries

This is a go game recodes file(.sgf file, refer to http://www.red-bean.com/sgf/). It base on such a coordinate system: in vertical direction, is from top(farthest end) to bottom, mark as a,b,c,...,s(19*19 board); in horizontal direction, is from left to right, uses the same notations. For Example, the coordinate notation 'cq', is the position at the bottom-left corner(vertical coordinate first). The record is from one player's perspective. We need to change to another's, but we don't want to change coordinate system, let it keep top to bottom and left to right. so we have to change the coordinates, a <-> s, b <-> r,c <-> q, etc. the Position 'cq', as transformation, it will be 'qd'.

  • Best score: 33
  • Best player score: 54
  • Position: #22 / 22
  • Number of attempts: 1
Number an outline - 249 entries

The indent and words are right, but the numbers are all wrong.

  • Best score: 25
  • Best player score: 51
  • Position: #37 / 75
  • Number of attempts: 2
Words in parens - 12854 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1181 / 3945
  • Number of attempts: 3
Hole-in-one - 1012 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 19
  • Position: #173 / 302
  • Number of attempts: 2
Lookahead and Lookbehind - 67 entries

Look everywhere

  • Best score: 16
  • Best player score: 22
  • Position: #18 / 29
  • Number of attempts: 2
Minimalist Limerick - 516 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 31
  • Position: #5 / 171
  • Number of attempts: 2
Coordinates placeholder - 62 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 23
  • Position: #10 / 36
  • Number of attempts: 1
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: 62
  • Position: #2 / 48
  • Number of attempts: 4
Enumerate words - 250 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 25
  • Position: #11 / 89
  • Number of attempts: 2
Harder than "abcd > a b c d" - 77 entries

Not as easy as the last challenge. This time, just one space between a and b, up to 25 spaces between y and z. (Removed some lines; diff was too long.)

  • Best score: 15
  • Best player score: 16
  • Position: #6 / 40
  • Number of attempts: 4
Chinese Multiplication Table - 77 entries

Print a Chinese multiplication table in Vim. In China, every kid is asked to memorize this table. And thanks to the mono-syllabism of Chinese characters, it is not that hard. Printing the multiplication table is also a good exercise for programming beginners. For-loop, escaped characters, etc... There should be some special ways to print it in Vim.

  • Best score: 39
  • Best player score: 84
  • Position: #14 / 24
  • Number of attempts: 1
Groups magic - 150 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: 13
  • Position: #4 / 90
  • Number of attempts: 3
Prefixes and suffixes - 591 entries

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

  • Best score: 17
  • Best player score: 22
  • Position: #41 / 192
  • Number of attempts: 2
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: 13
  • Position: #7 / 46
  • Number of attempts: 2
Circle of Fifths with Sharps - 96 entries

Display a list of the Circle of Fifths with corresponding solfege syllables with sharps. Handling spaces may be tricky.

  • Best score: 24
  • Best player score: 24
  • Position: #4 / 36
  • Number of attempts: 3
Dehamlizing - 180 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 32
  • Position: #3 / 69
  • Number of attempts: 6
NATO phonetic alphabet - 501 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 19
  • Position: #6 / 191
  • Number of attempts: 2
Shuffle and Sort - 209 entries

The values where sorted incorrectly. Get them back to how they are supposed to be

  • Best score: 17
  • Best player score: 17
  • Position: #6 / 65
  • Number of attempts: 4
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: 25
  • Position: #3 / 51
  • Number of attempts: 3
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: #36 / 101
  • Number of attempts: 1
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: 10
  • Position: #24 / 188
  • Number of attempts: 1
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #11 / 356
  • Number of attempts: 1
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: 8
  • Position: #1 / 439
  • Number of attempts: 2
SFD-ROC: Pipe Dreams - 101 entries

Move the pipes so they match the output.

  • Best score: 12
  • Best player score: 12
  • Position: #1 / 45
  • Number of attempts: 5
Stairs Indenting - 448 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 14
  • Position: #72 / 193
  • Number of attempts: 1
Python to Ruby - 196 entries

Convert this Python code to Ruby. NOTE: This program likely won't run.

  • Best score: 24
  • Best player score: 25
  • Position: #2 / 59
  • Number of attempts: 4
maximun and minimun - 58 entries

Find the maximum and minimum of the rows.

  • Best score: 51
  • Best player score: 51
  • Position: #1 / 24
  • Number of attempts: 2
Cleanining up 80 column concatenated text - 188 entries

1. Put the whole query on one line, remove the concatenation operators 2. Remove the double spaces that appear a few times in the query 3. Use string-interpolated variable statementPid rather than the ugly concatenation

  • Best score: 31
  • Best player score: 31
  • Position: #6 / 76
  • Number of attempts: 5
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: 21
  • Position: #73 / 473
  • Number of attempts: 5
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: 24
  • Position: #22 / 56
  • Number of attempts: 5
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: #24 / 71
  • Number of attempts: 1
Create an alphabet diamond - 81 entries

Here's a brain teaser to keep things interesting...

  • Best score: 40
  • Best player score: 49
  • Position: #8 / 30
  • Number of attempts: 6
you're stuck on jQuery < 1.7 - 337 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

  • Best score: 25
  • Best player score: 25
  • Position: #3 / 111
  • Number of attempts: 5
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: 24
  • Position: #6 / 55
  • Number of attempts: 7
Vertical Limit - 2437 entries

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

  • Best score: 21
  • Best player score: 22
  • Position: #124 / 736
  • Number of attempts: 4
Exchanging Quotes - 821 entries

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

  • Best score: 30
  • Best player score: 31
  • Position: #28 / 225
  • Number of attempts: 3
Append semicolon after expressions - 1005 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #29 / 403
  • Number of attempts: 5
Remove semicolons after expressions - 628 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 6
  • Position: #44 / 258
  • Number of attempts: 3
switch variable - 5031 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #131 / 1735
  • Number of attempts: 3
Format the output - 145 entries

Sometimes your standard out is a little hard to read. Take this multilevel hash and make it human readable.

  • Best score: 35
  • Best player score: 35
  • Position: #4 / 39
  • Number of attempts: 3
Calculate the table totals - 132 entries

Go ahead... commit the treachery of using vim as a spreadsheet.

  • Best score: 33
  • Best player score: 33
  • Position: #5 / 43
  • Number of attempts: 6
Ugly spreadsheet copy/paste to CSV - 973 entries

convert an ugly spreadsheet copy/paste into a CSV format.

  • Best score: 19
  • Best player score: 20
  • Position: #16 / 185
  • Number of attempts: 15
Complete the hex array data (Part II) - 156 entries

Do not use external tools(e.g. tac, seq) [My interpretation of Rule #7]

  • Best score: 20
  • Best player score: 22
  • Position: #31 / 67
  • Number of attempts: 4
imports alignment (python) - 661 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 17
  • Position: #33 / 194
  • Number of attempts: 7
Generate Fibonacci Numbers - 262 entries

Use your super vim powers to generate Fibonacci Numbers.

  • Best score: 19
  • Best player score: 19
  • Position: #10 / 97
  • Number of attempts: 7
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: 29
  • Position: #21 / 163
  • Number of attempts: 2
Before there was Farmville... - 97 entries

There was old MacDonald. For my toddler. The first Vim sing-a-long?

  • Best score: 156
  • Best player score: 156
  • Position: #1 / 47
  • Number of attempts: 9
Overall Vimgolf Rank - 170 entries

Suppose you are trying to figure out what your overall rank is at Vimgolf(the sum of all the ranks you got), and as a Vim ninja you decided to use Vim to do the job. Your solution should work for every Vimgolf profile page(The actual input file for this challenge is my Vimgolf profile page). So, direct answer insertion is considered cheating.

  • Best score: 23
  • Best player score: 31
  • Position: #32 / 57
  • Number of attempts: 4
Turn this csv list into queries - 204 entries

Transform each line of this csv file into a MySQL-ready INSERT query.

  • Best score: 98
  • Best player score: 107
  • Position: #23 / 95
  • Number of attempts: 3
Linear congruential generator - 129 entries

http://en.wikipedia.org/wiki/Linear_congruential_generator

  • Best score: 28
  • Best player score: 30
  • Position: #22 / 50
  • Number of attempts: 4
Reverse characters in a line - 709 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: 13
  • Position: #46 / 249
  • Number of attempts: 1
PEP8 Python Wrapping Comments and Code - 187 entries

According to PEP8, long flowy text and code should have different max line lengths. Code: 79 characters max Long flowy text: 72 characters max

  • Best score: 23
  • Best player score: 23
  • Position: #2 / 64
  • Number of attempts: 6
Reformat most common surnames - 647 entries

Reformat copy-pasted table into a list of the most common surnames

  • Best score: 23
  • Best player score: 23
  • Position: #4 / 198
  • Number of attempts: 6
Change the content of a string - 1474 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #83 / 557
  • Number of attempts: 5
Deleting folded text - 341 entries

The text below contains three folds. Delete them (and the text inside them). For example: 123 456 /*{{{*/ 789 /*}}}*/ 012 Should become: 123 012 Also, add `aoeuaoeu` to make sure small solutions don't get flagged as cheating.

  • Best score: 17
  • Best player score: 19
  • Position: #33 / 113
  • Number of attempts: 5
Sort and add attributes - 1327 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 33
  • Position: #119 / 529
  • Number of attempts: 6
Braces or Brackets? - 882 entries

Someone forgot whether to use braces or brackets and you have to clean up their code!

  • Best score: 34
  • Best player score: 34
  • Position: #8 / 287
  • Number of attempts: 4
Whitespace, empty lines and tabs - 3330 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #3 / 735
  • Number of attempts: 8
Flodder-challenge - 1117 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 27
  • Position: #4 / 311
  • Number of attempts: 11
Simple text editing with Vim - 12276 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #104 / 3578
  • Number of attempts: 4
Reformat/Refactor a Golfer Class - 6548 entries

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

  • Best score: 32
  • Best player score: 32
  • Position: #35 / 1612
  • Number of attempts: 8

Contributed Challenges

maximun and minimun - 58 entries

Find the maximum and minimum of the rows.

create arrows in a list - 103 entries

Add arrow at same distance

Victor Ramirez
Twitter:

Backend developer who loves Open Source.

entered into 87 challenges

contributed 2 challenges