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 - 33616 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 / 7420
  • Number of attempts: 6
Swap values - 4616 entries

Well, swap the values...

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

Just give me the numbers.

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

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

  • Best score: 12
  • Best player score: 14
  • Position: #306 / 851
  • Number of attempts: 3
Split line with dots - 2144 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Position: #59 / 634
  • Number of attempts: 7
multiple cursor alternative - 1519 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: #110 / 380
  • Number of attempts: 3
Copy three lines - 2872 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 / 640
  • Number of attempts: 6
Extract argument from function - 2357 entries

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

  • Best score: 13
  • Best player score: 16
  • Position: #470 / 753
  • Number of attempts: 2
Across-Down Flip - 68 entries

Do this instead of the Sunday crossword.

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

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1649 / 4197
  • Number of attempts: 2
On Being Stylish - 81 entries

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

  • Best score: 33
  • Best player score: 35
  • Position: #10 / 21
  • Number of attempts: 3
Return the cow - 75 entries

This cow is too verbose. Give it a lesson.

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

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

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

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

  • Best score: 23
  • Best player score: 63
  • Position: #75 / 82
  • Number of attempts: 1
Add to end of each line... kinda - 333 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 / 174
  • Number of attempts: 2
Wrap text in quotes - 368 entries

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

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

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

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

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

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

Should be easy with vim, or not?

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

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

  • Best score: 48
  • Best player score: 52
  • Position: #10 / 50
  • Number of attempts: 6
Separating firstname & lastname - 138 entries

Seperate named with equal tabs.

  • Best score: 19
  • Best player score: 26
  • Position: #36 / 57
  • 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 - 560 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 26
  • Position: #338 / 347
  • Number of attempts: 1
Fix the XML - 1039 entries

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

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

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

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

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #82 / 4180
  • Number of attempts: 8
Change name of a variable - 179 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 / 137
  • Number of attempts: 1
120 Degrees - 493 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 21
  • Position: #85 / 145
  • Number of attempts: 2
Don't know what this is - 2022 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: #153 / 585
  • 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 - 144 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 - 1184 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 18
  • Position: #74 / 250
  • 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 - 88 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: #21 / 36
  • Number of attempts: 2
Write Setters and Getters for PHP - 88 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.... - 356 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: #42 / 128
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10663 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #148 / 3683
  • Number of attempts: 7
quotes inside quotes - 3159 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: #414 / 1078
  • Number of attempts: 4
Top X - 212 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: #19 / 71
  • Number of attempts: 6
Words in parens - 12935 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #691 / 3963
  • Number of attempts: 7
Pairs of numbers - 363 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: #109 / 136
  • Number of attempts: 1
Draw the Go board - 149 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 / 51
  • Number of attempts: 2
Hole-in-one - 1018 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 / 304
  • Number of attempts: 4
Prefixes and suffixes - 635 entries

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

  • Best score: 17
  • Best player score: 21
  • Position: #32 / 201
  • Number of attempts: 7
The Quick Brown Fox Jumps Over The Lazy Vim - 420 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: #135 / 192
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1606 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 / 446
  • Number of attempts: 6
Saving the hashes(#) - 2063 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: #408 / 480
  • Number of attempts: 1
you're stuck on jQuery < 1.7 - 362 entries

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

  • Best score: 25
  • Best player score: 26
  • Position: #29 / 113
  • Number of attempts: 6
Vertical Limit - 2538 entries

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

  • Best score: 21
  • Best player score: 24
  • Position: #288 / 754
  • Number of attempts: 2
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 33
  • Position: #706 / 777
  • Number of attempts: 1
Remove noise from HTTP log - 717 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: #178 / 273
  • Number of attempts: 1
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Position: #166 / 650
  • Number of attempts: 3
Ruby 1.9 hashes - 1244 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: #163 / 406
  • Number of attempts: 2
Simple text editing with Vim - 12811 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1229 / 3694
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6982 entries

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

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

entered into 56 challenges

contributed 0 challenges