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]

28563 active golfers, 338210 entries, 482 challenges

Open VimGolf challenges

prepend * to every non-blank line - 3447 entries

Prepend an asterisk to every non-blank line in the input file.

Add semicolons - 8274 entries

Simply add a semicolon at the end of each line

Simple, Practical, and Common - 30428 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.

Multiline to Single Line - 46 entries

Convert a multiline, indented file to a single line with no whitespace

Box it - 6387 entries

Create a box around a line.

One number per line - 16694 entries

Just give me the numbers.

xrandr outputs and dashes - 271 entries

uh oh, different video drivers identify display outputs with more dashes. Quick, need to change this xrandr script!

Yo To Hello - 413 entries

Simply Turn Yo To Hello

From a Thunderlink to a Markdown link - 328 entries

ThunderLinks are durable hyperlinks to specific email messages generated from Thunderbird in HTML format. Leverage the power of vim to make them suitable for a markdown-formatted file.

Replace pattern with 1, 2, 3, ... on each line - 418 entries

For each line replace a search pattern (in this case $) with numbers starting at 1 and then increasing by 1 for each replaced match. a$b$c$ -> a0b1c2

I forgot quotes - 14512 entries

Oops.

remove lines containing the word "reader" - 2950 entries

easy stuff

Just the middle - 10464 entries

Delete the instructions at the top and bottom.

Line under headers - 1498 entries

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

Data reformat - 114 entries

Reformat this copy-paste data! #csv

Words in parens - 12094 entries

We should all ace this, right?

Bad Copy Syntax - 1635 entries

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

Quote modules - 687 entries

Complete golang import statement.

Com(m)a Trouble - 2834 entries

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

A HAPPY NEW YEAR 2014 ! - 10151 entries

A HAPPY NEW YEAR 2014 !

Get mail address from outlook format - 378 entries

Create a mail list space separated of mail list formatted by outlook

Vice versa - 6936 entries

Little role switching.

Applying same text modification in several lines - 2463 entries

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

Aliases for cd - 548 entries

Create these beautiful aliases with as few strokes as possible. Are you up for the challenge?

One to Ten - 1748 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

Hogwarts Email Sorting - 561 entries

Given a list of emails, get the students full name and their associated house.

Simple text editing with Vim - 11067 entries

Make the pairs of lines match up by making each second line same as first

Swap values inside brackets - 2165 entries

Easy challenge.

Capitalize the Names - 125 entries

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

SCREAMING_SNAKE_CASE to Title Case - 845 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

Alphabet soup - 157 entries

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

Swap values - 4199 entries

Well, swap the values...

Basic renumbering - 5165 entries

Renumbering Basic.

Reorder the groups - 922 entries

Change the order so that the groups of fruit come before the vegetables.

ninja substitution - 1017 entries

How can you reuse a previous substitution ?

Collect List - 3932 entries

Convert to comma separated list.

Add string initializers to an enum - 631 entries

Change Typescript enum so that it has string initializers.

V to the i - 4380 entries

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

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:

Array transposition - 1995 entries

Transpose two arrays into one.

Every other line - 2525 entries

AaAaAaA

Team names - 1637 entries

The team names are misspelled.

Copy three lines - 2483 entries

If the site is up (by some miracle), make the text under every header identical.

Reformat/Refactor a Golfer Class - 5694 entries

A simple case of removing unneeded code and fixing broken indentation.

switch variable - 4665 entries

how fast can you switch two variable ?

Increment each number - 767 entries

Increment each number individually by one

Put the months in order - 764 entries

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

Cool or not? - 673 entries

abc trying to be cool or not...

-a-b-c- - 2902 entries

Put hyphens everywhere.

Two pairs of cluster of letters creates word - 644 entries

Clean and group.

VimGolf Chatter