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

Swap values - 4535 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 16
  • Position: #1058 / 1255
  • Number of attempts: 1
One number per line - 18615 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 20
  • Position: #2250 / 3841
  • Number of attempts: 2
V to the i - 4743 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1296 / 1878
  • Number of attempts: 1
Add semicolons - 10785 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1178 / 3042
  • Number of attempts: 2
Split line with dots - 2124 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 21
  • Position: #432 / 629
  • Number of attempts: 1
remove lines containing the word "reader" - 3528 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #332 / 1142
  • Number of attempts: 3
Box it - 7818 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Position: #242 / 1861
  • Number of attempts: 5
multiple cursor alternative - 1474 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: 19
  • Position: #57 / 376
  • Number of attempts: 5
From argument to object - 1474 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: 17
  • Position: #97 / 450
  • Number of attempts: 3
Copy three lines - 2839 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #96 / 634
  • Number of attempts: 7
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #517 / 1585
  • Number of attempts: 2
Number Sort - 303 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: 9
  • Position: #37 / 162
  • Number of attempts: 2
That hyphen - 2554 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Position: #179 / 694
  • Number of attempts: 2
comment and uncomment code inline - 1069 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: 9
  • Position: #95 / 314
  • Number of attempts: 2
Just the middle - 11346 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #1317 / 4160
  • Number of attempts: 3
Basic renumbering - 5584 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #119 / 1257
  • Number of attempts: 1
comments galore - 998 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #248 / 418
  • Number of attempts: 2
Generate a list of numbers - 283 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 15
  • Position: #106 / 136
  • Number of attempts: 1
One to Ten - 2159 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: #221 / 660
  • Number of attempts: 4
Collect List - 4261 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #373 / 1185
  • Number of attempts: 2
I forgot quotes - 15923 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #760 / 4159
  • Number of attempts: 4
-a-b-c- - 3170 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #236 / 1127
  • Number of attempts: 3
Don't know what this is - 1978 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: 11
  • Position: #98 / 578
  • Number of attempts: 6
Words in parens - 12850 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #1044 / 3944
  • Number of attempts: 3
Saving the hashes(#) - 1992 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: 26
  • Position: #203 / 473
  • Number of attempts: 3
switch variable - 5028 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 14
  • Position: #1415 / 1734
  • Number of attempts: 1
Shebangs for all - 1904 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: 12
  • Position: #148 / 497
  • Number of attempts: 6
Simple text editing with Vim - 12233 entries

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

  • Best score: 13
  • Best player score: 18
  • Position: #2550 / 3567
  • Number of attempts: 2
Chris Dean
Twitter:

entered into 28 challenges

contributed 0 challenges