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]

25316 active golfers, 283754 entries, 438 challenges

Open VimGolf challenges

Add semicolons - 2050 entries

Simply add a semicolon at the end of each line

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

Box it - 3173 entries

Create a box around a line.

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

Bad Copy Syntax - 482 entries

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

simple format - 3066 entries

make it look better.

One number per line - 12988 entries

Just give me the numbers.

remove lines containing the word "reader" - 1720 entries

easy stuff

I forgot quotes - 11947 entries

Oops.

Reorder the groups - 460 entries

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

Song Transcription Oops - 98 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 :)

Applying same text modification in several lines - 1706 entries

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

Just the middle - 9314 entries

Delete the instructions at the top and bottom.

Com(m)a Trouble - 1778 entries

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

One to Ten - 1006 entries

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

Words in parens - 11092 entries

We should all ace this, right?

ninja substitution - 577 entries

How can you reuse a previous substitution ?

A HAPPY NEW YEAR 2014 ! - 9542 entries

A HAPPY NEW YEAR 2014 !

change parenthesis - 138 entries

change the pair of braces into a pair of parentheses

Swap values inside brackets - 1516 entries

Easy challenge.

Vice versa - 5989 entries

Little role switching.

html paragraph to table - 385 entries

reformat html paragraph to table

Simple text editing with Vim - 10457 entries

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

Cool or not? - 486 entries

abc trying to be cool or not...

Two pairs of cluster of letters creates word - 424 entries

Clean and group.

Swap values - 3565 entries

Well, swap the values...

Basic renumbering - 4613 entries

Renumbering Basic.

Increment each number - 490 entries

Increment each number individually by one

Collect List - 3521 entries

Convert to comma separated list.

Team names - 1463 entries

The team names are misspelled.

Delete to the end of the current line - 469 entries

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

Array transposition - 1631 entries

Transpose two arrays into one.

V to the i - 3951 entries

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

Put the months in order - 463 entries

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

Every other line - 2115 entries

AaAaAaA

Join 'em - 136 entries

This shouldn't be too tough

Copy three lines - 2085 entries

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

convert yml into java pojo field - 665 entries

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

Change part of a function name in multiple occurrences - 414 entries

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

Reformat/Refactor a Golfer Class - 5513 entries

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

Remove quotes after first field - 110 entries

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

Around the clock - 119 entries

You'll want to use 2 special commands to complete this. If you haven't yet, read through 'input.txt', especially :help simple-changes

switch variable - 4316 entries

how fast can you switch two variable ?

Split line with dots - 1836 entries

This line is too long, split it.

multiple cursor alternative - 1080 entries

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

-a-b-c- - 2607 entries

Put hyphens everywhere.

move titles next to url, in quotes - 283 entries

had trouble with something similar

attr_aligner - 3024 entries

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

From argument to object - 1110 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

Search and Replace 0 - 4141 entries

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

VimGolf Chatter