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]

22739 active golfers, 238327 entries, 395 challenges

Open VimGolf challenges

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.

Refactor static member invocation - 163 entries

Someone used a static method. Refactor the method into a static import while fixing the assertion.

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!

Reformat long lines - 308 entries

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

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!

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_".

Suffix sort - 163 entries

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

Get rid of html tags - 303 entries

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

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!

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.

The holy-grail may help - 292 entries

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

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

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?

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!

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

Change your calendar - 189 entries

Happy New Year!

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.

Hidden Message - 43 entries

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

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!

Manual SQL - 92 entries

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

Round Round - 237 entries

Round Round

82 bottles of beer on the wall - 235 entries

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

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

42-header - 28 entries

Rush 42mexican-standoff at 42 school

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!

Winning streak - 105 entries

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

Fun With The Diagonal - 74 entries

change the lowercase characters on the main diagonal to uppercase

Parsing with CSV: Unify lines and result. - 157 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?

Sort yaml structures alphabetically by root key names - 25 entries

sometimes we want to sort structures alphabetically in yaml files

Java Array2List - 210 entries

Convert an java array initializer into a list.

Sort the cardinal numbers - 206 entries

Maybe a simple challenge.

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.

Recursively Palindrome - 204 entries

Note that there are 2^6-1 characters.

Cartesian product - 201 entries

{1,2,3,4,5} X {1,2,3,4,5}

VimGolf Chatter