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

Replace word while reserving first letter case - 636 entries

Window -> Door window -> door Windows -> Windows windows -> windows

  • Best score: 24
  • Best player score: 33
  • Position: #55 / 122
  • Number of attempts: 5
Quicksort - 2035 entries

We need the numbers in the first row sorted as quickly as possible! Be careful not to disturb the data below the divider though: that must remain unchanged.

  • Best score: 6
  • Best player score: 6
  • Position: #39 / 450
  • Number of attempts: 7
Find fix point of cos - 1426 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: 15
  • Position: #106 / 422
  • Number of attempts: 4
Surround the 'z' character with brackets, quotes, and print as formatted string. - 567 entries

Surround the 'z' character with brackets, quotes, and print as formatted string.

  • Best score: 17
  • Best player score: 17
  • Position: #26 / 318
  • Number of attempts: 3
Paste a column after a column - 2604 entries

This task is very common while using multi-cursor. What is the elegant vim way ?

  • Best score: 14
  • Best player score: 14
  • Position: #6 / 565
  • Number of attempts: 2
Reformat symbols in list - 1633 entries

Saw this in some lecture, easy reformatting using multiple cursor in VS Code

  • Best score: 24
  • Best player score: 25
  • Position: #84 / 351
  • Number of attempts: 10
delete swap - 1801 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #55 / 561
  • Number of attempts: 2
Put a newline after every 10 lines in vim - 1664 entries

Goal is to put a newline after every 10 lines in vim.

  • Best score: 10
  • Best player score: 11
  • Position: #48 / 559
  • Number of attempts: 3
hello-world-vimgolf - 2505 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #35 / 712
  • Number of attempts: 4
Inverting Lines - 1923 entries

A simple challenge to invert all lines, except the first.

  • Best score: 10
  • Best player score: 10
  • Position: #37 / 516
  • Number of attempts: 5
Making 3 line function a one liner. - 340 entries

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #148 / 209
  • Number of attempts: 2
Modernise code - 1410 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 35
  • Position: #83 / 326
  • Number of attempts: 5
swap number pairs - 2125 entries

Swap the numbers in a bunch of 2-element arrays.

  • Best score: 16
  • Best player score: 34
  • Position: #290 / 386
  • Number of attempts: 4
Python: Def to Lambda - 460 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #32 / 157
  • Number of attempts: 9
Rural Post - 4563 entries

Simple challenge to remove all but the post code on each line

  • Best score: 9
  • Best player score: 9
  • Position: #89 / 1113
  • Number of attempts: 7
Satisfy the go linter - 2448 entries

You just came up with this briliant go vars package. But dang, you forgot to add comments to the exported variables. Can you add a comment over each variable with a TODO-placeholder?

  • Best score: 20
  • Best player score: 20
  • Position: #88 / 484
  • Number of attempts: 9
Add quotes to ansible playbook - 1008 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #155 / 317
  • Number of attempts: 9
Multiline to Single Line - 736 entries

Convert a multiline, indented file to a single line with no whitespace

  • Best score: 5
  • Best player score: 5
  • Position: #96 / 312
  • Number of attempts: 8
From a Thunderlink to a Markdown link - 779 entries

ThunderLinks are durable hyperlinks to specific email messages generated from Thunderbird in HTML format. Leverage the power of vim to make them suitable for a markdown-formatted file.

  • Best score: 18
  • Best player score: 21
  • Position: #101 / 173
  • Number of attempts: 11
Swap values - 4644 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 11
  • Position: #340 / 1275
  • Number of attempts: 5
prepend * to every non-blank line - 6358 entries

Prepend an asterisk to every non-blank line in the input file.

  • Best score: 10
  • Best player score: 10
  • Position: #362 / 1551
  • Number of attempts: 5
One number per line - 18780 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 18
  • Position: #1554 / 3877
  • Number of attempts: 10
Quote modules (ver.2) - 241 entries

Complete golang import statement.

  • Best score: 22
  • Best player score: 33
  • Position: #56 / 61
  • Number of attempts: 2
