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 - 4063 entries

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

  • Best score: 9
  • Best player score: 14
  • Position: #629 / 1007
  • Number of attempts: 2
Simple, Practical, and Common - 32879 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: 23
  • Position: #2480 / 7266
  • Number of attempts: 4
prepend * to every non-blank line - 5946 entries

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

  • Best score: 10
  • Best player score: 15
  • Position: #921 / 1459
  • Number of attempts: 1
One number per line - 18361 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Position: #1077 / 3785
  • Number of attempts: 4
V to the i - 4635 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1184 / 1855
  • Number of attempts: 2
Applying same text modification in several lines - 2739 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #486 / 812
  • Number of attempts: 2
Add semicolons - 10527 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #909 / 2986
  • Number of attempts: 2
Split line with dots - 2087 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 17
  • Position: #252 / 620
  • Number of attempts: 3
Box it - 7678 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 26
  • Position: #1040 / 1834
  • Number of attempts: 3
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 46 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: #19 / 28
  • Number of attempts: 2
Basic renumbering - 5422 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #879 / 1225
  • Number of attempts: 1
replace 2nd column blanks with values in same column if blank - 210 entries

Where ,SOMELOGB and ,SOMELOGC replaces each /r carriage return if 2nd column is blank. The replace only happens if 2nd column is blank though and should replace up to the non blank row.

  • Best score: 15
  • Best player score: 20
  • Position: #63 / 73
  • Number of attempts: 1
Entries sort - 71 entries

It cames to my mind a weird idea : sorting parts of my .vimrc. Take few minutes to sort out this, it's easy !

  • Best score: 14
  • Best player score: 17
  • Position: #25 / 33
  • Number of attempts: 1
I forgot quotes - 15710 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2125 / 4108
  • Number of attempts: 3
vim1001 - 260 entries

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

  • Best score: 17
  • Best player score: 41
  • Position: #97 / 103
  • Number of attempts: 1
Groups magic - 141 entries

Regexp or macros for string converting: (a) -> ___ (abc) -> ____ (abcd) -> ______ All in the '(' replace to _ multiply by char count + ()

  • Best score: 13
  • Best player score: 14
  • Position: #62 / 84
  • Number of attempts: 2
Remove noise from HTTP log - 657 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 16
  • Position: #183 / 259
  • Number of attempts: 2
A Simple One - 912 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: #454 / 606
  • Number of attempts: 1
Reverse and count - 407 entries

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

  • Best score: 18
  • Best player score: 24
  • Position: #63 / 155
  • Number of attempts: 3
Reformat a C golf submission - 520 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: 29
  • Position: #73 / 192
  • Number of attempts: 1
Simple text editing with Vim - 11587 entries

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

  • Best score: 13
  • Best player score: 22
  • Position: #2738 / 3400
  • Number of attempts: 1
Reformat/Refactor a Golfer Class - 5969 entries

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

  • Best score: 32
  • Best player score: 36
  • Position: #440 / 1474
  • Number of attempts: 2
Matti Sairanen
Twitter:

entered into 22 challenges

contributed 0 challenges