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]

30167 active golfers, 368522 entries, 507 challenges

Open VimGolf challenges

Increment each number - 921 entries

Increment each number individually by one

attr_aligner - 3346 entries

Two attr keywords. Two separate indentations. Align the colons.

Search and Replace 0 - 4508 entries

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

Split line with dots - 2074 entries

This line is too long, split it.

Put the months in order - 884 entries

Our contractor thought that months should be in alphabetical order. Put them in calendar order please.

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

multiple cursor alternative - 1409 entries


quotes inside quotes - 2995 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 :)

Multiline to Single Line - 217 entries

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

ssh config skills - 127 entries

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

That hyphen - 2456 entries

"vim vi improved"

Cool or not? - 721 entries

abc trying to be cool or not...

Two pairs of cluster of letters creates word - 681 entries

Clean and group.

Enumerate Bullets - 60 entries

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

Alphabet soup - 241 entries

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

Delete to the end of the current line - 699 entries

Delete to the end of the current line, but keep the character under the cursor.

From argument to object - 1245 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

html paragraph to table - 582 entries

reformat html paragraph to table

convert yml into java pojo field - 798 entries

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

Extract argument from function - 2175 entries

The aim is to see if you can do some refactoring very fast.

replacing each line of a block selection - 2739 entries

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

Easy modification of ssh config - 78 entries

Just add another alias to each worker

Don't know what this is - 1903 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

Change part of a function name in multiple occurrences - 583 entries

Change the middle part of the function name in multiple places, preferably using the next and dot commands.

Whitespace, empty lines and tabs - 2761 entries

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

Vertical Limit - 2293 entries

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

Data reformat - 160 entries

Reformat this copy-paste data! #csv

comment and uncomment code inline - 971 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

Capitalize the Names - 168 entries

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

Space out the alphabet - 1519 entries

Put 3 spaces between adjacent letters.

Adam's challenge - 902 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

Saving the hashes(#) - 1920 entries

The following file is copied from 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.

Missing Library and a Typo - 814 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

Switch function arguments - 1918 entries

How to switch two arguments of a function.

move titles next to url, in quotes - 430 entries

had trouble with something similar

Align commas - 990 entries

There are 15,000 aligning challenges on, and they're all exactly the same. I hope this one is a little different.

Letter case trickery - 1507 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.

Make it more readable - 1842 entries

Insert blank lines to make it more organized and readable

Fiddle percentages into real numbers - 776 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

Order and join - 831 entries

There's something special about the input order.

Python: Def to Lambda - 97 entries


Refactor typescript arrow function type - 233 entries

Make arrow function type less verbose and easier to read

comments galore - 942 entries

Basic comment reformatting

Numbering a List - 1773 entries

Pretty simple, number the list.

대법원 인명용 한자 바인딩(Combine Hangul and Chinese characters) - 17 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형식을 따르며, 한자는 배열입니다.

Make HTML List - 964 entries

Turn the comma separated list into an unordered html list.

ASCII-art Histogram - 249 entries

Create an ASCCI-art histogram for the given numbers. Make sure not to leave trailing whitespaces. Thanks to VimGolf I recently discovered a feature of Vim thAT blew my mind. I'm curious to see what real ninjas make of it ;-)

SFD-ROC: vimvimvim - 1441 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

Shebangs for all - 1718 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.

Turn the x - 83 entries

Turn the x to a +

VimGolf Chatter