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: #969 / 7384
  • Number of attempts: 7
Swap values - 4554 entries

Well, swap the values...

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

Just give me the numbers.

  • Best score: 14
  • Best player score: 16
  • Position: #849 / 3852
  • Number of attempts: 7
Separate the lines - 176 entries

Every other line is mixed up. Separate them into their original texts.

  • Best score: 11
  • Best player score: 14
  • Position: #68 / 90
  • Number of attempts: 2
V to the i - 4771 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #505 / 1887
  • Number of attempts: 2
Split line with dots - 2131 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 15
  • Position: #117 / 633
  • Number of attempts: 6
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: 21
  • Position: #203 / 378
  • Number of attempts: 4
From argument to object - 1481 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

  • Best score: 17
  • Best player score: 17
  • Position: #34 / 453
  • Number of attempts: 6
Every other line - 2902 entries

AaAaAaA

  • Best score: 12
  • Best player score: 13
  • Position: #200 / 702
  • Number of attempts: 5
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: #70 / 639
  • Number of attempts: 7
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: 13
  • Position: #190 / 750
  • Number of attempts: 8
Search and Replace 0 - 4851 entries

Replace every instance of 'aaa' with 'xaaax'.

  • Best score: 12
  • Best player score: 12
  • Position: #497 / 1604
  • Number of attempts: 5
That hyphen - 2572 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Position: #164 / 698
  • Number of attempts: 6
comment and uncomment code inline - 1074 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

  • Best score: 9
  • Best player score: 9
  • Position: #47 / 316
  • Number of attempts: 7
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #926 / 4174
  • Number of attempts: 4
Todo list specification - 389 entries

The every item on the todo list must be done today. Modify the list to reflect that.

  • Best score: 37
  • Best player score: 39
  • Position: #118 / 178
  • Number of attempts: 2
Text to HTML Table - 174 entries

Turn the plain text table to an HTML table.

  • Best score: 52
  • Best player score: 84
  • Position: #51 / 51
  • Number of attempts: 1
Stairstep digits - 383 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 9
  • Position: #24 / 143
  • Number of attempts: 2
Missing Library and a Typo - 860 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

  • Best score: 14
  • Best player score: 16
  • Position: #30 / 211
  • Number of attempts: 6
Basic renumbering - 5605 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #77 / 1260
  • Number of attempts: 6
Simple addition - 312 entries

The right side of the equation is already there. We just need the left one now.

  • Best score: 12
  • Best player score: 12
  • Position: #16 / 118
  • Number of attempts: 5
Adam's challenge - 958 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

  • Best score: 18
  • Best player score: 20
  • Position: #131 / 267
  • Number of attempts: 5
Create a table - 332 entries

Convert the given input into a formatted table

  • Best score: 16
  • Best player score: 16
  • Position: #16 / 105
  • Number of attempts: 3
Fiddle percentages into real numbers - 841 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

  • Best score: 13
  • Best player score: 13
  • Position: #83 / 288
  • Number of attempts: 5
Nesting SASS - 262 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 9
  • Position: #32 / 94
  • Number of attempts: 3
Forgot to follow the naming convention... - 34 entries

Rename everything like MY_VAR_SOMETHING to MyVarSomething.

  • Best score: 32
  • Best player score: 32
  • Position: #5 / 15
  • Number of attempts: 4
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: #32 / 121
  • Number of attempts: 2
Vice versa - 7865 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #774 / 2114
  • Number of attempts: 6
Pretty multi-line bash - 219 entries

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

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

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

  • Best score: 30
  • Best player score: 30
  • Position: #10 / 162
  • Number of attempts: 13
Convert pasted text into Markdown - 23 entries

I often need to copy/paste text into Markdown files. The challenge here is to wrap the lines in a way that prefers breaks after periods, commas, or other logical demarcations. There should be no spaces at the beginning of a line.

  • Best score: 46
  • Best player score: 116
  • Position: #12 / 13
  • Number of attempts: 1
Sort files from hosts - 180 entries

Resume files by host. I hope you enjoy with this challenge

  • Best score: 15
  • Best player score: 18
  • Position: #61 / 75
  • Number of attempts: 2
Order and join - 965 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 10
  • Position: #38 / 258
  • Number of attempts: 5
comments galore - 1017 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 13
  • Position: #385 / 421
  • Number of attempts: 1
