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

Inverting Lines - 1870 entries

A simple challenge to invert all lines, except the first.

  • Best score: 10
  • Best player score: 10
  • Position: #9 / 505
  • Number of attempts: 2
xrandr outputs and dashes - 671 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #32 / 218
  • Number of attempts: 2
Yo To Hello - 1127 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #84 / 522
  • Number of attempts: 2
Replace pattern with 1, 2, 3, ... on each line - 1114 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

  • Best score: 21
  • Best player score: 22
  • Position: #62 / 228
  • Number of attempts: 2
Simple, Practical, and Common - 33483 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: 25
  • Position: #3362 / 7384
  • Number of attempts: 10
Hogwarts Email Sorting - 891 entries

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

  • Best score: 20
  • Best player score: 22
  • Position: #138 / 257
  • Number of attempts: 2
Get mail address from outlook format - 642 entries

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

  • Best score: 15
  • Best player score: 19
  • Position: #144 / 202
  • Number of attempts: 1
Add text at some column - 162 entries

Complete golang struct statement.

  • Best score: 31
  • Best player score: 32
  • Position: #32 / 63
  • Number of attempts: 4
Swap values - 4554 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 15
  • Position: #952 / 1259
  • Number of attempts: 1
prepend * to every non-blank line - 6254 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #44 / 1530
  • Number of attempts: 4
One number per line - 18673 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 19
  • Position: #1951 / 3852
  • Number of attempts: 3
Quote modules - 1066 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 28
  • Position: #183 / 278
  • Number of attempts: 1
Quote modules (ver.2) - 225 entries

Complete golang import statement.

  • Best score: 22
  • Best player score: 24
  • Position: #30 / 59
  • Number of attempts: 3
Swap values inside brackets - 2477 entries

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #200 / 573
  • Number of attempts: 2
V to the i - 4771 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1433 / 1887
  • Number of attempts: 1
Applying same text modification in several lines - 2851 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #220 / 843
  • Number of attempts: 1
Add string initializers to an enum - 866 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #89 / 256
  • Number of attempts: 2
Swap the operands under comparison - 274 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

  • Best score: 19
  • Best player score: 21
  • Position: #47 / 99
  • Number of attempts: 2
Add semicolons - 10831 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1333 / 3055
  • Number of attempts: 3
Bad Copy Syntax - 2009 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #254 / 518
  • Number of attempts: 5
Split line with dots - 2131 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 16
  • Position: #235 / 633
  • Number of attempts: 2
remove lines containing the word "reader" - 3556 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #742 / 1151
  • Number of attempts: 1
Com(m)a Trouble - 3711 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #425 / 839
  • Number of attempts: 4
Box it - 7849 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 27
  • Position: #1168 / 1870
  • Number of attempts: 2
multiple cursor alternative - 1488 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: 21
  • Position: #219 / 378
  • Number of attempts: 2
From argument to object - 1481 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?

  • Best score: 17
  • Best player score: 18
  • Position: #258 / 453
  • Number of attempts: 1
Two pairs of cluster of letters creates word - 747 entries

Clean and group.

  • Best score: 17
  • Best player score: 24
  • Position: #141 / 177
  • Number of attempts: 1
Copy three lines - 2869 entries

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

  • Best score: 13
  • Best player score: 17
  • Position: #291 / 639
  • Number of attempts: 1
Extract argument from function - 2337 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #247 / 750
  • Number of attempts: 2
comment and uncomment code inline - 1074 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: 10
  • Position: #206 / 316
  • Number of attempts: 3
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3018 / 4174
  • Number of attempts: 2
Team names - 1812 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 24
  • Position: #544 / 585
  • Number of attempts: 1
Interweave two blocks of text - 641 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

  • Best score: 15
  • Best player score: 21
  • Position: #181 / 212
  • Number of attempts: 1
Combines all items - 307 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #75 / 139
  • Number of attempts: 2
ninja substitution - 1399 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 14
  • Position: #60 / 265
  • Number of attempts: 4
One to Ten - 2174 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #276 / 664
  • Number of attempts: 3
Change part of a function name in multiple occurrences - 648 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: 15
  • Position: #118 / 205
  • Number of attempts: 6
Line under headers - 2023 entries

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

  • Best score: 24
  • Best player score: 27
  • Position: #162 / 498
  • Number of attempts: 6
Delete to the end of the current line - 795 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #211 / 387
  • Number of attempts: 2
Remove quotes after first field - 367 entries

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

  • Best score: 16
  • Best player score: 21
  • Position: #52 / 90
  • Number of attempts: 4
From A to B - 575 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 18
  • Position: #106 / 157
  • Number of attempts: 2
Collect List - 4267 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #465 / 1188
  • Number of attempts: 2
camel riding - 775 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 15
  • Position: #71 / 277
  • Number of attempts: 4
Condensed Cases - 794 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: 14
  • Position: #145 / 244
  • Number of attempts: 3
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1927 / 4166
  • Number of attempts: 2
-a-b-c- - 3183 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #722 / 1132
  • Number of attempts: 2
Gray area - 745 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 13
  • Position: #184 / 270
  • Number of attempts: 2
Don't know what this is - 1996 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: 13
  • Position: #273 / 581
  • Number of attempts: 4
Where should I put the Newline? - 874 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #400 / 436
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2437 / 3677
  • Number of attempts: 1
quotes inside quotes - 3128 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
  • Position: #337 / 1073
  • Number of attempts: 3
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1791 / 3950
  • Number of attempts: 5
A simple change - 444 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 15
  • Position: #147 / 190
  • Number of attempts: 2
Saving the hashes(#) - 2008 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: 25
  • Position: #188 / 476
  • Number of attempts: 5
Let's play some Ivmgolf - 1096 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #321 / 442
  • Number of attempts: 1
citizen_hacks_2019_challenge1 - 50 entries

For the Citizen Hacks 2019 Vim competition

  • Best score: 5
  • Best player score: 5
  • Position: #20 / 44
  • Number of attempts: 1
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 26
  • Position: #491 / 748
  • Number of attempts: 3
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #288 / 772
  • Number of attempts: 2
Append semicolon after expressions - 1023 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #125 / 410
  • Number of attempts: 2
Remove semicolons after expressions - 639 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 6
  • Position: #110 / 261
  • Number of attempts: 3
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #972 / 1742
  • Number of attempts: 1
Ruby 1.9 hashes - 1225 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: 13
  • Position: #180 / 402
  • Number of attempts: 2
Ruby 1.9 compat - 610 entries

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

  • Best score: 14
  • Best player score: 15
  • Position: #116 / 230
  • Number of attempts: 2
Context insensitive completion 0 - 545 entries

Buried in the lines you're not supposed to add is the line "Add this line!" Add that line to the top of the file.

  • Best score: 6
  • Best player score: 7
  • Position: #105 / 239
  • Number of attempts: 3
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1820 / 3626
  • Number of attempts: 2
Ryan Nevius
Twitter:

entered into 65 challenges

contributed 0 challenges