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]

Played Challenges

VimGolfNight - 471 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 5
Extract argument from function - 2134 entries

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

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 9
Combines all items - 255 entries

For each line that starts with the same number I want to combine its contents

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
change parenthesis - 219 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Join 'em - 192 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Number of attempts: 2
comments galore - 924 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 4
Order and join - 811 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 6
Array propagate - 264 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 23
  • Number of attempts: 9
Change part of a function name in multiple occurrences - 558 entries

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

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 10
Collect List - 3926 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 7
Sort and add attributes - 1113 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 33
  • Number of attempts: 3
Generate a list of numbers - 259 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 3
From A to B - 530 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 8
Delete to the end of the current line - 677 entries

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

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 2
Line under headers - 1463 entries

Put a line under each header, and remove the other markdown formatting.

  • Best score: 25
  • Best player score: 26
  • Number of attempts: 4
V to the i - 4374 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 8
citizen_hacks_2019_challenge4 - 62 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
remove lines containing the word "reader" - 2926 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10144 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 6
citizen_hacks_2019_challenge1 - 28 entries

For the Citizen Hacks 2019 Vim competition

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Line Zipper - 402 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 3
Unwrap the text of an email message - 154 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 8
comment and uncomment code inline - 945 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.

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 5
Let's play some Ivmgolf - 975 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 10
Don't know what this is - 1872 entries

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

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 10
Just the middle - 10444 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 5
Stairstep digits - 227 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 13
  • Number of attempts: 2
Applying same text modification in several lines - 2454 entries

Remove identical text at the beginning of several lines and the closing parenthesis.

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 4
That hyphen - 2389 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 8
Append semicolon after expressions - 898 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
Where should I put the Newline? - 830 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 2
Ruby 1.9 hashes - 1111 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!

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 6
Every other line - 2525 entries

AaAaAaA

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 9
Scrambled numbers - 757 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 7
Vertical Limit - 2242 entries

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

  • Best score: 21
  • Best player score: 21
  • Number of attempts: 12
Remove quotes after first field - 217 entries

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

  • Best score: 16
  • Best player score: 20
  • Number of attempts: 4
convert yml into java pojo field - 781 entries

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

  • Best score: 29
  • Best player score: 29
  • Number of attempts: 6
Count both ways - 918 entries

Right AND down.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 2
Reformat a C golf submission - 488 entries

Take this C golf submission (for the "tiny but standards-compliant Hello World program" category, naturally), and turn it into formatted C code.

  • Best score: 22
  • Best player score: 25
  • Number of attempts: 5
Fix the XML - 904 entries

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

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 10
Simple, Practical, and Common - 30325 entries

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." This challenge is just a simple movement and entering text at a certain place.

  • Best score: 22
  • Best player score: 22
  • Number of attempts: 6
Com(m)a Trouble - 2800 entries

Someone was real stupid when placing his commas. Can you fix it?

  • Best score: 12
  • Best player score: 15
  • Number of attempts: 6
citizen_hacks_2019_challenge2 - 140 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 1
Condensed Cases - 729 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 3
Preferably without multi-cursor plugin - 368 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/

  • Best score: 30
  • Best player score: 35
  • Number of attempts: 8
-a-b-c- - 2886 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 12
Fiddle percentages into real numbers - 762 entries

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

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 5
Add semicolons - 8181 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 5
Search and Replace 0 - 4444 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 6
Bad Copy Syntax - 1625 entries

Copy should be from right to left, but sometimes you type it wrong.

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 10
Todo list specification - 319 entries

The every item on the todo list must be done today. Modify the list to reflect that.

  • Best score: 37
  • Best player score: 39
  • Number of attempts: 2
Number Sort - 263 entries

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

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 2
Nesting SASS - 240 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 17
  • Number of attempts: 1
Increment each number - 761 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 6
The Cake is a Lie - 1166 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 3
Two pairs of cluster of letters creates word - 644 entries

Clean and group.

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 11
citizen_hacks_2019_challenge6 - 36 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 3
  • Best player score: 3
  • Number of attempts: 1
Unsemantic linewrapping - 636 entries

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

  • Best score: 9
  • Best player score: 10
  • Number of attempts: 6
Change the content of a string - 1267 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Number of attempts: 3
Shebangs for all - 1669 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.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 16
Song Transcription Oops - 197 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 :)

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 5
Box it - 6309 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Number of attempts: 8
Saving the hashes(#) - 1876 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.

  • Best score: 20
  • Best player score: 33
  • Number of attempts: 2
Swap values - 4178 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 5
switch variable - 4663 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 4
Array Transposition - 160 entries

Transpose four arrays into two.

  • Best score: 27
  • Best player score: 46
  • Number of attempts: 1
citizen_hacks_2019_challenge5 - 90 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 2
Python challenge - 124 entries

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

  • Best score: 31
  • Best player score: 64
  • Number of attempts: 2
Paragraph breaks - 431 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 7
Add string initializers to an enum - 628 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 21
  • Number of attempts: 5
remove dupes from array - 1260 entries

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

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 15
One number per line - 16600 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 12
SCREAMING_SNAKE_CASE to Title Case - 831 entries

Convert strings in SCREAMING_SNAKE_CASE to Title Case. Examples: EMPLOYEE_NAME -> Employee Name REVENUE_YEAR_TO_DATE -> Revenue Year To Date SALARY -> Salary

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 5
Assignment Alignment - 722 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 33
  • Number of attempts: 3
Build a six - 256 entries

Just enjoy building "a" floors...

  • Best score: 22
  • Best player score: 22
  • Number of attempts: 4
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.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 8
Space out the alphabet - 1479 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 12
Convert Application Output to CSV - 138 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 9
Do you demand a shrubbery? - 1042 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 32
  • Number of attempts: 2
unknown command - 119 entries

I want change 5 words

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 3
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.

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 9
Tables, Functions, Sprocs - 91 entries

In order to load some scripts into my database in the correct order I need to load tables first (t_), then functions (fn_), then stored procedures (sp_). The order of the t_ lines and the order of the sp_ lines should also match. Reorder the lines so they will load correctly.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 4
Words in parens - 12073 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 5
Align commas - 949 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.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 7
Hatsuyume - 367 entries

http://en.wikipedia.org/wiki/Hatsuyume

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 10
Split line with dots - 2021 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 19
  • Number of attempts: 6
Vice versa - 6926 entries

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 5
learn vim in short time - 195 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Number of attempts: 1
Flip the bit - 86 entries

Change the specific 0 to a 1.

  • Best score: 8
  • Best player score: 10
  • Number of attempts: 2
attr_aligner - 3242 entries

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

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 9
quotes inside quotes - 2944 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 :)

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 4
multiple cursor alternative - 1356 entries

from: https://www.reddit.com/r/vim/comments/6w5pfa/crosspost_from_remacs_how_would_you_do_this_in_vim/

  • Best score: 19
  • Best player score: 20
  • Number of attempts: 6
Gray area - 669 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 3
Lisp Condense - 400 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 4
I forgot quotes - 14483 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 12
Switch function arguments - 1888 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 6
replacing each line of a block selection - 2694 entries

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

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 6
Reverse and count - 382 entries

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

  • Best score: 18
  • Best player score: 33
  • Number of attempts: 1
Melvin Cheung
Twitter:

Handsome boy

entered into 98 challenges

contributed 0 challenges