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

Delete the last function argument in python. - 611 entries

Delete the last function argument in this python script.

  • Best score: 6
  • Best player score: 8
  • Position: #168 / 221
  • Number of attempts: 1
Rearrange array to single level - 1829 entries

The goal is to flatten the array into a single list and remove any empty elements.

  • Best score: 14
  • Best player score: 17
  • Position: #53 / 307
  • Number of attempts: 5
Rearrange array to one line - 889 entries

Rearrange the array content on only one line, and remove trailing commas

  • Best score: 13
  • Best player score: 16
  • Position: #72 / 205
  • Number of attempts: 3
Copy punctuation - 739 entries

I want to copy the last line’s brackets, quotes, and commas to each line. How?

  • Best score: 19
  • Best player score: 30
  • Position: #66 / 181
  • Number of attempts: 6
New teacher - 1519 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 21
  • Position: #70 / 319
  • Number of attempts: 3
Surround the 'z' character with brackets, quotes, and print as formatted string. - 582 entries

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

  • Best score: 17
  • Best player score: 18
  • Position: #283 / 328
  • Number of attempts: 1
delete swap - 1912 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #397 / 580
  • Number of attempts: 2
Fix the shell script! - 2681 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 29
  • Position: #231 / 624
  • Number of attempts: 2
Innocent Monster - 230 entries

You have the tools, just create him!

  • Best score: 60
  • Best player score: 89
  • Position: #30 / 51
  • Number of attempts: 1
Python: Def to Lambda - 492 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 20
  • Position: #111 / 162
  • Number of attempts: 2
Add quotes to ansible playbook - 1049 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #98 / 332
  • Number of attempts: 1
One number per line - 18903 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 16
  • Position: #1050 / 3904
  • Number of attempts: 2
Unsemantic linewrapping - 964 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: 9
  • Position: #107 / 238
  • Number of attempts: 2
Add semicolons - 10956 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1802 / 3098
  • Number of attempts: 1
Wrap the text of an email message to 79 characters - 868 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #351 / 451
  • Number of attempts: 1
Extract argument from function - 2427 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #479 / 772
  • Number of attempts: 2
Start coding format - 168 entries

I used to start coding with following format: int main(){ -(cursor here) }

  • Best score: 22
  • Best player score: 22
  • Position: #35 / 76
  • Number of attempts: 2
Search and Replace 0 - 5159 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1115 / 1674
  • Number of attempts: 1
Just the middle - 11616 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #3251 / 4255
  • Number of attempts: 1
Team names - 1861 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 17
  • Position: #334 / 596
  • Number of attempts: 2
Un"finnish"ed Work - 131 entries

Replace å by a, ä by a and ö by o.

  • Best score: 14
  • Best player score: 15
  • Position: #43 / 65
  • Number of attempts: 1
Remember VimGolf Rules ! - 279 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 7
  • Position: #44 / 149
  • Number of attempts: 1
Stairstep digits - 426 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 12
  • Position: #58 / 154
  • Number of attempts: 1
Simple addition - 351 entries

The right side of the equation is already there. We just need the left one now.

  • Best score: 12
  • Best player score: 12
  • Position: #65 / 128
  • Number of attempts: 4
Adam's challenge - 1042 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #173 / 281
  • Number of attempts: 2
FoodCritic023: Prefer conditional attributes - 193 entries

FoodCritic (www.foodcritic.io) is a lint tool for your Chef (learn.chef.io) cookbooks. FC023 indicates that you should prefer Chef guards over Ruby conditions. This challenge expects you to be able to fix this issue in a sample cookbook, given the FoodCritic output: ================================================================ FC023: Prefer conditional attributes: cookbooks/foo/recipes/default.rb:25 ================================================================ See http://www.foodcritic.io/#FC023 for more details about the changes being made.

  • Best score: 25
  • Best player score: 32
  • Position: #35 / 56
  • Number of attempts: 3
Add to end of each line... kinda - 350 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

  • Best score: 12
  • Best player score: 13
  • Position: #161 / 180
  • Number of attempts: 1
Fun With The Diagonal - 116 entries

change the lowercase characters on the main diagonal to uppercase

  • Best score: 11
  • Best player score: 11
  • Position: #81 / 86
  • Number of attempts: 1
7th Birthday - 237 entries

We have a bunch of numbers written from 0 to 9 in the order present in the text input file. The task is to create 7 by replacing the numbers with dashes.

  • Best score: 19
  • Best player score: 21
  • Position: #31 / 80
  • Number of attempts: 2
Free hyphen! - 199 entries

Just like "Inner hyphens", but I'm giving you a free hyphen to play with. Will your solution be any different?

  • Best score: 9
  • Best player score: 10
  • Position: #41 / 97
  • Number of attempts: 1
Paragraph breaks - 550 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 12
  • Position: #97 / 172
  • Number of attempts: 1
Inner hyphens - 155 entries

Yet another hyphen challenge. Adding 5 hyphens to a file shouldn't be too hard.

  • Best score: 11
  • Best player score: 11
  • Position: #16 / 90
  • Number of attempts: 1
Angular naming conventions - 359 entries

In angular, a directive name follows the camelCase convention. When the directive is used in an HTML template, the words are instead separated by a dash. Go from to the other the fastest!

  • Best score: 18
  • Best player score: 20
  • Position: #81 / 124
  • Number of attempts: 3
Increment each number - 1067 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 16
  • Position: #88 / 260
  • Number of attempts: 2
Join 'em - 258 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #144 / 157
  • Number of attempts: 1
From A to B - 627 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 18
  • Position: #112 / 163
  • Number of attempts: 2
