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]

22918 active golfers, 242005 entries, 397 challenges

Open VimGolf challenges

abcd > a b c d - 237 entries

transform the single spaces into 4 spaces repeat for each line

Shift down - 162 entries

Number words are back.

Wget failed to download redirections - 153 entries

Output of a wget session, where 302 where not properly handled due to certificate problems, has been saved to a file. Keep the correct URLs to start again downloading.

Reformat long lines - 308 entries

Rearrange this ruby method call to put each parameter on its own line. Could become a useful macro.

Extract HTML option values from tag values - 73 entries

Generate HTML option values from the text in the option tag. If the text contains multiple words, replace the spaces with an underscore and convert all capital letters to small letters.

remove all lines in first part - 141 entries

From the second part, remove all lines in the first part. It can be useful when you have done something from a long list, you want to know what is not done yet!

Get rid of html tags - 303 entries

Want to read more about Vim's background? Then get rid of those html tags...

Suffix sort - 163 entries

Sort from the end of the line, as if the letters in each line were reversed.

Readable Rubyhash - 227 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

Format java properties - 63 entries

Format java properties to a different format. The value which is the string following the first '=' cannot & should not change. All periods in the key get replaced with an underscore "_" and get a prefix of "b_".

The holy-grail may help - 295 entries

Can you find it in less than 20 strokes, Arthur?

Create Leading Zeros - 192 entries

Create leading zeros only for id columns. Please use generic approach!

Enumerate words - 219 entries

Enumerate the unique words in order.

Change your calendar - 217 entries

Happy New Year!

Number an outline - 199 entries

The indent and words are right, but the numbers are all wrong.

Sorting a glossary - 99 entries

Sort a glossary. Glossary head contains a header phrase ending with ':' and glossary body has multi line text indented with a tab.

increment by column in XML - 138 entries

modify an arbitrary "column" in an xml table by incrementing a an arbitrary placeholder string

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!

Alphabetize the directory - 252 entries

Put the contacts and their information in alphabetical order.

Compile C - 275 entries

You might have to get clever to do this one.

Deleting folded text - 274 entries

The text below contains three folds. Delete them (and the text inside them). For example: 123 456 /*{{{*/ 789 /*}}}*/ 012 Should become: 123 012 Also, add `aoeuaoeu` to make sure small solutions don't get flagged as cheating.

Subtraction - 147 entries

Solve the equations.

Interleave lines - 125 entries

This is some kind of « paste -d'\n' c b a ». There are many ways to achieve this.. just find the shortest!

Back to the roots - 34 entries

Johnny has a file with more integers. He wants to change each number with its square root. Can you help him?

Word frequency alignment - 195 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

Prime Numbers - 261 entries

List the first 100 prime numbers.

Change name of a variable - 143 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

Top X - 177 entries

The End File is the Top 10 Vimgolf Leaderboard at June 29, 2013. This is a second version, with a great contribution of @udioica. X is ten in Roman,a numeric system in ancient Rome

Pretty format for variable declarations - 128 entries

Project standards demand the equal signs must be aligned for better readability.

Fix the Haiku - 246 entries

Change this slightly scrambled haiku to its unscrambled form and fix the capitalisation and punctuation along the way.

Python to Ruby - 188 entries

Convert this Python code to Ruby. NOTE: This program likely won't run.

expand a list comprehension (python) - 240 entries

Please show your way to convert a list comprehension in python to an ordinary for-loop expression!

Round Round - 237 entries

Round Round

Hidden Message - 43 entries

Find the hidden message and replace all other characters with spaces.

82 bottles of beer on the wall - 235 entries

Take them down. (sorry, only 82 bottles because the problem size is limited!)

Manual SQL - 92 entries

Change select and insert queries to simulate inserting a new record.

Recursively Palindrome - 221 entries

Note that there are 2^6-1 characters.

Cleanining up 80 column concatenated text - 183 entries

1. Put the whole query on one line, remove the concatenation operators 2. Remove the double spaces that appear a few times in the query 3. Use string-interpolated variable statementPid rather than the ugly concatenation

Parsing with CSV: Unify lines and result. - 162 entries

col1;col2;col3;col4 A;1;4;5 A;3;4; A;1;4; # New output: col1;col2;col3;col4 A;1(2x);3;4(3x);5 any ideas?

Test everything! - 111 entries

... and build the desired input data structure. Transform a list of values into a non-trivial format.

NBCU Weekly Challenge - #0 - 118 entries

One of our favorites lines here at NBCU! p.s. The first version of #0 was deleted due to me copy/pasting a HTML entity. Congrats to the one who figured that out, you are a true ninja warrior!

Fun With The Diagonal - 75 entries

change the lowercase characters on the main diagonal to uppercase

Winning streak - 105 entries

Make the number on each line equal the consecutive L's or W's.

Sort the cardinal numbers - 208 entries

Maybe a simple challenge.

Java Array2List - 210 entries

Convert an java array initializer into a list.

42-header - 28 entries

Rush 42mexican-standoff at 42 school

Refactor arguments into object argument - 156 entries

A relatively common Javascript refactoring.

Assign list - 145 entries

Assign list elements to matrix

Shuffle and Sort - 171 entries

The values where sorted incorrectly. Get them back to how they are supposed to be

Block Fun 1 - 158 entries

Manipulate the columns to produce desired result.

VimGolf Chatter