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]

25093 active golfers, 278571 entries, 436 challenges

Open VimGolf challenges

Build a six - 204 entries

Just enjoy building "a" floors...

That hyphen - 2183 entries

"vim vi improved"

Hash staircase - 25 entries

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

Extract argument from function - 2000 entries

The aim is to see if you can do some refactoring very fast.

comment and uncomment code inline - 797 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.

Adam's challenge - 776 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

Convert Application Output to CSV - 118 entries

Change the application output to comma-separated values

Don't know what this is - 1737 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

Resort and deup a CSV list - 98 entries

I'm always adding items to a sorted list. There has to be a better way dedup and resort the lists. There are multiple lists with varying lengths to discourage manual sorting. Also Australia's animals are weird.

Preferably without multi-cursor plugin - 285 entries

Originally asked as question on reddit by kpthunder: https://www.reddit.com/r/vim/comments/9fvsro/what_is_the_most_efficient_way_to_go_about/

replacing each line of a block selection - 2513 entries

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

Simple format (2) - 224 entries

try again!

Missing Library and a Typo - 680 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

If-then-else regexp - 36 entries

Rules: - golf is never following golf - vim comes first! Drawing a finite-state machine diagram could help. #regexp

Space out the alphabet - 1363 entries

Put 3 spaces between adjacent letters.

Fiddle percentages into real numbers - 717 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

Vertical Limit - 2111 entries

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

Whitespace, empty lines and tabs - 2541 entries

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

Learn some german verbs - 384 entries

The list needs to be structured so we can print in verbatim and feel ok about how it looks.

Order and join - 748 entries

There's something special about the input order.

Saving the hashes(#) - 1740 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.

Switch function arguments - 1835 entries

How to switch two arguments of a function.

Align commas - 833 entries

There are 15,000 aligning challenges on vimgolf.com, and they're all exactly the same. I hope this one is a little different.

comments galore - 905 entries

Basic comment reformatting

Letter case trickery - 1433 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.

Make it more readable - 1755 entries

Insert blank lines to make it more organized and readable

Swap the operands under comparison - 218 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

Make HTML List - 886 entries

Turn the comma separated list into an unordered html list.

Scrambled numbers - 724 entries

Four is NOT 1. One is 1.

C Reformatting - 638 entries

You may use Visual mode... or not. #uppercase

Number Sort - 240 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

Numbering a List - 1728 entries

Pretty simple, number the list.

Do you demand a shrubbery? - 1016 entries

Use :redir and crush the emacsgolfers.

Fix the XML - 866 entries

The challenge consists in having a valid xml from an incomplete source.

Rule 110 - 23 entries

Compute the next 5 iterations of Rule 110 with the given starting state. https://en.wikipedia.org/wiki/Rule_110

SFD-ROC: vimvimvim - 1291 entries

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

Shebangs for all - 1593 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

Mess in revision history - 976 entries

Help Joe clean up what Steve has cobbled.

Flip the bit - 75 entries

Change the specific 0 to a 1.

Letterbox - 70 entries

Make a box!

Count both ways - 864 entries

Right AND down.

unknown command - 110 entries

I want change 5 words

Mirror Symmetry - 699 entries

Add backslashes.

Python challenge - 95 entries

Change the types of the variables in the list from str to float, while keeping the truncation.

Array Transposition - 140 entries

Transpose four arrays into two.

camel riding - 686 entries

add a prefix on some camelCase variables

remove dupes from array - 1195 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

Where should I put the Newline? - 796 entries

Help me put the newline.

Hole-in-one - 935 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.

Triangular Numbers - 48 entries

Generate the first 50 triangular numbers.

VimGolf Chatter