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]

27398 active golfers, 319875 entries, 469 challenges

Open VimGolf challenges

prepend * to every non-blank line - 1082 entries

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

Add semicolons - 6751 entries

Simply add a semicolon at the end of each line

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

Box it - 5484 entries

Create a box around a line.

One number per line - 15549 entries

Just give me the numbers.

Quote modules - 427 entries

Complete golang import statement.

I forgot quotes - 13714 entries

Oops.

Aliases for cd - 399 entries

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

Line under headers - 1208 entries

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

Bad Copy Syntax - 1483 entries

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

remove lines containing the word "reader" - 2586 entries

easy stuff

Hogwarts Email Sorting - 364 entries

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

Just the middle - 10094 entries

Delete the instructions at the top and bottom.

Words in parens - 11792 entries

We should all ace this, right?

Com(m)a Trouble - 2530 entries

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

A HAPPY NEW YEAR 2014 ! - 9961 entries

A HAPPY NEW YEAR 2014 !

Applying same text modification in several lines - 2281 entries

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

Vice versa - 6664 entries

Little role switching.

One to Ten - 1632 entries

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

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

Swap values inside brackets - 2043 entries

Easy challenge.

Simple text editing with Vim - 10896 entries

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

Reorder the groups - 865 entries

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

Add string initializers to an enum - 568 entries

Change Typescript enum so that it has string initializers.

ninja substitution - 948 entries

How can you reuse a previous substitution ?

Swap values - 4015 entries

Well, swap the values...

Basic renumbering - 5014 entries

Renumbering Basic.

Unsemantic linewrapping - 565 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:

Collect List - 3789 entries

Convert to comma separated list.

V to the i - 4251 entries

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

Array transposition - 1849 entries

Transpose two arrays into one.

Team names - 1597 entries

The team names are misspelled.

Every other line - 2375 entries

AaAaAaA

Add text at some column - 93 entries

Complete golang struct statement.

Copy three lines - 2368 entries

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

add line and index - 43 entries

a missed line and index names need to be added

Reformat/Refactor a Golfer Class - 5627 entries

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

Increment each number - 664 entries

Increment each number individually by one

Cool or not? - 615 entries

abc trying to be cool or not...

Put the months in order - 705 entries

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

Two pairs of cluster of letters creates word - 584 entries

Clean and group.

Quote modules (ver.2) - 82 entries

Complete golang import statement.

switch variable - 4541 entries

how fast can you switch two variable ?

html paragraph to table - 496 entries

reformat html paragraph to table

Split line with dots - 1981 entries

This line is too long, split it.

Delete to the end of the current line - 619 entries

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

-a-b-c- - 2813 entries

Put hyphens everywhere.

multiple cursor alternative - 1296 entries

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

attr_aligner - 3194 entries

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

Refactor typescript arrow function type - 172 entries

Make arrow function type less verbose and easier to read

VimGolf Chatter