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

Rural Post - 4591 entries

Simple challenge to remove all but the post code on each line

  • Best score: 9
  • Best player score: 10
  • Position: #459 / 1120
  • Number of attempts: 5
Add quotes to ansible playbook - 1039 entries

You created an ansible playbook, but forgot to add quotes. Can you fix it?

  • Best score: 8
  • Best player score: 10
  • Position: #250 / 329
  • Number of attempts: 2
Swap values inside brackets - 2545 entries

Easy challenge.

  • Best score: 13
  • Best player score: 16
  • Position: #254 / 591
  • Number of attempts: 1
V to the i - 4848 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1382 / 1907
  • Number of attempts: 1
Applying same text modification in several lines - 2927 entries

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

  • Best score: 12
  • Best player score: 16
  • Position: #595 / 865
  • Number of attempts: 1
Add semicolons - 10932 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Position: #518 / 3091
  • Number of attempts: 2
Bad Copy Syntax - 2078 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #281 / 540
  • Number of attempts: 1
Split line with dots - 2174 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 22
  • Position: #464 / 638
  • Number of attempts: 1
remove lines containing the word "reader" - 3643 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #203 / 1181
  • Number of attempts: 1
Com(m)a Trouble - 3988 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #403 / 908
  • Number of attempts: 5
Box it - 7997 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 24
  • Position: #873 / 1897
  • Number of attempts: 4
Tables, Functions, Sprocs - 146 entries

In order to load some scripts into my database in the correct order I need to load tables first (t_), then functions (fn_), then stored procedures (sp_). The order of the t_ lines and the order of the sp_ lines should also match. Reorder the lines so they will load correctly.

  • Best score: 10
  • Best player score: 11
  • Position: #26 / 51
  • Number of attempts: 5
multiple cursor alternative - 1556 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: 30
  • Position: #345 / 386
  • Number of attempts: 1
html paragraph to table - 634 entries

reformat html paragraph to table

  • Best score: 48
  • Best player score: 58
  • Position: #65 / 130
  • Number of attempts: 6
Copy three lines - 2909 entries

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

  • Best score: 13
  • Best player score: 22
  • Position: #508 / 644
  • Number of attempts: 1
Extract argument from function - 2392 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #382 / 765
  • Number of attempts: 2
Search and Replace 0 - 5089 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1056 / 1658
  • Number of attempts: 2
Preferably without multi-cursor plugin - 557 entries

Originally asked as question on reddit by kpthunder: https://www.reddit.com/r/vim/comments/9fvsro/what_is_the_most_efficient_way_to_go_about/

  • Best score: 30
  • Best player score: 35
  • Position: #65 / 133
  • Number of attempts: 4
That hyphen - 2624 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 12
  • Position: #483 / 708
  • Number of attempts: 2
comment and uncomment code inline - 1158 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: #209 / 329
  • Number of attempts: 3
Flip the bit - 140 entries

Change the specific 0 to a 1.

  • Best score: 8
  • Best player score: 10
  • Position: #69 / 79
  • Number of attempts: 1
Just the middle - 11572 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 10
  • Position: #3863 / 4240
  • Number of attempts: 1
Un"finnish"ed Work - 126 entries

Replace å by a, ä by a and ö by o.

  • Best score: 14
  • Best player score: 16
  • Position: #53 / 62
  • Number of attempts: 1
Python Hello World! Reformatting - 1015 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 42
  • Position: #131 / 390
  • Number of attempts: 2
For all cases. - 169 entries

In this case... change it! :) Watch the line.

  • Best score: 8
  • Best player score: 8
  • Position: #66 / 109
  • Number of attempts: 1
Remember VimGolf Rules ! - 277 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 8
  • Position: #109 / 147
  • Number of attempts: 2
Missing Library and a Typo - 952 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

  • Best score: 14
  • Best player score: 20
  • Position: #157 / 222
  • Number of attempts: 2
Basic renumbering - 5731 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #947 / 1277
  • Number of attempts: 1
Simple addition - 337 entries

The right side of the equation is already there. We just need the left one now.

  • Best score: 12
  • Best player score: 15
  • Position: #109 / 125
  • Number of attempts: 1
Interactive git rebase changing commands - 189 entries

How to change the action of some commits in git rebase dialog.

  • Best score: 14
  • Best player score: 17
  • Position: #72 / 81
  • Number of attempts: 2
create arrows in a list - 136 entries

Add arrow at same distance

  • Best score: 10
  • Best player score: 11
  • Position: #72 / 79
  • Number of attempts: 2
Nesting SASS - 296 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 15
  • Position: #61 / 100
  • Number of attempts: 2
Add to end of each line... kinda - 344 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

  • Best score: 12
  • Best player score: 12
  • Position: #92 / 177
  • Number of attempts: 1
Vice versa - 7995 entries

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Position: #1388 / 2151
  • Number of attempts: 1
Order and join - 1009 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 11
  • Position: #127 / 263
  • Number of attempts: 2
comments galore - 1079 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 17
  • Position: #409 / 431
  • Number of attempts: 1
Change attribute to getter - 172 entries

Wrap attributes with a getter method.

  • Best score: 24
  • Best player score: 25
  • Position: #46 / 65
  • Number of attempts: 2
Generate a list of numbers - 302 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 15
  • Position: #112 / 142
  • Number of attempts: 4
Python challenge - 203 entries

Change the types of the variables in the list from str to float, while keeping the truncation.

  • Best score: 31
  • Best player score: 40
  • Position: #24 / 49
  • Number of attempts: 5
