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

Find fix point of cos - 1120 entries

Write a function to find the fix point of cos. It is not a good code; It is just to use vim. Inspired by the excellent https://mvanier.livejournal.com/2897.html about the Y combinator.

  • Best score: 14
  • Best player score: 22
  • Position: #261 / 334
  • Number of attempts: 2
Create a diamond comment - 305 entries

Encapsulate the text in a diamond pattern.

  • Best score: 27
  • Best player score: 307
  • Position: #71 / 71
  • Number of attempts: 1
CSV to MD format - 382 entries

To convert a CSV list to Markdown list

  • Best score: 36
  • Best player score: 182
  • Position: #86 / 90
  • Number of attempts: 2
Python dataclasses - 1104 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 19
  • Position: #14 / 277
  • Number of attempts: 5
Add quotes to ansible playbook - 926 entries

You created an ansible playbook, but forgot to add quotes. Can you fix it?

  • Best score: 8
  • Best player score: 9
  • Position: #160 / 295
  • Number of attempts: 11
Simple, Practical, and Common - 33379 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: #2951 / 7363
  • Number of attempts: 4
Swap values - 4543 entries

Well, swap the values...

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

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #421 / 3842
  • Number of attempts: 20
V to the i - 4751 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #111 / 1879
  • Number of attempts: 13
Add semicolons - 10792 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 12
  • Position: #1882 / 3044
  • Number of attempts: 2
Com(m)a Trouble - 3668 entries

Someone was real stupid when placing his commas. Can you fix it?

  • Best score: 12
  • Best player score: 13
  • Position: #174 / 826
  • Number of attempts: 8
Wrap the text of an email message to 79 characters - 679 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #234 / 386
  • Number of attempts: 2
Box it - 7827 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 27
  • Position: #1127 / 1864
  • Number of attempts: 3
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: 23
  • Position: #270 / 376
  • Number of attempts: 5
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 16
  • Position: #1131 / 1585
  • Number of attempts: 2
Across-Down Flip - 53 entries

Do this instead of the Sunday crossword.

  • Best score: 23
  • Best player score: 68
  • Position: #24 / 24
  • Number of attempts: 1
Number Sort - 303 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

  • Best score: 9
  • Best player score: 9
  • Position: #12 / 162
  • Number of attempts: 2
Letterbox - 91 entries

Make a box!

  • Best score: 35
  • Best player score: 159
  • Position: #25 / 25
  • Number of attempts: 1
Just the middle - 11358 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #321 / 4163
  • Number of attempts: 3
Team names - 1805 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 21
  • Position: #506 / 581
  • Number of attempts: 1
Return the cow - 71 entries

This cow is too verbose. Give it a lesson.

  • Best score: 52
  • Best player score: 118
  • Position: #24 / 28
  • Number of attempts: 2
Basic renumbering - 5587 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 16
  • Position: #535 / 1258
  • Number of attempts: 4
Create Leading Zeros - 238 entries

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

  • Best score: 23
  • Best player score: 58
  • Position: #72 / 80
  • Number of attempts: 1
Add to end of each line... kinda - 323 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: 13
  • Position: #143 / 170
  • Number of attempts: 6
Reformat Cura settings - 112 entries

Cura settings are weirdly encoded... After mere replacements, you'll have to enquote two strings (infill_pattern & speed_travel) and dont forget booleans in lowercase. #format #json

  • Best score: 50
  • Best player score: 79
  • Position: #18 / 21
  • Number of attempts: 3
snowflake fractal - 40 entries

From step 0 to step 3 of a fractal

  • Best score: 26
  • Best player score: 657
  • Position: #18 / 18
  • Number of attempts: 1
convert yml into java pojo field - 829 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: 29
  • Position: #8 / 223
  • Number of attempts: 9
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #144 / 249
  • Number of attempts: 1
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 16
  • Position: #307 / 343
  • Number of attempts: 1
camel riding - 769 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 20
  • Position: #255 / 274
  • Number of attempts: 1
Space out the alphabet - 1627 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 17
  • Position: #148 / 440
  • Number of attempts: 6
