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

Well, swap the values...

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

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #302 / 3852
  • Number of attempts: 5
Swap values inside brackets - 2477 entries

Easy challenge.

  • Best score: 14
  • Best player score: 15
  • Position: #122 / 573
  • Number of attempts: 2
Swap the operands under comparison - 274 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

  • Best score: 19
  • Best player score: 27
  • Position: #81 / 99
  • Number of attempts: 1
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: 19
  • Position: #18 / 378
  • Number of attempts: 5
Every other line - 2902 entries

AaAaAaA

  • Best score: 12
  • Best player score: 14
  • Position: #274 / 702
  • Number of attempts: 4
Just the middle - 11380 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #2305 / 4174
  • Number of attempts: 3
Interweave two blocks of text - 641 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

  • Best score: 15
  • Best player score: 15
  • Position: #17 / 212
  • Number of attempts: 8
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 64 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: 19
  • Position: #35 / 38
  • Number of attempts: 1
Basic renumbering - 5605 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 21
  • Position: #906 / 1260
  • Number of attempts: 1
Vice versa - 7865 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #782 / 2114
  • Number of attempts: 5
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: #39 / 75
  • Number of attempts: 2
ascii-art diamond - 37 entries

Simple ascii-art diamond. The grid is 40x40.

  • Best score: 39
  • Best player score: 41
  • Position: #6 / 16
  • Number of attempts: 1
Increment each number - 995 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 18
  • Position: #95 / 245
  • Number of attempts: 1
Array transposition - 2407 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 18
  • Position: #189 / 445
  • Number of attempts: 2
convert yml into java pojo field - 837 entries

How fast vim can create fields for java pojo i.e class declaration referring to a (simple) yml file

  • Best score: 29
  • Best player score: 30
  • Position: #97 / 225
  • Number of attempts: 3
Collect List - 4267 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 17
  • Position: #950 / 1188
  • Number of attempts: 1
Interleave lines - 159 entries

This is some kind of « paste -d'\n' c b a ». There are many ways to achieve this.. just find the shortest!

  • Best score: 17
  • Best player score: 24
  • Position: #19 / 59
  • Number of attempts: 2
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1670 / 4166
  • Number of attempts: 2
-a-b-c- - 3183 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #641 / 1132
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2143 / 3677
  • Number of attempts: 1
Letter case trickery - 1598 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 12
  • Position: #348 / 514
  • Number of attempts: 1
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #818 / 3950
  • Number of attempts: 3
Enumerate words - 251 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 25
  • Position: #31 / 90
  • Number of attempts: 4
Let's play some Ivmgolf - 1096 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 10
  • Position: #359 / 442
  • Number of attempts: 1
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 22
  • Position: #162 / 748
  • Number of attempts: 8
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: 21
  • Position: #2842 / 3626
  • Number of attempts: 1

Contributed Challenges

replace 2nd column blanks with values in same column if blank - 232 entries

Where ,SOMELOGB and ,SOMELOGC replaces each /r carriage return if 2nd column is blank. The replace only happens if 2nd column is blank though and should replace up to the non blank row.

Combines all items - 307 entries

For each line that starts with the same number I want to combine its contents

Sergio
Twitter:

Entusiasta do Software Livre, Espírita, esquerdista. Gosto muito de blogar e ouvir música

entered into 28 challenges

contributed 2 challenges