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 - 33385 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: 29
  • Position: #4641 / 7364
  • Number of attempts: 1
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #439 / 1879
  • Number of attempts: 1
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: 11
  • Position: #215 / 314
  • Number of attempts: 1
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 63 entries

I bumped into this in a dailywtf code: http://pastebin.com/QApa5ycS I didn't want to translate a string whenever I wanted to be [Ss][Aa][Rr][Cc][Aa][Ss][Tt][Ii][Cc] on slack, so I figured a script (python, sed, whatever) would be helpful. Well, or a few vim keystroke!

  • Best score: 18
  • Best player score: 18
  • Position: #12 / 37
  • Number of attempts: 1
Vice versa - 7803 entries

Little role switching.

  • Best score: 12
  • Best player score: 14
  • Position: #909 / 2100
  • Number of attempts: 3
7th Birthday - 186 entries

We have a bunch of numbers written from 0 to 9 in the order present in the text input file. The task is to create 7 by replacing the numbers with dashes.

  • Best score: 19
  • Best player score: 22
  • Position: #28 / 73
  • Number of attempts: 1
Collect List - 4264 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #271 / 1186
  • Number of attempts: 1
-a-b-c- - 3176 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 14
  • Position: #353 / 1129
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 6558 entries

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

  • Best score: 32
  • Best player score: 39
  • Position: #717 / 1615
  • Number of attempts: 3
Benedikt Ames
Twitter:

entered into 9 challenges

contributed 0 challenges