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 - 33621 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: 28
  • Position: #4426 / 7422
  • Number of attempts: 3
prepend * to every non-blank line - 6312 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #665 / 1537
  • Number of attempts: 7
One number per line - 18732 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 15
  • Position: #794 / 3865
  • Number of attempts: 11
Swap values inside brackets - 2496 entries

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #187 / 579
  • Number of attempts: 7
Unsemantic linewrapping - 928 entries

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

  • Best score: 9
  • Best player score: 10
  • Position: #119 / 231
  • Number of attempts: 7
V to the i - 4802 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1399 / 1893
  • Number of attempts: 4
Add semicolons - 10859 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #985 / 3064
  • Number of attempts: 5
Split line with dots - 2144 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 26
  • Position: #556 / 634
  • Number of attempts: 4
remove lines containing the word "reader" - 3586 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #650 / 1162
  • Number of attempts: 2
Com(m)a Trouble - 3823 entries

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

  • Best score: 12
  • Best player score: 34
  • Position: #785 / 865
  • Number of attempts: 2
Box it - 7905 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 24
  • Position: #879 / 1876
  • Number of attempts: 8
multiple cursor alternative - 1519 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: 35
  • Position: #355 / 380
  • Number of attempts: 3
html paragraph to table - 606 entries

reformat html paragraph to table

  • Best score: 48
  • Best player score: 69
  • Position: #94 / 126
  • Number of attempts: 1
Every other line - 2910 entries

AaAaAaA

  • Best score: 12
  • Best player score: 18
  • Position: #572 / 703
  • Number of attempts: 2
Copy three lines - 2872 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #133 / 640
  • Number of attempts: 8
Extract argument from function - 2357 entries

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

  • Best score: 13
  • Best player score: 23
  • Position: #733 / 753
  • Number of attempts: 1
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 14
  • Position: #587 / 701
  • Number of attempts: 1
Just the middle - 11457 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #2911 / 4198
  • Number of attempts: 1
Vice versa - 7907 entries

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Position: #1423 / 2128
  • Number of attempts: 2
One to Ten - 2219 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: #161 / 672
  • Number of attempts: 6
Collect List - 4298 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 18
  • Position: #1081 / 1190
  • Number of attempts: 2
I forgot quotes - 15989 entries

Oops.

  • Best score: 10
  • Best player score: 17
  • Position: #3038 / 4181
  • Number of attempts: 3
-a-b-c- - 3213 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #716 / 1137
  • Number of attempts: 3
Don't know what this is - 2022 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: 16
  • Position: #536 / 585
  • Number of attempts: 2
Letter case trickery - 1630 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: 14
  • Position: #427 / 518
  • Number of attempts: 1
quotes inside quotes - 3159 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: 16
  • Position: #655 / 1078
  • Number of attempts: 2
Vertical Limit - 2538 entries

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

  • Best score: 21
  • Best player score: 38
  • Position: #730 / 754
  • Number of attempts: 1
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 14
  • Position: #1436 / 1748
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3670 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 27
  • Position: #461 / 788
  • Number of attempts: 2
Simple text editing with Vim - 12815 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1793 / 3696
  • Number of attempts: 10
Reformat/Refactor a Golfer Class - 6984 entries

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

  • Best score: 28
  • Best player score: 43
  • Position: #1052 / 1708
  • Number of attempts: 2
Christian
Twitter:

entered into 31 challenges

contributed 0 challenges