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]

28192 active golfers, 331538 entries, 479 challenges

Open VimGolf challenges

html paragraph to table - 547 entries

reformat html paragraph to table

attr_aligner - 3237 entries

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

Delete to the end of the current line - 673 entries

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

multiple cursor alternative - 1333 entries


Search and Replace 0 - 4434 entries

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

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

convert yml into java pojo field - 775 entries

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

That hyphen - 2376 entries

"vim vi improved"

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

Refactor typescript arrow function type - 212 entries

Make arrow function type less verbose and easier to read

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

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

Extract argument from function - 2127 entries

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

Quote modules (ver.2) - 112 entries

Complete golang import statement.

Add text at some column - 111 entries

Complete golang struct statement.

replacing each line of a block selection - 2682 entries

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

Don't know what this is - 1867 entries

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

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

move titles next to url, in quotes - 404 entries

had trouble with something similar

ASCII-art Histogram - 230 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 ;-)

Adam's challenge - 884 entries

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

Whitespace, empty lines and tabs - 2715 entries

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

Vertical Limit - 2230 entries

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

Right Align Part of the line - 35 entries

The challenge is to right align a part of the line - this is useful in some SQL queries where it's more clear which are the fields displayed

Space out the alphabet - 1463 entries

Put 3 spaces between adjacent letters.

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.

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.

calculations - 186 entries

Complete these (weird) calculations.

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

change parenthesis - 218 entries

change the pair of braces into a pair of parentheses

Fiddle percentages into real numbers - 761 entries

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

Switch function arguments - 1878 entries

How to switch two arguments of a function.

Song Transcription Oops - 192 entries

When transcribing vocal music to Canjo Tab you can start by finding the lowest note and assigning that to zero and working your way up from there. However, without fail, I tend to miscount the notes and when I am near done I find a lower note. I mark this with a "z". This means I have to increase all the previous ones by 1. just a sting of numbers :)

Align commas - 929 entries

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

Order and join - 796 entries

There's something special about the input order.

Remove quotes after first field - 212 entries

Remove the quotes around each field except for the first field.

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

Preferably without multi-cursor plugin - 364 entries

Originally asked as question on reddit by kpthunder:

Make it more readable - 1797 entries

Insert blank lines to make it more organized and readable

comments galore - 916 entries

Basic comment reformatting

Extract wireshark capture filter - 150 entries

Extract wireshark capture filter from IP plan

Build a six - 254 entries

Just enjoy building "a" floors...

Join 'em - 191 entries

This shouldn't be too tough

Learn some german verbs - 417 entries

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

Numbering a List - 1760 entries

Pretty simple, number the list.

citizen_hacks_2019_challenge2 - 140 entries

For the Citizen Hacks 2019 Vim competition.

Make HTML List - 917 entries

Turn the comma separated list into an unordered html list.

add line and index - 45 entries

a missed line and index names need to be added

Scrambled numbers - 753 entries

Four is NOT 1. One is 1.

Triangle of arrows - 61 entries

I made this by accident when working on another challenge. How would you go about making this?

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

VimGolf Chatter