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

Simple, Practical, and Common - 33966 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: 31
  • Position: #5633 / 7501
  • Number of attempts: 2
Swap values - 4701 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 19
  • Position: #1177 / 1290
  • Number of attempts: 2
One number per line - 18889 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 40
  • Position: #3824 / 3898
  • Number of attempts: 2
V to the i - 4853 entries

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

  • Best score: 7
  • Best player score: 9
  • Position: #1722 / 1909
  • Number of attempts: 3
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: 18
  • Position: #673 / 865
  • Number of attempts: 3
Add semicolons - 10932 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 17
  • Position: #2577 / 3091
  • 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: 33
  • Position: #816 / 908
  • Number of attempts: 2
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: 41
  • Position: #369 / 386
  • Number of attempts: 1
Every other line - 2945 entries

AaAaAaA

  • Best score: 12
  • Best player score: 21
  • Position: #642 / 710
  • Number of attempts: 1
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: 26
  • Position: #577 / 644
  • Number of attempts: 2
Search and Replace 0 - 5102 entries

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

  • Best score: 12
  • Best player score: 16
  • Position: #1252 / 1662
  • Number of attempts: 2
Number Sort - 321 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

  • Best score: 9
  • Best player score: 12
  • Position: #167 / 171
  • 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: 27
  • Position: #325 / 329
  • Number of attempts: 2
Flip the bit - 140 entries

Change the specific 0 to a 1.

  • Best score: 8
  • Best player score: 11
  • Position: #77 / 79
  • Number of attempts: 1
Just the middle - 11574 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 11
  • Position: #3981 / 4241
  • Number of attempts: 3
Make HTML List - 1071 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 62
  • Position: #263 / 275
  • 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: #51 / 62
  • Number of attempts: 1
Basic renumbering - 5731 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #938 / 1277
  • Number of attempts: 1
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: 15
  • Position: #170 / 177
  • Number of attempts: 3
Fun With The Diagonal - 110 entries

change the lowercase characters on the main diagonal to uppercase

  • Best score: 11
  • Best player score: 11
  • Position: #58 / 83
  • Number of attempts: 1
Free hyphen! - 191 entries

Just like "Inner hyphens", but I'm giving you a free hyphen to play with. Will your solution be any different?

  • Best score: 9
  • Best player score: 9
  • Position: #19 / 94
  • Number of attempts: 2
Order and join - 1009 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 15
  • Position: #226 / 263
  • Number of attempts: 1
comments galore - 1079 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 21
  • Position: #418 / 431
  • 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: 41
  • Position: #221 / 231
  • Number of attempts: 1
Mirror Symmetry - 830 entries

Add backslashes.

  • Best score: 7
  • Best player score: 14
  • Position: #250 / 270
  • Number of attempts: 1
Collect List - 4332 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 18
  • Position: #1074 / 1196
  • Number of attempts: 4
VimGolfNight - 581 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 27
  • Position: #346 / 353
  • Number of attempts: 2
Not enough Ps - 74 entries

Different type of code

  • Best score: 13
  • Best player score: 21
  • Position: #37 / 38
  • Number of attempts: 1
I forgot quotes - 16176 entries

Oops.

  • Best score: 10
  • Best player score: 23
  • Position: #3923 / 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: #105 / 165
  • Number of attempts: 2
vim1001 - 315 entries

change number 1001 into a "vim1001 sequence". (My first challenge, hope it is not too bad... )

  • Best score: 17
  • Best player score: 32
  • Position: #101 / 111
  • Number of attempts: 2
-a-b-c- - 3233 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 16
  • Position: #853 / 1143
  • Number of attempts: 1
Change name of a variable - 182 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: #107 / 140
  • Number of attempts: 2
Where should I put the Newline? - 896 entries

Help me put the newline.

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

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 14
  • Position: #2849 / 3711
  • Number of attempts: 1
Letter case trickery - 1663 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: 17
  • Position: #481 / 522
  • Number of attempts: 1
quotes inside quotes - 3195 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: 17
  • Position: #922 / 1089
  • Number of attempts: 1
abcd > a b c d - 299 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #170 / 228
  • Number of attempts: 1
lamb had a little Mary - 641 entries

"Mary" and "lamb" are swapped. Unswap them. Fast as you can.

  • Best score: 16
  • Best player score: 42
  • Position: #148 / 177
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1628 entries

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

  • Best score: 8
  • Best player score: 14
  • Position: #380 / 454
  • Number of attempts: 2
Vertical Limit - 2624 entries

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

  • Best score: 21
  • Best player score: 27
  • Position: #565 / 774
  • Number of attempts: 2
replacing each line of a block selection - 3040 entries

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

  • Best score: 18
  • Best player score: 30
  • Position: #668 / 785
  • Number of attempts: 2
Append semicolon after expressions - 1067 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 24
  • Position: #420 / 423
  • Number of attempts: 1
Reverse and double space - 502 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 35
  • Position: #196 / 200
  • Number of attempts: 1
Remove semicolons after expressions - 671 entries

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

  • Best score: 6
  • Best player score: 10
  • Position: #253 / 266
  • Number of attempts: 2
The meaning - 580 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #280 / 365
  • Number of attempts: 1
Replacing some words - 428 entries

How fast could it be?

  • Best score: 17
  • Best player score: 40
  • Position: #138 / 151
  • Number of attempts: 1
Make it more readable - 2028 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 18
  • Position: #544 / 656
  • Number of attempts: 2
The holy-grail may help - 393 entries

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

  • Best score: 16
  • Best player score: 17
  • Position: #190 / 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: 26
  • Position: #504 / 529
  • Number of attempts: 2
A Simple One - 1076 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: #477 / 676
  • Number of attempts: 1
82 bottles of beer on the wall - 314 entries

Take them down. (sorry, only 82 bottles because the problem size is limited!)

  • Best score: 106
  • Best player score: 174
  • Position: #133 / 147
  • Number of attempts: 1
Reverse Simple Deletion - 862 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 16
  • Position: #442 / 463
  • Number of attempts: 1
Increment, increment, increment.... - 703 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #353 / 414
  • Number of attempts: 2
Indentation - 552 entries

Indent each line according to the right number of spaces it needs.

  • Best score: 20
  • Best player score: 42
  • Position: #160 / 181
  • 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: 9
  • Position: #211 / 252
  • Number of attempts: 1
Simple text editing with Vim - 13517 entries

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

  • Best score: 13
  • Best player score: 29
  • Position: #3510 / 3876
  • Number of attempts: 1
Brent Woo
Twitter:

Linguistics PhD student at UW: idioms, coordination, experimental syntax, Slavic. he/him

entered into 57 challenges

contributed 0 challenges