citizen_hacks_2019_challenge2 - 200 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #52 / 103
  • Number of attempts: 3
Add semicolons - 10891 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Position: #682 / 3077
  • Number of attempts: 4
Bad Copy Syntax - 2050 entries

Copy should be from right to left, but sometimes you type it wrong.

  • Best score: 18
  • Best player score: 35
  • Position: #480 / 533
  • Number of attempts: 1
remove lines containing the word "reader" - 3610 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #469 / 1172
  • Number of attempts: 7
citizen_hacks_2019_challenge3 - 39 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 4
  • Best player score: 4
  • Position: #21 / 36
  • Number of attempts: 1
Box it - 7939 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Position: #416 / 1885
  • Number of attempts: 9
Every other line - 2922 entries

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #76 / 706
  • Number of attempts: 4
Copy three lines - 2875 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #173 / 641
  • Number of attempts: 8
Array propagate - 339 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 42
  • Position: #109 / 120
  • Number of attempts: 1
Preferably without multi-cursor plugin - 542 entries

Originally asked as question on reddit by kpthunder: https://www.reddit.com/r/vim/comments/9fvsro/what_is_the_most_efficient_way_to_go_about/

  • Best score: 30
  • Best player score: 35
  • Position: #67 / 130
  • Number of attempts: 5
Just the middle - 11500 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #1461 / 4216
  • Number of attempts: 5
Make HTML List - 1061 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 46
  • Position: #143 / 274
  • Number of attempts: 3
Basic renumbering - 5685 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #252 / 1270
  • Number of attempts: 6
Vice versa - 7968 entries

Little role switching.

  • Best score: 12
  • Best player score: 12
  • Position: #582 / 2144
  • Number of attempts: 14
citizen_hacks_2019_challenge4 - 99 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 5
  • Best player score: 5
  • Position: #38 / 66
  • Number of attempts: 2
One to Ten - 2234 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

  • Best score: 12
  • Best player score: 12
  • Position: #328 / 679
  • Number of attempts: 6
citizen_hacks_2019_challenge5 - 147 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #37 / 77
  • Number of attempts: 3
Line under headers - 2068 entries

Put a line under each header, and remove the other markdown formatting.

  • Best score: 24
  • Best player score: 36
  • Position: #398 / 508
  • Number of attempts: 1
move titles next to url, in quotes - 539 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 19
  • Position: #10 / 144
  • Number of attempts: 8
Collect List - 4308 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 12
  • Position: #509 / 1192
  • Number of attempts: 4
I forgot quotes - 16051 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #1104 / 4194
  • Number of attempts: 8
-a-b-c- - 3216 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #298 / 1138
  • Number of attempts: 6
Do you demand a shrubbery? - 1164 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 42
  • Position: #301 / 301
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10699 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1569 / 3695
  • Number of attempts: 4
Words in parens - 12969 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #1154 / 3970
  • Number of attempts: 7
citizen_hacks_2019_challenge1 - 53 entries

For the Citizen Hacks 2019 Vim competition

  • Best score: 5
  • Best player score: 5
  • Position: #22 / 45
  • Number of attempts: 1
switch variable - 5085 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #635 / 1750
  • Number of attempts: 6
Shebangs for all - 2046 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: #59 / 522
  • Number of attempts: 12
A Simple One - 1064 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: #513 / 670
  • Number of attempts: 5
Reverse and count - 486 entries

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

  • Best score: 18
  • Best player score: 18
  • Position: #8 / 179
  • Number of attempts: 2

Contributed Challenges

Python dataclasses - 1214 entries

Simple challenge to extract fields from a Python class

Paste a column after a column - 2604 entries

This task is very common while using multi-cursor. What is the elegant vim way ?

Column wise pasting - 229 entries

Make a table from 3 columns

extract struct tag in go - 83 entries

Can you extract all struct tags in the fewest keystrokes possible?

Kha Nguyen
Twitter:

Programmer

entered into 53 challenges

contributed 4 challenges