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]

26401 active golfers, 302119 entries, 461 challenges

Open VimGolf challenges

Fill visual area - 70 entries

Just have fun!

Happy New Year! - 129 entries

This is a simple new year's challenge.

Kolakoski sequence -- level 2 - 10 entries

This time, the line above describes the line below. Level 1 at: http://www.vimgolf.com/challenges/5c880211ab65cb00065c74eb

The Universal Declaration of Human Rights, Article 1 - 128 entries

Somebody's got this slightly muddled up. See how quickly you can fix it. (I made this to experiment with buffers. I'm not actually sure whether this is faster with buffers or without.)

Extract text from xml - 101 entries

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

Word Blender - 128 entries

The insides of long words seem to have been run through the blender. Can you fix this famous tale, brave knight?

Letters are numbers - 127 entries

Letters and numbers are interchangeable. A lot of programming languages give you simple ways to convert individual letters to hex, binary and decimal but does Vim?

Calculate the table totals - 105 entries

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

Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 40 entries

I bumped into this in a dailywtf code: http://pastebin.com/QApa5ycS I didn't want to translate a string whenever I wanted to be [Ss][Aa][Rr][Cc][Aa][Ss][Tt][Ii][Cc] on slack, so I figured a script (python, sed, whatever) would be helpful. Well, or a few vim keystroke!

Ninjas Leaderboard - 84 entries

The two lines in "Start file" has an obfuscated email address. Second line give an index (from 1 to 30) to the chars list of the first line, for example, the first char of email (n) is in position 25, second char (i) is in position 19 and s.o.

Printable ASCII characters - 95 entries

From a blank input, print all 95 printing ASCII characters one per line, from space to tilde.

Rail fence transposition cipher - 63 entries

Solve a rail fence transposition cipher using vim. This ciphertext was created using two rails. Use vim to transpose the text and recover the original quote.

Sudoku table - 56 entries

Make this simple sudoku table look nice and legible.

Sort yaml structures alphabetically by root key names - 26 entries

sometimes we want to sort structures alphabetically in yaml files

SFD-ROC: Pipe Dreams - 93 entries

Move the pipes so they match the output.

Comparing scores - 68 entries

If Alice and Bob both did the challenge, put their entries together in the top paragraph, so we can compare their scores more easily.

Square numbers - 63 entries

Boring math puzzle.

Land of the Lost - 60 entries

Enter the tabs below the lyrics

Format the output - 95 entries

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

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!

Double and switch - 36 entries

Aaaanother case switcher

Replace Parameter with Explicit Methods - 61 entries

Implementing the methods of a Java Interface

citizen_hacks_2019_part3 - 3 entries

For the Citizen Hacks 2019 Vim competition

Linear congruential generator - 104 entries

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

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.

Execute immediate SQL - 77 entries

Sql string tranformation ...

It's a factor - 75 entries

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

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 ;)

Roman numerals - 57 entries

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

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.)

HTML formatting: vertical alignment for readability - 59 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.

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.

Not enough Ps - 49 entries

Different type of code

Before there was Farmville... - 91 entries

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

Create an alphabet diamond - 74 entries

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

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

Same class but reverse!

Lookahead and Lookbehind - 65 entries

Look everywhere

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.

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

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

ascii-art diamond - 32 entries

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

Transposition - 66 entries

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

Flatten repo - 22 entries

For each git repository (<project> tag) translate name attribute to flatten directory structure. Add path attribute if missing (because checkout hierarchy must be kept). #xml

Flip the chessboard - 66 entries

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

Converting group lines from format A to Format B - 20 entries

Convert from one format to another

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.)

SFD-ROC: ASCII Logo Border - 66 entries

Draw a border around this familiar logo ;)

Permutations N=4 - 55 entries

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

VimGolf Chatter