VimGolfNight - 602 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #302 / 356
  • Number of attempts: 2
Mute the second method of this script - 463 entries

prepend a # infront of every line of the second method

  • Best score: 8
  • Best player score: 9
  • Position: #153 / 244
  • Number of attempts: 1
Pretty format for variable declarations - 186 entries

Project standards demand the equal signs must be aligned for better readability.

  • Best score: 13
  • Best player score: 15
  • Position: #36 / 68
  • Number of attempts: 1
-a-b-c- - 3241 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 14
  • Position: #441 / 1146
  • Number of attempts: 1
NBCU Weekly Challenge - Test - 264 entries

Just testing.

  • Best score: 18
  • Best player score: 20
  • Position: #103 / 120
  • Number of attempts: 1
Change name of a variable - 196 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Position: #135 / 147
  • Number of attempts: 1
Where should I put the Newline? - 908 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Position: #439 / 449
  • Number of attempts: 1
Piphilology - 177 entries

Piphilology comprises the creation and use of mnemonic techniques to remember a span of digits of the mathematical constant π. http://en.wikipedia.org/wiki/Piphilology

  • Best score: 28
  • Best player score: 36
  • Position: #25 / 57
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10755 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2537 / 3715
  • Number of attempts: 1
Ninjas Leaderboard - 114 entries

The two lines in "Start file" has an obfuscated email address. Second line give an index (from 1 to 30) to the chars list of the first line, for example, the first char of email (n) is in position 25, second char (i) is in position 19 and s.o.

  • Best score: 25
  • Best player score: 33
  • Position: #17 / 45
  • Number of attempts: 1
Letter case trickery - 1686 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.

  • Best score: 9
  • Best player score: 10
  • Position: #179 / 525
  • Number of attempts: 1
Hole-in-one - 1040 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 18
  • Position: #149 / 307
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 198 entries

col1;col2;col3;col4 A;1;4;5 A;3;4; A;1;4; # New output: col1;col2;col3;col4 A;1(2x);3;4(3x);5 any ideas?

  • Best score: 21
  • Best player score: 21
  • Position: #30 / 80
  • Number of attempts: 2
Coordinates placeholder - 95 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 23
  • Position: #17 / 44
  • Number of attempts: 2
fib.c cleanup - 80 entries

cleanup the file

  • Best score: 15
  • Best player score: 15
  • Position: #5 / 59
  • Number of attempts: 1
A simple change - 484 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 13
  • Position: #57 / 199
  • Number of attempts: 2
Extract text from xml - 150 entries

Extract text from xml file (ignoring commented out elements) and create a one line regex.

  • Best score: 28
  • Best player score: 38
  • Position: #27 / 51
  • Number of attempts: 1
Chucking wood - 152 entries

An exercise in compressing repetitive text. For this challenge, any entry that uses keys outside the main row (such as arrow keys, Home, End, Delete, etc.) will be removed. (Esc is OK, though you should be using C-[ anyway.)

  • Best score: 51
  • Best player score: 75
  • Position: #51 / 54
  • Number of attempts: 1
Unwrap the text of an email message - 203 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 20
  • Position: #41 / 78
  • Number of attempts: 1
SFD-ROC: ROT13 Phonics - 118 entries

A is for apple, b is for ball, etc... This familiar phonics poem has been rotated 13 characters. Make the letter match the word.

  • Best score: 6
  • Best player score: 6
  • Position: #66 / 79
  • Number of attempts: 1
Let's play some Ivmgolf - 1162 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #150 / 459
  • Number of attempts: 2
Aligning function arguments to match a specific coding style - 279 entries

Most projects have specific coding style guidelines. In this case, the argument list must be broken into a new line for each argument, with the argument names right aligned, taking into account pointers.

  • Best score: 16
  • Best player score: 17
  • Position: #32 / 75
  • Number of attempts: 3
Switch function arguments - 2229 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 13
  • Position: #442 / 684
  • Number of attempts: 1
Remove semicolons after expressions - 685 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 7
  • Position: #154 / 270
  • Number of attempts: 1
Case preserving word replacement - 477 entries

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

  • Best score: 19
  • Best player score: 19
  • Position: #70 / 186
  • Number of attempts: 3
Insert a Markdown link - 473 entries

Put a link in a markdown document, using the after-the-paragraph format.

  • Best score: 22
  • Best player score: 31
  • Position: #139 / 157
  • Number of attempts: 1
The holy-grail may help - 405 entries

Can you find it in less than 20 strokes, Arthur?

  • Best score: 16
  • Best player score: 18
  • Position: #198 / 221
  • Number of attempts: 2
Shebangs for all - 2101 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: 12
  • Position: #172 / 532
  • Number of attempts: 2
The Cake is a Lie - 1416 entries

Correct the capitalization of each word

  • Best score: 8
  • Best player score: 8
  • Position: #1 / 542
  • Number of attempts: 2
Context insensitive completion 0 - 605 entries

Buried in the lines you're not supposed to add is the line "Add this line!" Add that line to the top of the file.

  • Best score: 6
  • Best player score: 7
  • Position: #136 / 255
  • Number of attempts: 1
Make Fancy Header - 1108 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #221 / 356
  • Number of attempts: 3
Get rid of html tags - 463 entries

Want to read more about Vim's background? Then get rid of those html tags...

  • Best score: 12
  • Best player score: 15
  • Position: #10 / 261
  • Number of attempts: 1
Change the content of a string - 1799 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 24
  • Position: #394 / 655
  • Number of attempts: 1
Simple text editing with Vim - 13626 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #2247 / 3902
  • Number of attempts: 1
skewcy
Github:

entered into 70 challenges

contributed 0 challenges