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

Paste a column after a column - 2413 entries

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

  • Best score: 14
  • Best player score: 16
  • Position: #138 / 523
  • Number of attempts: 8
HS exam question - 1523 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 64
  • Position: #146 / 404
  • Number of attempts: 3
Reformat symbols in list - 1507 entries

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

  • Best score: 24
  • Best player score: 25
  • Position: #90 / 334
  • Number of attempts: 11
Poorly indented Python comments - 1275 entries

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

  • Best score: 15
  • Best player score: 16
  • Position: #59 / 213
  • Number of attempts: 13
delete swap - 1650 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #222 / 514
  • Number of attempts: 3
Generate a very basic Python constructor (fixed) - 1231 entries

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

  • Best score: 29
  • Best player score: 30
  • Position: #71 / 260
  • Number of attempts: 11
Fix the shell script! - 2431 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 36
  • Position: #345 / 569
  • Number of attempts: 1
simple replacements - 1710 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 20
  • Position: #107 / 378
  • Number of attempts: 7
Python dataclasses - 1121 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 24
  • Position: #136 / 281
  • Number of attempts: 6
Python: Def to Lambda - 441 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #49 / 154
  • Number of attempts: 1
Satisfy the go linter - 2360 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: 21
  • Position: #186 / 465
  • Number of attempts: 8
xrandr outputs and dashes - 671 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: 13
  • Position: #163 / 218
  • Number of attempts: 9
Simple, Practical, and Common - 33483 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: #1188 / 7384
  • Number of attempts: 11
Hogwarts Email Sorting - 891 entries

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

  • Best score: 20
  • Best player score: 21
  • Position: #100 / 257
  • Number of attempts: 4
Swap values - 4554 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 12
  • Position: #391 / 1259
  • Number of attempts: 5
Right Align Part of the line - 133 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

  • Best score: 19
  • Best player score: 21
  • Position: #26 / 42
  • Number of attempts: 5
Quote modules - 1066 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 22
  • Position: #79 / 278
  • Number of attempts: 9
Add semicolons - 10831 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1165 / 3055
  • Number of attempts: 3
Bad Copy Syntax - 2009 entries

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

  • Best score: 18
  • Best player score: 22
  • Position: #330 / 518
  • Number of attempts: 1
multiple cursor alternative - 1488 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: 20
  • Position: #194 / 378
  • Number of attempts: 6
From argument to object - 1481 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?

  • Best score: 17
  • Best player score: 20
  • Position: #343 / 453
  • Number of attempts: 2
Search and Replace 0 - 4851 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #326 / 1604
  • Number of attempts: 5
Preferably without multi-cursor plugin - 539 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: 31
  • Position: #36 / 128
  • Number of attempts: 8
On Being Stylish - 73 entries

Your PR cannot be accepted if you don't follow our corporate style guide.

  • Best score: 33
  • Best player score: 46
  • Position: #15 / 20
  • Number of attempts: 7
Make HTML List - 1050 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 41
  • Position: #98 / 273
  • Number of attempts: 2
Learn some german verbs - 532 entries

The list needs to be structured so we can print in verbatim and feel ok about how it looks.

  • Best score: 21
  • Best player score: 28
  • Position: #90 / 132
  • Number of attempts: 1
Interweave two blocks of text - 641 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

  • Best score: 15
  • Best player score: 16
  • Position: #47 / 212
  • Number of attempts: 7
ninja substitution - 1399 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 15
  • Position: #134 / 265
  • Number of attempts: 16
Vice versa - 7865 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #737 / 2114
  • Number of attempts: 7
Order and join - 965 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 11
  • Position: #135 / 258
  • Number of attempts: 7
Replace and keep the case - 415 entries

Replace all instance of plugin and Plugin to device and Device.

  • Best score: 26
  • Best player score: 27
  • Position: #61 / 117
  • Number of attempts: 8
Hello ${world} - 300 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 25
  • Position: #41 / 95
  • Number of attempts: 4
move titles next to url, in quotes - 510 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 19
  • Position: #12 / 137
  • Number of attempts: 7
Array transposition - 2407 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 18
  • Position: #203 / 445
  • Number of attempts: 7
Swap assigned value - 628 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #168 / 252
  • Number of attempts: 8
Collect List - 4267 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 15
  • Position: #674 / 1188
  • Number of attempts: 2
camel riding - 775 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 16
  • Position: #88 / 277
  • Number of attempts: 3
Logging with key - 302 entries

Sometimes it is better to log with meaningful key

  • Best score: 21
  • Best player score: 30
  • Position: #53 / 87
  • Number of attempts: 1
Fix the XML - 1000 entries

The challenge consists in having a valid xml from an incomplete source.

  • Best score: 18
  • Best player score: 18
  • Position: #49 / 287
  • Number of attempts: 12
Line 'em up! - 396 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: 17
  • Position: #31 / 112
  • Number of attempts: 6
Condensed Cases - 794 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 12
  • Position: #27 / 244
  • Number of attempts: 4
I forgot quotes - 15946 entries

Oops.

  • Best score: 10
  • Best player score: 14
  • Position: #1559 / 4166
  • Number of attempts: 6
Don't know what this is - 1996 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: 12
  • Position: #198 / 581
  • Number of attempts: 7
A HAPPY NEW YEAR 2014 ! - 10652 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2164 / 3677
  • Number of attempts: 2
attr_aligner - 3454 entries

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

  • Best score: 19
  • Best player score: 32
  • Position: #451 / 695
  • Number of attempts: 4
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #134 / 3950
  • Number of attempts: 2
Execute immediate SQL - 87 entries

Sql string tranformation ...

  • Best score: 58
  • Best player score: 70
  • Position: #13 / 31
  • Number of attempts: 4
Python: Lots of function arguments - 105 entries

The function definition is too long for one line. The modeline helps you with some typical Python indent settings.

  • Best score: 6
  • Best player score: 16
  • Position: #38 / 48
  • Number of attempts: 1
Add links to an existing HTML table - 78 entries

Add these links at that top to the respective table cell. First link, first cell, etc.

  • Best score: 42
  • Best player score: 43
  • Position: #9 / 30
  • Number of attempts: 4
SFD-ROC: vimvimvim - 1594 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #220 / 443
  • Number of attempts: 6
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #34 / 748
  • Number of attempts: 8
Exchanging Quotes - 824 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 31
  • Position: #36 / 227
  • Number of attempts: 8
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #61 / 772
  • Number of attempts: 11
Switch function arguments - 2085 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #74 / 653
  • Number of attempts: 5
Remove noise from HTTP log - 700 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 16
  • Position: #192 / 272
  • Number of attempts: 1
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #803 / 1742
  • Number of attempts: 3
HTML to Haml - 843 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 43
  • Position: #134 / 203
  • Number of attempts: 1
CSV to JSON - 173 entries

A search for shortest vimissh way to convert CSV to JSON.

  • Best score: 56
  • Best player score: 76
  • Position: #15 / 66
  • Number of attempts: 6
Change the content of a string - 1502 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #277 / 567
  • Number of attempts: 7
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #349 / 3626
  • Number of attempts: 13
Reformat/Refactor a Golfer Class - 6749 entries

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

  • Best score: 31
  • Best player score: 32
  • Position: #74 / 1652
  • Number of attempts: 14
Francois Marais
Twitter:

entered into 61 challenges

contributed 0 challenges