One to Ten - 2246 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: 22
  • Position: #603 / 684
  • Number of attempts: 2
Around the clock - 212 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

  • Best score: 13
  • Best player score: 14
  • Position: #42 / 79
  • Number of attempts: 1
Join 'em - 254 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #32 / 153
  • Number of attempts: 1
Delete to the end of the current line - 865 entries

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

  • Best score: 5
  • Best player score: 6
  • Position: #331 / 415
  • Number of attempts: 1
change parenthesis - 301 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #34 / 163
  • Number of attempts: 2
Reorder the groups - 1195 entries

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

  • Best score: 14
  • Best player score: 21
  • Position: #181 / 267
  • Number of attempts: 1
convert yml into java pojo field - 873 entries

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

  • Best score: 29
  • Best player score: 39
  • Position: #212 / 231
  • Number of attempts: 1
Swap assigned value - 675 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 12
  • Position: #216 / 260
  • Number of attempts: 2
Mute the second method of this script - 460 entries

prepend a # infront of every line of the second method

  • Best score: 8
  • Best player score: 10
  • Position: #219 / 242
  • Number of attempts: 1
Condensed Cases - 820 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: 19
  • Position: #222 / 251
  • Number of attempts: 1
I forgot quotes - 16176 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2320 / 4216
  • Number of attempts: 1
learn vim in short time - 245 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Position: #109 / 165
  • Number of attempts: 2
Suffix sort - 270 entries

Sort from the end of the line, as if the letters in each line were reversed.

  • Best score: 19
  • Best player score: 31
  • Position: #62 / 67
  • Number of attempts: 1
Change name of a variable - 180 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Position: #111 / 138
  • Number of attempts: 1
Gray area - 754 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 13
  • Position: #183 / 273
  • Number of attempts: 1
Where should I put the Newline? - 889 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #395 / 442
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10743 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2475 / 3710
  • Number of attempts: 2
Letter case trickery - 1650 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 12
  • Position: #360 / 521
  • Number of attempts: 1
quotes inside quotes - 3191 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: 22
  • Position: #1040 / 1088
  • Number of attempts: 1
Words in parens - 13024 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 21
  • Position: #3518 / 3983
  • Number of attempts: 1
Enumerate words - 257 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 28
  • Position: #78 / 92
  • Number of attempts: 4
Readable Rubyhash - 274 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: 23
  • Best player score: 27
  • Position: #45 / 97
  • Number of attempts: 5
Santa's naughty / nice list - 104 entries

Christmas is here and Santa hasn't decided who's naughty or nice yet. He's given a list of names to his programmer friend to quickly split the children into naughty and nice. Hint: There's a hidden pattern that might be familiar.

  • Best score: 39
  • Best player score: 57
  • Position: #23 / 28
  • Number of attempts: 1
The Quick Brown Fox Jumps Over The Lazy Vim - 435 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 8
  • Best player score: 11
  • Position: #154 / 195
  • Number of attempts: 2
The name of the game - 679 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #248 / 364
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1624 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 15
  • Position: #415 / 453
  • Number of attempts: 2
Let's play some Ivmgolf - 1141 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #318 / 453
  • Number of attempts: 1
Switch function arguments - 2195 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 13
  • Position: #434 / 678
  • Number of attempts: 1
Append semicolon after expressions - 1067 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #248 / 423
  • Number of attempts: 2
switch variable - 5110 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #963 / 1758
  • Number of attempts: 1
The meaning - 577 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #288 / 364
  • Number of attempts: 1
The holy-grail may help - 392 entries

Can you find it in less than 20 strokes, Arthur?

  • Best score: 16
  • Best player score: 16
  • Position: #149 / 217
  • Number of attempts: 3
Shebangs for all - 2090 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

  • Best score: 11
  • Best player score: 14
  • Position: #243 / 529
  • Number of attempts: 3
A Simple One - 1071 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #495 / 674
  • Number of attempts: 1
Reverse Simple Deletion - 862 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #347 / 463
  • Number of attempts: 2
Hatsuyume - 557 entries

http://en.wikipedia.org/wiki/Hatsuyume

  • Best score: 15
  • Best player score: 21
  • Position: #40 / 192
  • Number of attempts: 1
The Cake is a Lie - 1390 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 10
  • Position: #392 / 539
  • Number of attempts: 1
Fix the Haiku - 320 entries

Change this slightly scrambled haiku to its unscrambled form and fix the capitalisation and punctuation along the way.

  • Best score: 28
  • Best player score: 45
  • Position: #82 / 115
  • Number of attempts: 1
Context insensitive completion 0 - 596 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: 10
  • Position: #235 / 252
  • Number of attempts: 1
Make Fancy Header - 1080 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #208 / 352
  • Number of attempts: 2
Reformat a C golf submission - 631 entries

Take this C golf submission (for the "tiny but standards-compliant Hello World program" category, naturally), and turn it into formatted C code.

  • Best score: 22
  • Best player score: 34
  • Position: #141 / 215
  • Number of attempts: 2
Change the content of a string - 1761 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 27
  • Position: #528 / 645
  • Number of attempts: 2
Sort and add attributes - 1561 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 33
  • Position: #220 / 604
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 7564 entries

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

  • Best score: 7
  • Best player score: 43
  • Position: #1103 / 1865
  • Number of attempts: 1
albalitz
Twitter:

entered into 83 challenges

contributed 0 challenges