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

Well, swap the values...

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

Just give me the numbers.

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #300 / 840
  • Number of attempts: 3
Split line with dots - 2125 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Position: #59 / 630
  • Number of attempts: 7
multiple cursor alternative - 1474 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: #107 / 376
  • Number of attempts: 3
Copy three lines - 2840 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 / 635
  • Number of attempts: 6
Extract argument from function - 2314 entries

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

  • Best score: 13
  • Best player score: 16
  • Position: #465 / 744
  • Number of attempts: 2
Across-Down Flip - 53 entries

Do this instead of the Sunday crossword.

  • Best score: 23
  • Best player score: 52
  • Position: #22 / 24
  • Number of attempts: 1
Just the middle - 11360 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1645 / 4164
  • Number of attempts: 2
On Being Stylish - 72 entries

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

  • Best score: 33
  • Best player score: 35
  • Position: #8 / 19
  • Number of attempts: 3
Return the cow - 71 entries

This cow is too verbose. Give it a lesson.

  • Best score: 52
  • Best player score: 113
  • Position: #23 / 28
  • Number of attempts: 2
Interactive git rebase changing commands - 161 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #19 / 77
  • Number of attempts: 3
Create Leading Zeros - 238 entries

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

  • Best score: 23
  • Best player score: 63
  • Position: #73 / 80
  • Number of attempts: 1
Add to end of each line... kinda - 325 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 / 171
  • Number of attempts: 2
Wrap text in quotes - 349 entries

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

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

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

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

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

  • Best score: 30
  • Best player score: 33
  • Position: #50 / 161
  • Number of attempts: 2
SQL to YAML - 45 entries

Should be easy with vim, or not?

  • Best score: 72
  • Best player score: 73
  • Position: #7 / 20
  • Number of attempts: 3
Manual SQL - 133 entries

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

  • Best score: 48
  • Best player score: 52
  • Position: #8 / 47
  • Number of attempts: 6
Separating firstname & lastname - 120 entries

Seperate named with equal tabs.

  • Best score: 19
  • Best player score: 26
  • Position: #34 / 55
  • Number of attempts: 1
O Christmas Tree - 108 entries

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

  • Best score: 22
  • Best player score: 25
  • Position: #11 / 42
  • Number of attempts: 6
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 26
  • Position: #334 / 343
  • Number of attempts: 1
Fix the XML - 996 entries

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

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

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

  • Best score: 21
  • Best player score: 26
  • Position: #10 / 49
  • Number of attempts: 5
I forgot quotes - 15931 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #82 / 4161
  • Number of attempts: 8
Change name of a variable - 169 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 / 132
  • Number of attempts: 1
120 Degrees - 468 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 21
  • Position: #83 / 143
  • Number of attempts: 2
Don't know what this is - 1978 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: #149 / 578
  • Number of attempts: 3
Two become one - 710 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: #53 / 205
  • Number of attempts: 5
Vim tetris - 352 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 24
  • Position: #45 / 101
  • Number of attempts: 2
Piphilology - 131 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
  • Position: #48 / 51
  • Number of attempts: 2
Mess in revision history - 1160 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 18
  • Position: #72 / 246
  • Number of attempts: 2
Carriage return - 42 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: #17 / 20
  • Number of attempts: 3
HTML formatting: vertical alignment for readability - 63 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
  • Position: #19 / 33
  • Number of attempts: 2
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
  • Position: #28 / 32
  • Number of attempts: 1
Going underground.... - 339 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: #39 / 125
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #148 / 3666
  • Number of attempts: 7
quotes inside quotes - 3125 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: #412 / 1072
  • Number of attempts: 4
Top X - 191 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: #17 / 69
  • Number of attempts: 6
Words in parens - 12854 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #687 / 3945
  • Number of attempts: 7
Pairs of numbers - 360 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: #107 / 133
  • Number of attempts: 1
Draw the Go board - 140 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: #9 / 48
  • Number of attempts: 2
Hole-in-one - 1012 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: #55 / 302
  • Number of attempts: 4
Prefixes and suffixes - 591 entries

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

  • Best score: 17
  • Best player score: 21
  • Position: #30 / 192
  • Number of attempts: 7
The Quick Brown Fox Jumps Over The Lazy Vim - 401 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: #132 / 188
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1581 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 / 439
  • Number of attempts: 6
Saving the hashes(#) - 1992 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: #401 / 473
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 337 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 / 111
  • Number of attempts: 6
Vertical Limit - 2437 entries

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

  • Best score: 21
  • Best player score: 24
  • Position: #279 / 736
  • Number of attempts: 2
replacing each line of a block selection - 2946 entries

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

  • Best score: 18
  • Best player score: 33
  • Position: #698 / 767
  • Number of attempts: 1
Remove noise from HTTP log - 695 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: #175 / 270
  • Number of attempts: 1
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Position: #162 / 640
  • Number of attempts: 3
Ruby 1.9 hashes - 1221 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: #158 / 401
  • Number of attempts: 2
Simple text editing with Vim - 12281 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1195 / 3580
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6557 entries

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

  • Best score: 32
  • Best player score: 32
  • Position: #88 / 1614
  • Number of attempts: 13
Pedro Santos
Twitter:

entered into 56 challenges

contributed 0 challenges