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 - 33964 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: 24
  • Position: #2956 / 7500
  • Number of attempts: 1
Swap values - 4701 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Position: #206 / 1290
  • Number of attempts: 6
One number per line - 18889 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #225 / 3898
  • Number of attempts: 12
Split line with dots - 2174 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 23
  • Position: #491 / 638
  • Number of attempts: 3
multiple cursor alternative - 1556 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: 30
  • Position: #343 / 386
  • Number of attempts: 2
Every other line - 2945 entries

AaAaAaA

  • Best score: 12
  • Best player score: 13
  • Position: #219 / 710
  • Number of attempts: 4
Copy three lines - 2909 entries

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

  • Best score: 13
  • Best player score: 21
  • Position: #462 / 644
  • Number of attempts: 2
comment and uncomment code inline - 1158 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: 10
  • Position: #171 / 329
  • Number of attempts: 4
Team names - 1858 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #80 / 594
  • Number of attempts: 5
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 72 entries

I bumped into this in a dailywtf code: http://pastebin.com/QApa5ycS I didn't want to translate a string whenever I wanted to be [Ss][Aa][Rr][Cc][Aa][Ss][Tt][Ii][Cc] on slack, so I figured a script (python, sed, whatever) would be helpful. Well, or a few vim keystroke!

  • Best score: 18
  • Best player score: 18
  • Position: #17 / 40
  • Number of attempts: 1
Adam's challenge - 1018 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: 18
  • Position: #13 / 278
  • Number of attempts: 5
Fiddle percentages into real numbers - 884 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: 19
  • Position: #266 / 296
  • Number of attempts: 1
Vice versa - 7997 entries

Little role switching.

  • Best score: 12
  • Best player score: 48
  • Position: #2119 / 2152
  • Number of attempts: 1
Paragraph sort - 456 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

  • Best score: 14
  • Best player score: 14
  • Position: #31 / 126
  • Number of attempts: 3
Maze path - 52 entries

Follow the given motions and mark your path with Xs. Attention: This maze is quite big (20x20), please set your terminal size to at least 82.

  • Best score: 25
  • Best player score: 91
  • Position: #15 / 18
  • Number of attempts: 3
Generate a list of numbers - 302 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #45 / 142
  • Number of attempts: 2
Array transposition - 2472 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 17
  • Position: #101 / 458
  • Number of attempts: 14
Collect List - 4332 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #346 / 1196
  • Number of attempts: 6
range(10) digit rotation - 43 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #18 / 23
  • Number of attempts: 1
I forgot quotes - 16176 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #686 / 4216
  • Number of attempts: 9
-a-b-c- - 3233 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #206 / 1143
  • Number of attempts: 5
Piphilology - 174 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: 32
  • Position: #17 / 55
  • Number of attempts: 5
A HAPPY NEW YEAR 2014 ! - 10748 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1221 / 3711
  • Number of attempts: 2
Words in parens - 13028 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #896 / 3984
  • Number of attempts: 6
Prefixes and suffixes - 649 entries

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

  • Best score: 17
  • Best player score: 21
  • Position: #36 / 205
  • Number of attempts: 6
The name of the game - 679 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #223 / 364
  • Number of attempts: 3
Create an alphabet diamond - 105 entries

Here's a brain teaser to keep things interesting...

  • Best score: 37
  • Best player score: 40
  • Position: #8 / 32
  • Number of attempts: 7
Vertical Limit - 2624 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #68 / 774
  • Number of attempts: 6
Switch function arguments - 2195 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #151 / 678
  • Number of attempts: 7
The meaning - 580 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #273 / 365
  • Number of attempts: 1
Increment, increment, increment.... - 703 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #344 / 414
  • Number of attempts: 2
Make Fancy Header - 1080 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 23
  • Position: #296 / 352
  • Number of attempts: 1
Reverse characters in a line - 819 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 8
  • Best player score: 12
  • Position: #13 / 276
  • Number of attempts: 6
martin tourneboeuf
Twitter:

entered into 33 challenges

contributed 0 challenges