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]

37785 active golfers, 450044 entries, 570 challenges

Open VimGolf challenges

Transpose a python matrix - 847 entries

Rotate the matrix in 90 degrees.

Create a diamond comment - 322 entries

Encapsulate the text in a diamond pattern.

Lowercase first characters - 480 entries

This is the (abridged) input for Day 3 in Advent of Code 2019. The output is a format more suitable for Prolog programming: the two lines of input become two lists of pairs, joined together in a wires functor.

Make list of numbers from 1 to 30 more compact, but more confusing - 95 entries

Change the naming logic of numbers to end up with less lines.

Write Hello World in the 'i use arch btw' -programming language - 31 entries

> "I use Arch btw" is an esoteric programming language based on Brainfuck in which the Brainfuck commands have been replaced with the following keywords: i, use, arch, linux, btw, by, the, way.

Migrated to Postgres! - 321 entries

Celebration completion of this project.

Increment number for every 10 lines - 228 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

simple replacements - 1690 entries

The goal is to see the replacement commands in action.

Inverting Lines - 1858 entries

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

CSV to MD format - 401 entries

To convert a CSV list to Markdown list

Generate a very basic Python constructor - 314 entries

I actually needed to do this myself, so I look forward to learning how.

Python dataclasses - 1120 entries

Simple challenge to extract fields from a Python class

Count to 100 in word form - 120 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.

RUST HTML to maud. - 18 entries

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

RUST Cargo.toml version to last - 325 entries

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

대법원 인명용 한자 바인딩(Combine Hangul and Chinese characters) - 27 entries

The character system of Chinese characters has caused difficulties in character encoding for a long time. The content is to link the Korean name and the corresponding Chinese character. input is simply pasted Chinese table, and you need to make it in json format. Most of them are omitted because there are too many Chinese characters, but I think it's better to work from "가" to "힐". There are a few rules here. 1. One Hangul must correspond to multiple Chinese characters. 2. In the case of "a(b c)", "a" is a redundant Chinese character, so you must remove "a" and use only "b c". 3. There are some characters here that don't appear to be an encoding issue, but they should all be used. 4. Should follow json format, Chinese characters are arrays. 문자인코딩의 역사속에서 한문은 여러가지 난제를 만들어왔습니다. 이 문제는 대법원 인명용 한자를 바인딩하는 것입니다. input은 단순히 인명용한자 표를 붙여넣기 한 것이며, 이것을 json형식으로 만들어야합니다. 한자가 너무 많은 관계로 대부분을 생략하였으나, 기본적으로 "가"부터 "힐"까지 모두 동작하는 것이 좋다고 생각합니다. 여기에는 몇가지 규칙이 있습니다. 1. 한글 하나에는 여러개의 한자가 대응합니다. 2. "a(b c)"같은 경우 "a"는 중복된 한자이므로, "a"를 제거하고 "b c"만을 사용해야합니다. 3. 몇몇 한자는 인코딩의 문제로 보이지 않을 수 있습니다. 그러나 모두 사용해야합니다. 4. json형식을 따르며, 한자는 배열입니다.

RUST match with enum for Coin - 180 entries

RUST match with enum for Coin rusty practice on vimgolf

Making 3 line function a one liner. - 311 entries

Simple challenge for frequent action while programming.

Modernise code - 1350 entries

Modernise and clean up some C++ code.

Staircase - 145 entries

Going downstairs, while singing the alphabet song. Some vb practice to us all. Would it be much easier to make it go from left to right instead?

vimtutor, but you can cheat - 19 entries

It's time to revisit vimtutor, but as an experienced Vim user! Your goal is to change the file to appear as if you had gone through the tutorial, but you do NOT need to actually complete the tutorial as written or do anything that doesn't result in changes to the file. You may use whatever you have in your Vim toolbelt that's allowed under VimGolf rules. The whole tutorial is too large to submit, so only the relevant lesson headers and associated practice lines are presented in this challenge. You will have to reference the tutor for the original instructions if you need them:

Enumerate Bullets - 308 entries

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

Put a cross in the square - 209 entries

Put a cross in the square

swap number pairs - 2021 entries

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

HS Final exam vimgolf - 885 entries

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

Extend shell script - 109 entries

Just add some more stuff

Easy modification of ssh config - 343 entries

Just add another alias to each worker

ssh config skills - 249 entries

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

Change double quotes to single quotes, but with a twist - 290 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.

C to python code snippet - 81 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?

Mr. Hacker - 82 entries

Elvin is hacker. He has piece of users database from some social net site. Recently he installed Vim, and he wants to convert CSV DB to specific format `key=value' where `key' is login and `value' is password, but password in DB is encrypted in ROT13. Help him.

Python: Def to Lambda - 435 entries


Turn the x - 316 entries

Turn the x to a +

Format the CSS - 136 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!!

Rural Post - 4405 entries

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

Levenshtein distance - 104 entries

Compute distance for each pair. Notice that this recursive implementation is very inefficient. Wagner-Fischer algorithm is iterative and much faster. #vimscript

Satisfy the go linter - 2350 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?

Add quotes to ansible playbook - 939 entries

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

Multiline to Single Line - 679 entries

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

Data reformat - 284 entries

Reformat this copy-paste data! #csv

xrandr outputs and dashes - 670 entries

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

From a Thunderlink to a Markdown link - 756 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.

Capitalize the Names - 381 entries

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

Yo To Hello - 1122 entries

Simply Turn Yo To Hello

C# function to F# - 25 entries

Converting from C# to F# is not hard, but requires some manual labor. Here you should convert a C# function using a C# class to a F# function using a C# class.

C# data class to F# record - 68 entries

Converting from C# to F# is not hard, but requires some manual labor. Here you should convert from a C# data class to a F# record.

Replace pattern with 1, 2, 3, ... on each line - 1112 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

Alphabet soup - 424 entries

Create a column of all alphabet characters organized in a funky way

Reconstruct the actual output from my unit test tool report - 151 entries

When a test fails, my unit test tool reports differences between the actual output and the expected output as follow: - line in the expected output but missing in the actual output are prefixed with a dash - unexpected lines in the actual output are prefixed with a plus sign - comments added by the unit test tool are prefixed with a question mark - common lines are showed `as-is` (well, almost;) From that "diff" format, I would like to reconstruct the actual output.

Right Align Part of the line - 132 entries

The challenge is to right align a part of the line - this is useful in some SQL queries where it's more clear which are the fields displayed

VimGolf Chatter