Line 'em up! - 392 entries

It can be so hard to keep everything neatly lined-up. Somebody clearly hasn't bothered here. Tidy it up, please!

  • Best score: 17
  • Best player score: 19
  • Position: #57 / 110
  • Number of attempts: 4
I forgot quotes - 15931 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #1 / 4161
  • Number of attempts: 8
Shift down - 193 entries

Number words are back.

  • Best score: 19
  • Best player score: 32
  • Position: #58 / 67
  • Number of attempts: 3
-a-b-c- - 3176 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 14
  • Position: #366 / 1129
  • Number of attempts: 7
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: 13
  • Position: #250 / 578
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1913 / 3666
  • Number of attempts: 4
Counting in binary - 477 entries

"a" represents 0; "A" represents 1. Start from zero and count to 15.

  • Best score: 16
  • Best player score: 41
  • Position: #76 / 113
  • Number of attempts: 4
Letter case trickery - 1594 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: #288 / 511
  • Number of attempts: 2
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: 17
  • Position: #710 / 1072
  • Number of attempts: 1
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: 35
  • Position: #63 / 69
  • Number of attempts: 3
Number an outline - 249 entries

The indent and words are right, but the numbers are all wrong.

  • Best score: 25
  • Best player score: 43
  • Position: #31 / 75
  • Number of attempts: 1
Words in parens - 12854 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1201 / 3945
  • Number of attempts: 6
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: 33
  • Position: #51 / 133
  • Number of attempts: 4
Assign list - 169 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 45
  • Position: #32 / 59
  • Number of attempts: 3
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: 19
  • Position: #163 / 302
  • Number of attempts: 1
Dehamlizing - 180 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 43
  • Position: #46 / 69
  • Number of attempts: 2
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: 27
  • Position: #227 / 473
  • Number of attempts: 5
Vertical Limit - 2437 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #203 / 736
  • Number of attempts: 8
replacing each line of a block selection - 2946 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #244 / 767
  • Number of attempts: 5
Switch function arguments - 2078 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 15
  • Position: #533 / 651
  • Number of attempts: 2
switch variable - 5031 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #737 / 1735
  • Number of attempts: 3
The meaning - 558 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #182 / 356
  • Number of attempts: 2
Reformat long lines - 341 entries

Rearrange this ruby method call to put each parameter on its own line. Could become a useful macro.

  • Best score: 15
  • Best player score: 21
  • Position: #103 / 130
  • Number of attempts: 2
Numbering a List - 1859 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Position: #304 / 639
  • Number of attempts: 1
Shebangs for all - 1912 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: 19
  • Position: #385 / 500
  • Number of attempts: 1
A Simple One - 1001 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #339 / 643
  • Number of attempts: 1
Increment, increment, increment.... - 662 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #254 / 401
  • Number of attempts: 2
Hatsuyume - 457 entries

http://en.wikipedia.org/wiki/Hatsuyume

  • Best score: 16
  • Best player score: 22
  • Position: #36 / 175
  • Number of attempts: 8
Reformat a C golf submission - 552 entries

Take this C golf submission (for the "tiny but standards-compliant Hello World program" category, naturally), and turn it into formatted C code.

  • Best score: 22
  • Best player score: 38
  • Position: #152 / 199
  • Number of attempts: 5
Whitespace, empty lines and tabs - 3332 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 31
  • Position: #519 / 736
  • Number of attempts: 2
Simple text editing with Vim - 12280 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1046 / 3579
  • Number of attempts: 5
Reformat/Refactor a Golfer Class - 6555 entries

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

  • Best score: 32
  • Best player score: 36
  • Position: #431 / 1613
  • Number of attempts: 6

Contributed Challenges

Find fix point of cos - 1120 entries

Write a function to find the fix point of cos. It is not a good code; It is just to use vim. Inspired by the excellent https://mvanier.livejournal.com/2897.html about the Y combinator.

zmf_tim
Twitter:

Emacs / lisp / et tout le reste. 🐘@hettomei@mastodon.social

entered into 63 challenges

contributed 1 challenges