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 - 33483 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: 22
  • Position: #533 / 7384
  • Number of attempts: 6
Swap values - 4554 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Position: #82 / 1259
  • Number of attempts: 6
One number per line - 18673 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #54 / 3852
  • Number of attempts: 7
Applying same text modification in several lines - 2851 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #301 / 843
  • Number of attempts: 3
Split line with dots - 2131 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Position: #59 / 633
  • Number of attempts: 7
multiple cursor alternative - 1488 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
  • Position: #109 / 378
  • Number of attempts: 3
Copy three lines - 2869 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #6 / 639
  • Number of attempts: 6
Extract argument from function - 2337 entries

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

  • Best score: 13
  • Best player score: 16
  • Position: #469 / 750
  • Number of attempts: 2
Across-Down Flip - 54 entries

Do this instead of the Sunday crossword.

  • Best score: 23
  • Best player score: 52
  • Position: #23 / 25
  • Number of attempts: 1
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1647 / 4174
  • Number of attempts: 2
On Being Stylish - 73 entries

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

  • Best score: 33
  • Best player score: 35
  • Position: #9 / 20
  • Number of attempts: 3
Return the cow - 72 entries

This cow is too verbose. Give it a lesson.

  • Best score: 52
  • Best player score: 113
  • Position: #24 / 29
  • Number of attempts: 2
Interactive git rebase changing commands - 163 entries

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

  • Best score: 14
  • Best player score: 15
  • Position: #20 / 78
  • Number of attempts: 3
Create Leading Zeros - 239 entries

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

  • Best score: 23
  • Best player score: 63
  • Position: #74 / 81
  • Number of attempts: 1
Add to end of each line... kinda - 329 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
  • Position: #78 / 173
  • Number of attempts: 2
Wrap text in quotes - 351 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #8 / 121
  • Number of attempts: 3
Pretty multi-line bash - 219 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #8 / 76
  • Number of attempts: 4
C Reformatting - 689 entries

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

  • Best score: 30
  • Best player score: 33
  • Position: #51 / 162
  • Number of attempts: 2
SQL to YAML - 47 entries

Should be easy with vim, or not?

  • Best score: 71
  • Best player score: 73
  • Position: #8 / 21
  • Number of attempts: 3
Manual SQL - 136 entries

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

  • Best score: 48
  • Best player score: 52
  • Position: #9 / 49
  • Number of attempts: 6
Separating firstname & lastname - 121 entries

Seperate named with equal tabs.

  • Best score: 19
  • Best player score: 26
  • Position: #35 / 56
  • Number of attempts: 1
O Christmas Tree - 109 entries

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

  • Best score: 22
  • Best player score: 25
  • Position: #12 / 43
  • Number of attempts: 6
VimGolfNight - 538 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 26
  • Position: #335 / 344
  • Number of attempts: 1
Fix the XML - 1000 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #38 / 287
  • Number of attempts: 5
Winning streak - 125 entries

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

  • Best score: 21
  • Best player score: 26
  • Position: #11 / 50
  • Number of attempts: 5
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #82 / 4166
  • Number of attempts: 8
Change name of a variable - 173 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
  • Position: #23 / 136
  • Number of attempts: 1
120 Degrees - 469 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 21
  • Position: #84 / 144
  • Number of attempts: 2
Don't know what this is - 1996 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
  • Position: #151 / 581
  • Number of attempts: 3
Two become one - 713 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
  • Position: #54 / 208
  • Number of attempts: 5
Vim tetris - 353 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 24
  • Position: #46 / 102
  • Number of attempts: 2
Piphilology - 143 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: 28
  • Best player score: 43
  • Position: #49 / 52
  • Number of attempts: 2
Mess in revision history - 1183 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 18
  • Position: #74 / 249
  • Number of attempts: 2
Carriage return - 43 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
  • Position: #18 / 21
  • Number of attempts: 3
HTML formatting: vertical alignment for readability - 67 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: 32
  • Best player score: 54
  • Position: #20 / 35
  • Number of attempts: 2
Write Setters and Getters for PHP - 87 entries

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

  • Best score: 102
  • Best player score: 160
  • Position: #29 / 33
  • Number of attempts: 1
Going underground.... - 349 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
  • Position: #41 / 127
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #148 / 3677
  • Number of attempts: 7
quotes inside quotes - 3128 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: 15
  • Position: #413 / 1073
  • Number of attempts: 4
Top X - 192 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
  • Position: #18 / 70
  • Number of attempts: 6
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #688 / 3950
  • Number of attempts: 7
Pairs of numbers - 361 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
  • Position: #108 / 134
  • Number of attempts: 1
Draw the Go board - 144 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
  • Position: #10 / 50
  • Number of attempts: 2
Hole-in-one - 1017 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
  • Position: #56 / 303
  • Number of attempts: 4
Prefixes and suffixes - 599 entries

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

  • Best score: 17
  • Best player score: 21
  • Position: #31 / 195
  • Number of attempts: 7
The Quick Brown Fox Jumps Over The Lazy Vim - 404 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: 8
  • Best player score: 11
  • Position: #133 / 190
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1594 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #50 / 443
  • Number of attempts: 6
Saving the hashes(#) - 2008 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
  • Position: #404 / 476
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 338 entries

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

  • Best score: 25
  • Best player score: 26
  • Position: #28 / 112
  • Number of attempts: 6
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 24
  • Position: #282 / 748
  • Number of attempts: 2
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 33
  • Position: #702 / 772
  • Number of attempts: 1
Remove noise from HTTP log - 700 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: #177 / 272
  • Number of attempts: 1
Make it more readable - 1955 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Position: #163 / 643
  • Number of attempts: 3
Ruby 1.9 hashes - 1225 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
  • Position: #159 / 402
  • Number of attempts: 2
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1209 / 3626
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6749 entries

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

  • Best score: 31
  • Best player score: 32
  • Position: #89 / 1652
  • Number of attempts: 13
Pedro Santos
Twitter:

entered into 56 challenges

contributed 0 challenges