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

switch variable - 4806 entries

how fast can you switch two variable ?

Increment each number - 874 entries

Increment each number individually by one

-a-b-c- - 3008 entries

Put hyphens everywhere.

attr_aligner - 3282 entries

Two attr keywords. Two separate indentations. Align the colons.

Search and Replace 0 - 4479 entries

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

Split line with dots - 2049 entries

This line is too long, split it.

Put the months in order - 817 entries

Our contractor thought that months should be in alphabetical order. Put them in calendar order please.

Alphabet soup - 228 entries

Create a column of all alphabet characters organized in a funky way

multiple cursor alternative - 1375 entries


Cool or not? - 698 entries

abc trying to be cool or not...

quotes inside quotes - 2973 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 :)

That hyphen - 2411 entries

"vim vi improved"

Two pairs of cluster of letters creates word - 661 entries

Clean and group.

Delete to the end of the current line - 692 entries

Delete to the end of the current line, but keep the character under the cursor.

Extend shell script - 29 entries

Just add some more stuff

From argument to object - 1232 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?

html paragraph to table - 551 entries

reformat html paragraph to table

convert yml into java pojo field - 784 entries

How fast vim can create fields for java pojo i.e class declaration referring to a (simple) yml file

Extract argument from function - 2146 entries

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

replacing each line of a block selection - 2706 entries

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

Capitalize the Names - 149 entries

I want to capitalize the names in quotes, but just the people's names, not the file names.

Data reformat - 132 entries

Reformat this copy-paste data! #csv

Change part of a function name in multiple occurrences - 568 entries

Change the middle part of the function name in multiple places, preferably using the next and dot commands.

Don't know what this is - 1884 entries

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

Whitespace, empty lines and tabs - 2733 entries

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

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

Vertical Limit - 2264 entries

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

Python: Def to Lambda - 84 entries


Space out the alphabet - 1482 entries

Put 3 spaces between adjacent letters.

Turn the x - 83 entries

Turn the x to a +

Adam's challenge - 889 entries

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

Saving the hashes(#) - 1876 entries

The following file is copied from 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.

Missing Library and a Typo - 784 entries

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

Switch function arguments - 1899 entries

How to switch two arguments of a function.

move titles next to url, in quotes - 406 entries

had trouble with something similar

Refactor typescript arrow function type - 216 entries

Make arrow function type less verbose and easier to read

Align commas - 957 entries

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

Fiddle percentages into real numbers - 765 entries

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

Letter case trickery - 1481 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 - 1818 entries

Insert blank lines to make it more organized and readable

Order and join - 813 entries

There's something special about the input order.

ASCII-art Histogram - 239 entries

Create an ASCCI-art histogram for the given numbers. Make sure not to leave trailing whitespaces. Thanks to VimGolf I recently discovered a feature of Vim thAT blew my mind. I'm curious to see what real ninjas make of it ;-)

comments galore - 930 entries

Basic comment reformatting

Numbering a List - 1766 entries

Pretty simple, number the list.

SFD-ROC: vimvimvim - 1412 entries

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

Make HTML List - 924 entries

Turn the comma separated list into an unordered html list.

Shebangs for all - 1690 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.

Preferably without multi-cursor plugin - 368 entries

Originally asked as question on reddit by kpthunder:

Learn some german verbs - 440 entries

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

Do you demand a shrubbery? - 1056 entries

Use :redir and crush the emacsgolfers.

VimGolf Chatter