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]

29684 active golfers, 358507 entries, 498 challenges

Open VimGolf challenges

Land of the Lost - 60 entries

Enter the tabs below the lyrics

Label grid cells (6x6) - 13 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.

Linear congruential generator - 104 entries

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

Execute immediate SQL - 82 entries

Sql string tranformation ...

Not enough Ps - 59 entries

Different type of code

It's a factor - 78 entries

Flaunt your macro prowess by factoring some numbers. Too hard? It takes less than 30 strokes, I promise.

paste indent correction - JS - 76 entries

You copy some javascript code from a website and paste it into vim, it does not look good!

Remove Accent off the Letter - 100 entries

Remove all the accent from extremely accented statements.

Replace Parameter with Explicit Methods - 61 entries

Implementing the methods of a Java Interface

Sierpinski's Triangle - 79 entries

Build the famous fractal, Sierpinski's Triangle.

Chucking wood - 75 entries

An exercise in compressing repetitive text. For this challenge, any entry that uses keys outside the main row (such as arrow keys, Home, End, Delete, etc.) will be removed. (Esc is OK, though you should be using C-[ anyway.)

Roman numerals - 58 entries

Use the substitutions on top to convert unary to Roman numerals.

Before there was Farmville... - 92 entries

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

HTML formatting: vertical alignment for readability - 60 entries

We did this a VimGolf challenge at work and now that we have finished I want to see if you guys can come up with something even better than we could. Our best solution was 44 keystrokes.

Create an alphabet diamond - 76 entries

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

Python: Lots of function arguments - 73 entries

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

Double and switch - 36 entries

Aaaanother case switcher

PHP <--> Java class conversion Part 2 - 84 entries

Same class but reverse!

Chinese Multiplication Table - 70 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.

Sort yaml structures alphabetically by root key names - 26 entries

sometimes we want to sort structures alphabetically in yaml files

Lower cased and dashed strings - 46 entries

As I have to generate big fixtures files, I wanted to find a way to format input data the way described by start and end files. Especially the lower-cased-and-dashed ids Not so good to find a pure Vim way, that's why I submit this challenge ;)

SFD-ROC: ROT13 Phonics - 71 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.

Complete the circuit grid! - 72 entries

Continuing from the last challenge, add additional rows to the grid. Change each of the names from 'A1'...'A10' to 'B1'...'B10', 'C1'...'C10', etc, and for each new row add 0.7 to the X values in the (X Y) at the end of each line.

Make the circuit grid! - 72 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.

Lookahead and Lookbehind - 65 entries

Look everywhere

JSON string rotation - 51 entries

Right value strings are misplaced. Just rotate them! I'm too kind with you guys and didn't included "strings with \" in it"!

Permutations N=4 - 60 entries

Could use backtracking or other algorithm to generate sorted numbers. Second chance !

Transposition - 67 entries

Transpose the original lines in separate columns, one for each line.

Five Pillars - 56 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

mp3 - Cutlist - 25 entries

An audio CD was accidentally ripped into one single mp3 file. A dummy cue-file now needs to be filled out with the correct values to get single mp3 files.

Flip the chessboard - 66 entries

White's turn is over. Flip the board to black's perspective. I added coordinates to frustrate you.

Dumb to smart - 81 entries

Turn dumb quote to smart vim's way.

C# function to F# - 4 entries

Converting from C# to F# is not hard, but requires some manual labor. Here you should convert a C# function using a C# class to a F# function using a C# class.

SFD-ROC: ASCII Logo Border - 66 entries

Draw a border around this familiar logo ;)

Harder than "abcd > a b c d" - 64 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.)

Hanging Indent for Footnotes - 58 entries

Format this footnote (in kramdown syntax) so that it has hanging indent.

Recursive Cowsay - 56 entries

Convert 'cowsay' statement to recursive output

ascii-art diamond - 33 entries

Simple ascii-art diamond. The grid is 40x40.

Here, piggy, piggy... - 75 entries

Youay owknay atwhay otay oday...

Long prime list - filter version - 19 entries

I've used the maximum input/diff/output size allowed by vimgolf to get a list of integers up to 1460 separated by newlines, and your goal is to only keep the lines containing primes. There are 232 of them I hope some of you will golf vimscript itself to create some function to run as a primality check for each line, which is a good exercise if you haven't done much vimscript yet! You're invited to also try copy-pasting and doing other non-smart text manipulation. Even more interesting would be to see a solution that uses text manipulation to do the filtering! Whether you use vimscript, normal-mode primality checks, or text manipulation, as long as the end result is valid, your answer will be valid! Let's see which method does better here. Best of luck!

Circle of Fifths with Sharps - 61 entries

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

Add links to an existing HTML table - 59 entries

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

fib.c cleanup - 58 entries

cleanup the file

Merge blank lines and properly capitalize - 41 entries

Here you need complete 2 tasks: 1. Remove all unwanted continuous blank lines and leave only 1 blank line between paragraphs. 2. Properly capitalize the sentences.

Remove hard line breaks - 41 entries

Text files with Hard breaks are not good for e-readers. We need remove all hard line breaks and have long lines.

Return the cow - 71 entries

This cow is too verbose. Give it a lesson.

Coordinates placeholder - 56 entries

Place coordinates instead of target search.

SQL to YAML - 33 entries

Should be easy with vim, or not?

Greek column realign - 41 entries

Oops one letter is missing! Shift down the second column to insert nu letter. Symbol can be entered using: <C-K>n*

C to VimDict - 41 entries

Convert a C data structure to a Vimscript dictionary.

VimGolf Chatter