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

Write Setters and Getters for PHP - 86 entries

Just simple automation of writing Setters and Getters like Doctrine might use.

  • Best score: 102
  • Best player score: 160
  • Number of attempts: 1
SQL to YAML - 32 entries

Should be easy with vim, or not?

  • Best score: 72
  • Best player score: 73
  • Number of attempts: 3
Create Leading Zeros - 192 entries

Create leading zeros only for id columns. Please use generic approach!

  • Best score: 23
  • Best player score: 63
  • Number of attempts: 1
Draw the Go board - 108 entries

which is a 19×19 lines board. Here we use ascii characters only for simplicity. See diff file to get a sense. (See also http://en.wikipedia.org/wiki/Go_(game))

  • Best score: 50
  • Best player score: 56
  • Number of attempts: 2
HTML formatting: vertical alignment for readability - 59 entries

We did this a VimGolf challenge at work and now that we have finished I want to see if you guys can come up with something even better than we could. Our best solution was 44 keystrokes.

  • Best score: 33
  • Best player score: 54
  • Number of attempts: 2
Manual SQL - 92 entries

Change select and insert queries to simulate inserting a new record.

  • Best score: 49
  • Best player score: 52
  • Number of attempts: 6
Pairs of numbers - 316 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

  • Best score: 26
  • Best player score: 46
  • Number of attempts: 1
Piphilology - 114 entries

Piphilology comprises the creation and use of mnemonic techniques to remember a span of digits of the mathematical constant π. http://en.wikipedia.org/wiki/Piphilology

  • Best score: 29
  • Best player score: 43
  • Number of attempts: 2
Split line with dots - 1716 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 7
I forgot quotes - 10443 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 8
One number per line - 10902 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 7
Applying same text modification in several lines - 1028 entries

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

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 3
O Christmas Tree - 99 entries

Design a macro that makes trees grow (or ASCII triangles, if that's too hard).

  • Best score: 22
  • Best player score: 25
  • Number of attempts: 6
Simple text editing with Vim - 10020 entries

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

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 3
Add to end of each line... kinda - 258 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 2
Interactive git rebase changing commands - 139 entries

How to change the action of some commits in git rebase dialog.

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 3
Change name of a variable - 143 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Make it more readable - 1718 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 3
SFD-ROC: vimvimvim - 1249 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 8
  • Number of attempts: 6
Remove noise from HTTP log - 595 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
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 314 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

  • Best score: 25
  • Best player score: 26
  • Number of attempts: 6
C Reformatting - 581 entries

You may use Visual mode... or not. #uppercase

  • Best score: 30
  • Best player score: 33
  • Number of attempts: 2
Words in parens - 10478 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 7
Pretty multi-line bash - 190 entries

Bash line continuations are much prettier when they're column aligned.

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 4
Just the middle - 8609 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 2
Across-Down Flip - 37 entries

Do this instead of the Sunday crossword.

  • Best score: 24
  • Best player score: 52
  • Number of attempts: 1
Wrap text in quotes - 276 entries

All the blocks of text should be wrapped in quotation marks.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 3
Copy three lines - 1765 entries

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

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 6
Return the cow - 71 entries

This cow is too verbose. Give it a lesson.

  • Best score: 52
  • Best player score: 113
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 9178 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 7
The Quick Brown Fox Jumps Over The Lazy Vim - 320 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 1
Swap values - 3231 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 6
Hole-in-one - 935 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 4
Carriage return - 41 entries

I have some raw data from terminal output which uses carriege return for formatting. Carriage return sets the pointer to the first character on the line, and subsequent characters will overwrite what was there before. The challange is to simulate the terminal behaviour in vim. I'm kind of unsure if I should have skipped lines 9 and 15, since there might be some interesting solutions which are not that generic. Happy Golfing!

  • Best score: 22
  • Best player score: 35
  • Number of attempts: 3
Extract argument from function - 1837 entries

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

  • Best score: 13
  • Best player score: 16
  • Number of attempts: 2
Ruby 1.9 hashes - 1038 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 12
  • Best player score: 13
  • Number of attempts: 2
Vim tetris - 302 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 24
  • Number of attempts: 2
Fix the XML - 836 entries

The challenge consists in having a valid xml from an incomplete source.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 5
Two become one - 653 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 28
  • Number of attempts: 5
Simple, Practical, and Common - 21848 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: 2
  • Best player score: 22
  • Number of attempts: 6
Winning streak - 105 entries

Make the number on each line equal the consecutive L's or W's.

  • Best score: 21
  • Best player score: 26
  • Number of attempts: 5
Top X - 177 entries

The End File is the Top 10 Vimgolf Leaderboard at June 29, 2013. This is a second version, with a great contribution of @udioica. X is ten in Roman,a numeric system in ancient Rome

  • Best score: 18
  • Best player score: 21
  • Number of attempts: 6
multiple cursor alternative - 912 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: 20
  • Number of attempts: 3
quotes inside quotes - 2654 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: 2
  • Best player score: 15
  • Number of attempts: 4
120 Degrees - 339 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 21
  • Number of attempts: 2
Going underground.... - 277 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

  • Best score: 22
  • Best player score: 28
  • Number of attempts: 4
VimGolfNight - 450 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 26
  • Number of attempts: 1
Prefixes and suffixes - 465 entries

Generate all prefixes of "vimchallenge", then all suffixes.

  • Best score: 17
  • Best player score: 21
  • Number of attempts: 7
Vertical Limit - 2052 entries

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

  • Best score: 21
  • Best player score: 24
  • Number of attempts: 2
Separating firstname & lastname - 96 entries

Seperate named with equal tabs.

  • Best score: 19
  • Best player score: 26
  • Number of attempts: 1
Mess in revision history - 936 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 18
  • Number of attempts: 2
On Being Stylish - 50 entries

Your PR cannot be accepted if you don't follow our corporate style guide.

  • Best score: 33
  • Best player score: 35
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 5370 entries

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

  • Best score: 32
  • Best player score: 32
  • Number of attempts: 13
Don't know what this is - 1632 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: 12
  • Number of attempts: 3
Saving the hashes(#) - 1686 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: 31
  • Number of attempts: 1
replacing each line of a block selection - 2425 entries

replace each line's ../assets/js with /javascripts

  • Best score: 17
  • Best player score: 33
  • Number of attempts: 1
Pedro Santos
Twitter:

entered into 56 challenges

contributed 0 challenges