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

Poorly indented Python comments - 42 entries

Fix the alignment of some Python comments as quickly as possible.

  • Best score: 15
  • Best player score: 30
  • Position: #11 / 16
  • Number of attempts: 2
2 quick changes and a numbered list - 47 entries

The ascii will not be lost, but rather numbered in 4 digit blocks with leading zeros.

  • Best score: 38
  • Best player score: 44
  • Position: #11 / 22
  • Number of attempts: 2
delete swap - 140 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #13 / 50
  • Number of attempts: 4
Generate a very basic Python constructor (fixed) - 440 entries

Original by @BiddulphCaleb (http://www.vimgolf.com/challenges/6019f1c4642668000cee11e8) - had some extra spaces in output file.

  • Best score: 29
  • Best player score: 29
  • Position: #20 / 105
  • Number of attempts: 13
Fix the shell script! - 807 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 26
  • Position: #21 / 207
  • Number of attempts: 7
Visual block training - 366 entries

You see the input. You see the output. Go.

  • Best score: 18
  • Best player score: 23
  • Position: #26 / 79
  • Number of attempts: 8
Put a newline after every 10 lines in vim - 852 entries

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

  • Best score: 10
  • Best player score: 11
  • Position: #99 / 301
  • Number of attempts: 4
Wikitext headings to markdown - 559 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 21
  • Position: #32 / 126
  • Number of attempts: 4
hello-world-vimgolf - 1417 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #173 / 407
  • Number of attempts: 2
Fill in the chess board - 496 entries

Fill in the name of each square using its file (a-h) and rank (1-8).

  • Best score: 19
  • Best player score: 19
  • Position: #16 / 105
  • Number of attempts: 12
Plotting some variables in python - 1134 entries

4 sets of (x,y) variables to plot. Just increment the numbers! Well, let's change the colors of the lines as well. Oh and we meant to plot the absolute values of course.

  • Best score: 34
  • Best player score: 37
  • Position: #69 / 238
  • Number of attempts: 6
Transpose a python matrix - 541 entries

Rotate the matrix in 90 degrees.

  • Best score: 23
  • Best player score: 37
  • Position: #37 / 104
  • Number of attempts: 4
Increment number for every 10 lines - 151 entries

The file consists of 2 columns (code and percentage). We need to add 2 more columns with increasing number for 4th column (Xcols) and increment 3rd column (Ycols) only for every 10 lines with reset of 4th column

  • Best score: 25
  • Best player score: 28
  • Position: #19 / 44
  • Number of attempts: 4
simple replacements - 1046 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 20
  • Position: #82 / 232
  • Number of attempts: 4
Inverting Lines - 1274 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #110 / 354
  • Number of attempts: 3
CSV to MD format - 276 entries

To convert a CSV list to Markdown list

  • Best score: 36
  • Best player score: 62
  • Position: #31 / 64
  • Number of attempts: 6
Python dataclasses - 631 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 19
  • Position: #33 / 165
  • Number of attempts: 4
Count to 100 in word form - 52 entries

Write all the numbers from 1 to 100, using their word forms rather than the digit form. Most of the parts you will need are included in the input file. Use hyphens when appropriate.

  • Best score: 55
  • Best player score: 68
  • Position: #5 / 15
  • Number of attempts: 4
RUST HTML to maud. - 15 entries

RUST HTML to maud. maud is one of the template engines for server-side rendering based on rust. rusty practice on vimgolf

  • Best score: 135
  • Best player score: 159
  • Position: #2 / 7
  • Number of attempts: 4
RUST Cargo.toml version to last - 222 entries

RUST Cargo.toml version to last. rusty practice on vimgolf

  • Best score: 16
  • Best player score: 17
  • Position: #39 / 65
  • Number of attempts: 5
RUST match with enum for Coin - 143 entries

RUST match with enum for Coin rusty practice on vimgolf

  • Best score: 84
  • Best player score: 90
  • Position: #8 / 39
  • Number of attempts: 4
Modernise code - 815 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 36
  • Position: #66 / 187
  • Number of attempts: 2
Enumerate Bullets - 177 entries

We will need to refer to the bullet points in our document explicitly later, so we need to assign them some ID's!

  • Best score: 20
  • Best player score: 25
  • Position: #31 / 47
  • Number of attempts: 4
Put a cross in the square - 121 entries

Put a cross in the square

  • Best score: 20
  • Best player score: 23
  • Position: #29 / 54
  • Number of attempts: 2
swap number pairs - 1434 entries

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

  • Best score: 16
  • Best player score: 17
  • Position: #56 / 277
  • Number of attempts: 7
HS Final exam vimgolf - 647 entries

Change the initial file to a single line containing all names comma-separated with numbers inside parentheses.

  • Best score: 21
  • Best player score: 24
  • Position: #73 / 173
  • Number of attempts: 4
Extend shell script - 81 entries

Just add some more stuff

  • Best score: 37
  • Best player score: 39
  • Position: #9 / 31
  • Number of attempts: 8
Easy modification of ssh config - 195 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 24
  • Position: #9 / 59
  • Number of attempts: 4
ssh config skills - 196 entries

Parse output from `kuebctl get no -o wide` into an .ssh/config file!

  • Best score: 41
  • Best player score: 41
  • Position: #10 / 48
  • Number of attempts: 8
Change double quotes to single quotes, but with a twist - 248 entries

Although this challenge is in the context of a Python function, you don't need to know Python to do this challenge. It is to add contexts and interesting constraints. The file contains a function that prints a multi-line string literal. I wrote the string literal with double quotes, but then I decided to use single quotes instead, and that's your challenge. However, interestingly enough, the string itself contains single and double quotes. This means, inside the string literal, the originally escaped double quotes no longer need to be escaped, but the single quotes now need to be escaped. Note that the triple double quotes in the docstring should be left alone.

  • Best score: 22
  • Best player score: 22
  • Position: #19 / 48
  • Number of attempts: 7
C to python code snippet - 58 entries

C code can be easily translated into Python code. However, the difference in syntax can make this process tedious and time-consuming. Can Vim help you here?

  • Best score: 48
  • Best player score: 48
  • Position: #2 / 19
  • Number of attempts: 7
Python: Def to Lambda - 348 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #67 / 119
  • Number of attempts: 4
Format the CSS - 90 entries

You just copied some CSS color names from the web and need to add them to your python module. Create the COLORS variable and assign a dict() with the names as keys and hex-colors as values. BEWARE OF THE TABS!!

  • Best score: 41
  • Best player score: 43
  • Position: #10 / 35
  • Number of attempts: 4
Rural Post - 4087 entries

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

  • Best score: 9
  • Best player score: 10
  • Position: #353 / 1010
  • Number of attempts: 5
Satisfy the go linter - 2003 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: #75 / 401
  • Number of attempts: 4
Add quotes to ansible playbook - 781 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #28 / 246
  • Number of attempts: 2
Multiline to Single Line - 516 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #90 / 234
  • Number of attempts: 1
Data reformat - 238 entries

Reformat this copy-paste data! #csv

  • Best score: 38
  • Best player score: 55
  • Position: #37 / 56
  • Number of attempts: 3
xrandr outputs and dashes - 588 entries

uh oh, different video drivers identify display outputs with more dashes. Quick, need to change this xrandr script!

  • Best score: 12
  • Best player score: 12
  • Position: #91 / 192
  • Number of attempts: 3
From a Thunderlink to a Markdown link - 702 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: 18
  • Position: #54 / 155
  • Number of attempts: 5
Capitalize the Names - 311 entries

I want to capitalize the names in quotes, but just the people's names, not the file names.

  • Best score: 21
  • Best player score: 26
  • Position: #50 / 79
  • Number of attempts: 5
Yo To Hello - 1043 entries

Simply Turn Yo To Hello

  • Best score: 10
  • Best player score: 10
  • Position: #262 / 478
  • Number of attempts: 2
Replace pattern with 1, 2, 3, ... on each line - 1036 entries

For each line replace a search pattern (in this case $) with numbers starting at 1 and then increasing by 1 for each replaced match. a$b$c$ -> a0b1c2

  • Best score: 21
  • Best player score: 26
  • Position: #87 / 208
  • Number of attempts: 6
Simple, Practical, and Common - 32881 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: #2288 / 7266
  • Number of attempts: 8
Hogwarts Email Sorting - 827 entries

Given a list of emails, get the students full name and their associated house.

  • Best score: 20
  • Best player score: 20
  • Position: #43 / 236
  • Number of attempts: 4
Get mail address from outlook format - 589 entries

Create a mail list space separated of mail list formatted by outlook

  • Best score: 15
  • Best player score: 15
  • Position: #74 / 181
  • Number of attempts: 2
prepend * to every non-blank line - 5948 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #358 / 1460
  • Number of attempts: 8
One number per line - 18369 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #705 / 3786
  • Number of attempts: 12
Quote modules - 1013 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 21
  • Position: #31 / 257
  • Number of attempts: 8
add line and index - 81 entries

a missed line and index names need to be added

  • Best score: 44
  • Best player score: 51
  • Position: #14 / 26
  • Number of attempts: 4
Aliases for cd - 819 entries

Create these beautiful aliases with as few strokes as possible. Are you up for the challenge?

  • Best score: 30
  • Best player score: 31
  • Position: #23 / 146
  • Number of attempts: 13
Unsemantic linewrapping - 826 entries

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

  • Best score: 9
  • Best player score: 10
  • Position: #134 / 208
  • Number of attempts: 4
Applying same text modification in several lines - 2741 entries

Remove identical text at the beginning of several lines and the closing parenthesis.

  • Best score: 12
  • Best player score: 13
  • Position: #250 / 813
  • Number of attempts: 5
Add string initializers to an enum - 759 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 21
  • Position: #66 / 224
  • Number of attempts: 6
SCREAMING_SNAKE_CASE to Title Case - 1106 entries

Convert strings in SCREAMING_SNAKE_CASE to Title Case. Examples: EMPLOYEE_NAME -> Employee Name REVENUE_YEAR_TO_DATE -> Revenue Year To Date SALARY -> Salary

  • Best score: 19
  • Best player score: 20
  • Position: #108 / 230
  • Number of attempts: 3
Add semicolons - 10527 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Position: #671 / 2986
  • Number of attempts: 8
Bad Copy Syntax - 1926 entries

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

  • Best score: 18
  • Best player score: 19
  • Position: #198 / 490
  • Number of attempts: 2
remove lines containing the word "reader" - 3450 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #826 / 1119
  • Number of attempts: 5
Com(m)a Trouble - 3369 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #130 / 758
  • Number of attempts: 6
Box it - 7678 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 22
  • Position: #537 / 1834
  • Number of attempts: 4
citizen_hacks_2019_part5 - 15 entries

For the Citizen Hacks 2019 Vim competition

  • Best score: 48
  • Best player score: 50
  • Position: #3 / 7
  • Number of attempts: 5
Copy three lines - 2786 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #172 / 624
  • Number of attempts: 9
Just the middle - 11124 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3098 / 4109
  • Number of attempts: 1
Team names - 1773 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 18
  • Position: #390 / 569
  • Number of attempts: 3
Subnetting - 102 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 29
  • Position: #12 / 33
  • Number of attempts: 6
Sort yaml structures alphabetically by root key names - 28 entries

sometimes we want to sort structures alphabetically in yaml files

  • Best score: 31
  • Best player score: 35
  • Position: #6 / 15
  • Number of attempts: 2
Python Hello World! Reformatting - 896 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 44
  • Position: #238 / 349
  • Number of attempts: 2
Basic renumbering - 5422 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #243 / 1225
  • Number of attempts: 8
Vice versa - 7508 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #816 / 2038
  • Number of attempts: 5
C Reformatting - 686 entries

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

  • Best score: 30
  • Best player score: 37
  • Position: #57 / 159
  • Number of attempts: 5
One to Ten - 2091 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: #319 / 640
  • Number of attempts: 2
Line under headers - 1911 entries

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

  • Best score: 24
  • Best player score: 27
  • Position: #178 / 470
  • Number of attempts: 9
Increment each number - 946 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 19
  • Position: #112 / 233
  • Number of attempts: 5
Greek Letters - 60 entries

Starting with a list of Greek letters, create a cross-reference table showing all of the Greek alpha-beta. You'll likely need to use digraphs (:help digraphs). Note that while most digraphs can be entered with either character first, lowercase sigma has two digraphs -- s* AND *s! Good luck!

  • Best score: 34
  • Best player score: 64
  • Position: #11 / 22
  • Number of attempts: 10
Restore order to the alphabet - 166 entries

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 13
  • Position: #34 / 62
  • Number of attempts: 4
Entries sort - 74 entries

It cames to my mind a weird idea : sorting parts of my .vimrc. Take few minutes to sort out this, it's easy !

  • Best score: 14
  • Best player score: 14
  • Position: #19 / 34
  • Number of attempts: 3
swap or reverse - 100 entries

Try to swap or reverse the line as needed.

  • Best score: 16
  • Best player score: 16
  • Position: #50 / 61
  • Number of attempts: 2
Line 'em up! - 367 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: 20
  • Position: #62 / 105
  • Number of attempts: 5
I forgot quotes - 15712 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #1084 / 4109
  • Number of attempts: 8
-a-b-c- - 3108 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 14
  • Position: #410 / 1110
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10531 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #1557 / 3636
  • Number of attempts: 2
Recursive Cowsay - 58 entries

Convert 'cowsay' statement to recursive output

  • Best score: 33
  • Best player score: 34
  • Position: #5 / 17
  • Number of attempts: 7
Number an outline - 218 entries

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

  • Best score: 25
  • Best player score: 32
  • Position: #15 / 70
  • Number of attempts: 4
Words in parens - 12725 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1839 / 3915
  • Number of attempts: 2
switch variable - 4901 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #971 / 1698
  • Number of attempts: 1
Line Zipper - 432 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 15
  • Position: #87 / 204
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 461 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

  • Best score: 23
  • Best player score: 25
  • Position: #53 / 142
  • Number of attempts: 5
A Simple One - 913 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: #538 / 607
  • Number of attempts: 1
Table Reshuffle - 338 entries

Fix the column order in this table... also append the new 'username' column.

  • Best score: 22
  • Best player score: 40
  • Position: #103 / 125
  • Number of attempts: 4
Another Mixed-Up Haiku - 216 entries

VimGolf ... a perfect evening?

  • Best score: 21
  • Best player score: 27
  • Position: #55 / 80
  • Number of attempts: 3
Indentation - 446 entries

Indent each line according to the right number of spaces it needs.

  • Best score: 21
  • Best player score: 30
  • Position: #116 / 159
  • Number of attempts: 3
Turn this csv list into queries - 192 entries

Transform each line of this csv file into a MySQL-ready INSERT query.

  • Best score: 98
  • Best player score: 128
  • Position: #56 / 92
  • Number of attempts: 1
Compile C - 310 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 23
  • Position: #87 / 120
  • Number of attempts: 4
Context Insensitive completion 1 - 424 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #149 / 220
  • Number of attempts: 1
PEP8 Python Wrapping Comments and Code - 162 entries

According to PEP8, long flowy text and code should have different max line lengths. Code: 79 characters max Long flowy text: 72 characters max

  • Best score: 23
  • Best player score: 35
  • Position: #46 / 61
  • Number of attempts: 1
Simple text editing with Vim - 11589 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #644 / 3402
  • Number of attempts: 4
Reformat/Refactor a Golfer Class - 5975 entries

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

  • Best score: 32
  • Best player score: 39
  • Position: #711 / 1476
  • Number of attempts: 8
quemeraisc
Twitter:

entered into 97 challenges

contributed 0 challenges