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 - 1333 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #9 / 372
  • Number of attempts: 2
xrandr outputs and dashes - 591 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 / 193
  • Number of attempts: 2
Yo To Hello - 1051 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #84 / 483
  • Number of attempts: 2
Replace pattern with 1, 2, 3, ... on each line - 1037 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: #58 / 209
  • Number of attempts: 2
Simple, Practical, and Common - 32962 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: #3309 / 7276
  • Number of attempts: 10
Hogwarts Email Sorting - 831 entries

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

  • Best score: 20
  • Best player score: 22
  • Position: #127 / 238
  • Number of attempts: 2
Get mail address from outlook format - 596 entries

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

  • Best score: 15
  • Best player score: 19
  • Position: #131 / 184
  • Number of attempts: 1
Add text at some column - 146 entries

Complete golang struct statement.

  • Best score: 31
  • Best player score: 32
  • Position: #28 / 55
  • Number of attempts: 4
Swap values - 4440 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 15
  • Position: #936 / 1241
  • Number of attempts: 1
prepend * to every non-blank line - 5977 entries

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

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

Just give me the numbers.

  • Best score: 14
  • Best player score: 19
  • Position: #1924 / 3793
  • Number of attempts: 3
Quote modules - 1019 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 28
  • Position: #170 / 260
  • Number of attempts: 1
Quote modules (ver.2) - 195 entries

Complete golang import statement.

  • Best score: 22
  • Best player score: 24
  • Position: #25 / 51
  • Number of attempts: 3
Swap values inside brackets - 2433 entries

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #196 / 561
  • Number of attempts: 2
V to the i - 4641 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1419 / 1857
  • Number of attempts: 1
Applying same text modification in several lines - 2751 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #209 / 815
  • Number of attempts: 1
Add string initializers to an enum - 774 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #82 / 228
  • Number of attempts: 2
Swap the operands under comparison - 258 entries

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

  • Best score: 19
  • Best player score: 21
  • Position: #44 / 93
  • Number of attempts: 2
Add semicolons - 10545 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1306 / 2989
  • Number of attempts: 3
Bad Copy Syntax - 1938 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #241 / 493
  • Number of attempts: 5
Split line with dots - 2103 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 16
  • Position: #233 / 623
  • Number of attempts: 2
remove lines containing the word "reader" - 3454 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #724 / 1121
  • Number of attempts: 1
Com(m)a Trouble - 3410 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #392 / 764
  • Number of attempts: 4
Box it - 7682 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 27
  • Position: #1141 / 1836
  • Number of attempts: 2
multiple cursor alternative - 1447 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: #213 / 369
  • Number of attempts: 2
From argument to object - 1262 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: #235 / 417
  • Number of attempts: 1
Two pairs of cluster of letters creates word - 711 entries

Clean and group.

  • Best score: 17
  • Best player score: 24
  • Position: #132 / 167
  • Number of attempts: 1
Copy three lines - 2801 entries

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

  • Best score: 13
  • Best player score: 17
  • Position: #286 / 625
  • Number of attempts: 1
Extract argument from function - 2218 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #247 / 729
  • Number of attempts: 2
comment and uncomment code inline - 995 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: #196 / 296
  • Number of attempts: 3
Just the middle - 11141 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #2991 / 4114
  • Number of attempts: 2
Team names - 1780 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 24
  • Position: #532 / 571
  • Number of attempts: 1
Interweave two blocks of text - 584 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: #176 / 205
  • Number of attempts: 1
Combines all items - 271 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 / 123
  • Number of attempts: 2
ninja substitution - 1302 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 14
  • Position: #60 / 248
  • Number of attempts: 4
One to Ten - 2095 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 / 642
  • Number of attempts: 3
Change part of a function name in multiple occurrences - 604 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: #112 / 192
  • Number of attempts: 6
Line under headers - 1918 entries

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

  • Best score: 24
  • Best player score: 27
  • Position: #151 / 472
  • Number of attempts: 6
Delete to the end of the current line - 713 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 / 349
  • Number of attempts: 2
Remove quotes after first field - 322 entries

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

  • Best score: 16
  • Best player score: 21
  • Position: #45 / 80
  • Number of attempts: 4
From A to B - 556 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 18
  • Position: #103 / 153
  • Number of attempts: 2
Collect List - 4184 entries

Convert to comma separated list.

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

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 15
  • Position: #71 / 267
  • Number of attempts: 4
Condensed Cases - 758 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: #141 / 231
  • Number of attempts: 3
I forgot quotes - 15748 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1909 / 4116
  • Number of attempts: 2
-a-b-c- - 3118 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #709 / 1112
  • Number of attempts: 2
Gray area - 702 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 13
  • Position: #177 / 260
  • Number of attempts: 2
Don't know what this is - 1951 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: #266 / 572
  • Number of attempts: 4
Where should I put the Newline? - 845 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #394 / 422
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10538 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2413 / 3638
  • Number of attempts: 1
quotes inside quotes - 3030 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 / 1045
  • Number of attempts: 3
Words in parens - 12736 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1773 / 3919
  • Number of attempts: 5
A simple change - 401 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #137 / 177
  • Number of attempts: 2
Saving the hashes(#) - 1966 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: #186 / 467
  • Number of attempts: 5
Let's play some Ivmgolf - 1015 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #309 / 420
  • Number of attempts: 1
citizen_hacks_2019_challenge1 - 38 entries

For the Citizen Hacks 2019 Vim competition

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

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

  • Best score: 21
  • Best player score: 26
  • Position: #475 / 719
  • Number of attempts: 3
replacing each line of a block selection - 2816 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #276 / 736
  • Number of attempts: 2
Append semicolon after expressions - 958 entries

Some lines need the semicolon, some don't.

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

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

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

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #958 / 1708
  • Number of attempts: 1
Ruby 1.9 hashes - 1172 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: #175 / 386
  • Number of attempts: 2
Ruby 1.9 compat - 597 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: #113 / 226
  • Number of attempts: 2
Context insensitive completion 0 - 474 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: 7
  • Best player score: 7
  • Position: #102 / 223
  • Number of attempts: 3
Simple text editing with Vim - 11657 entries

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

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

entered into 65 challenges

contributed 0 challenges