Replace and keep the case - 415 entries

Replace all instance of plugin and Plugin to device and Device.

  • Best score: 26
  • Best player score: 26
  • Position: #41 / 117
  • Number of attempts: 5
Hello ${world} - 300 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 66
  • Position: #88 / 95
  • Number of attempts: 1
Generate a list of numbers - 284 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #43 / 137
  • Number of attempts: 3
Add Go XML to structure tags - 153 entries

The Go programming language can directly map XML to structure fields. Add the correct XML tag after each field.

  • Best score: 23
  • Best player score: 30
  • Position: #38 / 67
  • Number of attempts: 1
No naked if allowed! - 33 entries

House style forbids naked condition statements, comments should start with a space character and be on their own line. Good luck!

  • Best score: 46
  • Best player score: 79
  • Position: #14 / 16
  • Number of attempts: 2
From A to B - 575 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 16
  • Position: #40 / 157
  • Number of attempts: 7
Collect List - 4267 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #313 / 1188
  • Number of attempts: 8
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: #45 / 287
  • Number of attempts: 7
Custom McCarthy sequence - 37 entries

Generate the first one hundred and twenty numbers (starting with n=1). See here for some inspiration: http://en.wikipedia.org/wiki/McCarthy_91_function

  • Best score: 15
  • Best player score: 15
  • Position: #1 / 16
  • Number of attempts: 4
range(10) digit rotation - 33 entries

This is a data generator challenge or some kind of gift..

  • Best score: 18
  • Best player score: 18
  • Position: #11 / 21
  • Number of attempts: 4
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #595 / 4166
  • Number of attempts: 7
-a-b-c- - 3183 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #212 / 1132
  • Number of attempts: 4
Gray area - 745 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 14
  • Position: #228 / 270
  • 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: 11
  • Position: #87 / 581
  • Number of attempts: 8
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1144 / 3677
  • Number of attempts: 5
attr_aligner - 3454 entries

Two attr keywords. Two separate indentations. Align the colons.

  • Best score: 19
  • Best player score: 46
  • Position: #655 / 695
  • Number of attempts: 1
Under the cupola - 49 entries

Taking some liberty about the name and plot of the Stephen King's famous novel (and TV series) to make this challenge. Are you able to recreate graphically the key phrase of the story? (I think is gonna be hard!)

  • Best score: 33
  • Best player score: 33
  • Position: #7 / 18
  • Number of attempts: 3
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: 14
  • Position: #277 / 1073
  • Number of attempts: 6
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #792 / 3950
  • Number of attempts: 4
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: 21
  • Position: #222 / 303
  • Number of attempts: 1
Fibonacci Triangles - 50 entries

Triangles

  • Best score: 40
  • Best player score: 57
  • Position: #15 / 21
  • Number of attempts: 2
XML to JSON - 45 entries

Convert this xml file into json.

  • Best score: 75
  • Best player score: 192
  • Position: #15 / 18
  • Number of attempts: 1
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: 20
  • Position: #49 / 476
  • Number of attempts: 8
Let's play some Ivmgolf - 1096 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #109 / 442
  • Number of attempts: 4
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #94 / 772
  • Number of attempts: 5
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 23
  • Position: #1689 / 1742
  • Number of attempts: 1
remove dupes from array - 1345 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

  • Best score: 17
  • Best player score: 19
  • Position: #118 / 333
  • Number of attempts: 9
Refactor to Helpers - 49 entries

This Rails partial is almost all template escapes. Put it into a helper, and refactor each case to methods so we can build out the controls for each. (I've converted to tabs - fighting with Vimgolf's default config shouldn't be part of the challenge.)

  • Best score: 147
  • Best player score: 242
  • Position: #11 / 24
  • Number of attempts: 3
Numbering a List - 1869 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 13
  • Position: #20 / 646
  • Number of attempts: 7
Shebangs for all - 1917 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

  • Best score: 11
  • Best player score: 11
  • Position: #46 / 502
  • Number of attempts: 3
Change the content of a string - 1502 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #169 / 567
  • 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: #1581 / 3626
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6749 entries

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

  • Best score: 31
  • Best player score: 65
  • Position: #1554 / 1652
  • Number of attempts: 1
杨洋
Twitter:

entered into 67 challenges

contributed 0 challenges