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

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

  • Best score: 9
  • Best player score: 14
  • Position: #713 / 1114
  • Number of attempts: 2
Simple, Practical, and Common - 33791 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: #2545 / 7455
  • Number of attempts: 4
prepend * to every non-blank line - 6358 entries

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

  • Best score: 10
  • Best player score: 15
  • Position: #986 / 1551
  • Number of attempts: 1
One number per line - 18801 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 17
  • Position: #1111 / 3882
  • Number of attempts: 4
V to the i - 4824 entries

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

  • Best score: 7
  • Best player score: 8
  • Position: #1207 / 1899
  • Number of attempts: 2
Applying same text modification in several lines - 2907 entries

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

  • Best score: 12
  • Best player score: 15
  • Position: #523 / 860
  • Number of attempts: 2
Add semicolons - 10899 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #944 / 3078
  • Number of attempts: 2
Split line with dots - 2154 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 17
  • Position: #255 / 635
  • Number of attempts: 3
Box it - 7954 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 26
  • Position: #1077 / 1886
  • Number of attempts: 3
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 67 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 / 39
  • Number of attempts: 2
Basic renumbering - 5685 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #913 / 1270
  • Number of attempts: 1
replace 2nd column blanks with values in same column if blank - 242 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: #72 / 83
  • Number of attempts: 1
Entries sort - 93 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: #31 / 41
  • Number of attempts: 1
I forgot quotes - 16061 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Position: #2174 / 4195
  • Number of attempts: 3
vim1001 - 307 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: #104 / 110
  • Number of attempts: 1
Groups magic - 162 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: #64 / 95
  • Number of attempts: 2
Remove noise from HTTP log - 724 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: #193 / 275
  • Number of attempts: 2
A Simple One - 1064 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 / 670
  • Number of attempts: 1
Reverse and count - 486 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: #80 / 179
  • Number of attempts: 3
Reformat a C golf submission - 614 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: #84 / 210
  • Number of attempts: 1
Simple text editing with Vim - 13145 entries

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

  • Best score: 13
  • Best player score: 22
  • Position: #3018 / 3778
  • Number of attempts: 1
Reformat/Refactor a Golfer Class - 7261 entries

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

  • Best score: 10
  • Best player score: 36
  • Position: #476 / 1792
  • Number of attempts: 2
Matti Sairanen
Twitter:

entered into 22 challenges

contributed 0 challenges