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

Simple, Practical, and Common - 33617 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: #117 / 7421
  • Number of attempts: 5
Swap values - 4616 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 13
  • Position: #537 / 1268
  • Number of attempts: 6
V to the i - 4802 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 7
  • Position: #236 / 1893
  • Number of attempts: 2
Split line with dots - 2144 entries

This line is too long, split it.

  • Best score: 15
  • Best player score: 17
  • Position: #242 / 634
  • Number of attempts: 1
multiple cursor alternative - 1519 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: #147 / 380
  • Number of attempts: 4
From argument to object - 1508 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: 18
  • Position: #180 / 458
  • Number of attempts: 1
Every other line - 2910 entries

AaAaAaA

  • Best score: 12
  • Best player score: 12
  • Position: #8 / 703
  • Number of attempts: 9
Copy three lines - 2872 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #204 / 640
  • Number of attempts: 3
Array propagate - 338 entries

Complete the array with the keys as part of the value

  • Best score: 23
  • Best player score: 24
  • Position: #39 / 119
  • Number of attempts: 1
Search and Replace 0 - 4989 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #1000 / 1624
  • Number of attempts: 1
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 9
  • Position: #73 / 701
  • Number of attempts: 5
Just the middle - 11454 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #1870 / 4197
  • Number of attempts: 1
Make HTML List - 1050 entries

Turn the comma separated list into an unordered html list.

  • Best score: 33
  • Best player score: 41
  • Position: #96 / 273
  • Number of attempts: 6
Learn some german verbs - 533 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: 23
  • Position: #66 / 133
  • Number of attempts: 1
Text to HTML Table - 180 entries

Turn the plain text table to an HTML table.

  • Best score: 52
  • Best player score: 63
  • Position: #42 / 53
  • Number of attempts: 1
For all cases. - 161 entries

In this case... change it! :) Watch the line.

  • Best score: 8
  • Best player score: 8
  • Position: #34 / 106
  • Number of attempts: 2
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 14
  • Position: #388 / 1264
  • Number of attempts: 6
Simple addition - 326 entries

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

  • Best score: 12
  • Best player score: 14
  • Position: #87 / 122
  • Number of attempts: 1
Create Leading Zeros - 241 entries

Create leading zeros only for id columns. Please use generic approach!

  • Best score: 23
  • Best player score: 23
  • Position: #7 / 82
  • Number of attempts: 7
Add to end of each line... kinda - 333 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: #113 / 174
  • Number of attempts: 1
Wrap text in quotes - 368 entries

All the blocks of text should be wrapped in quotation marks.

  • Best score: 16
  • Best player score: 16
  • Position: #7 / 122
  • Number of attempts: 1
Fun With The Diagonal - 107 entries

change the lowercase characters on the main diagonal to uppercase

  • Best score: 11
  • Best player score: 11
  • Position: #8 / 81
  • Number of attempts: 1
Vice versa - 7907 entries

Little role switching.

  • Best score: 12
  • Best player score: 16
  • Position: #1125 / 2128
  • Number of attempts: 1
Pretty multi-line bash - 235 entries

Bash line continuations are much prettier when they're column aligned.

  • Best score: 15
  • Best player score: 21
  • Position: #39 / 77
  • Number of attempts: 2
C Reformatting - 690 entries

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

  • Best score: 30
  • Best player score: 39
  • Position: #61 / 163
  • Number of attempts: 2
Lower cased and dashed strings - 49 entries

As I have to generate big fixtures files, I wanted to find a way to format input data the way described by start and end files. Especially the lower-cased-and-dashed ids Not so good to find a pure Vim way, that's why I submit this challenge ;)

  • Best score: 59
  • Best player score: 67
  • Position: #9 / 20
  • Number of attempts: 3
Vim's not included features - 240 entries

Filter not included (-) features in a hypothetical installation of vim.

  • Best score: 23
  • Best player score: 25
  • Position: #16 / 65
  • Number of attempts: 1
Order and join - 983 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #152 / 259
  • Number of attempts: 1
Paragraph breaks - 522 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 13
  • Position: #103 / 167
  • Number of attempts: 1
comments galore - 1045 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #5 / 424
  • Number of attempts: 2
lipsum lines - 278 entries

Convert a quoted block of text into strings in a list.

  • Best score: 28
  • Best player score: 30
  • Position: #33 / 95
  • Number of attempts: 1
Inner hyphens - 136 entries

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

  • Best score: 11
  • Best player score: 12
  • Position: #26 / 82
  • Number of attempts: 1
Sudoku table - 92 entries

Make this simple sudoku table look nice and legible.

  • Best score: 48
  • Best player score: 49
  • Position: #7 / 34
  • Number of attempts: 11
Scrambled numbers - 807 entries

Four is NOT 1. One is 1.

  • Best score: 18
  • Best player score: 23
  • Position: #77 / 184
  • Number of attempts: 1
Align commas - 1095 entries

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

  • Best score: 11
  • Best player score: 19
  • Position: #190 / 246
  • Number of attempts: 3
A grid of punctuation - 137 entries

Create a checkerboard of = and - in an 80×24 grid!

  • Best score: 16
  • Best player score: 17
  • Position: #39 / 61
  • Number of attempts: 1
Manual SQL - 160 entries

Change select and insert queries to simulate inserting a new record.

  • Best score: 48
  • Best player score: 49
  • Position: #4 / 50
  • Number of attempts: 3
Maze path - 48 entries

Follow the given motions and mark your path with Xs. Attention: This maze is quite big (20x20), please set your terminal size to at least 82.

  • Best score: 25
  • Best player score: 64
  • Position: #13 / 17
  • Number of attempts: 1
Generate a list of numbers - 295 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #19 / 140
  • Number of attempts: 1
Separating firstname & lastname - 138 entries

Seperate named with equal tabs.

  • Best score: 19
  • Best player score: 22
  • Position: #19 / 57
  • Number of attempts: 1
Restore order to the alphabet - 201 entries

The numbers are OK. The letters are wonky.

  • Best score: 12
  • Best player score: 13
  • Position: #22 / 72
  • Number of attempts: 5
Mirror Symmetry - 822 entries

Add backslashes.

  • Best score: 7
  • Best player score: 7
  • Position: #14 / 269
  • Number of attempts: 3
From A to B - 591 entries

Mirror and change this text block

  • Best score: 16
  • Best player score: 17
  • Position: #82 / 159
  • Number of attempts: 2
Entries sort - 90 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: 19
  • Position: #37 / 40
  • Number of attempts: 1
Collect List - 4298 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 15
  • Position: #671 / 1190
  • Number of attempts: 1
camel riding - 793 entries

add a prefix on some camelCase variables

  • Best score: 15
  • Best player score: 16
  • Position: #106 / 281
  • Number of attempts: 3
swap or reverse - 126 entries

Try to swap or reverse the line as needed.

  • Best score: 16
  • Best player score: 16
  • Position: #29 / 69
  • Number of attempts: 2
readability - 327 entries

Make the code readable by adding some spaces

  • Best score: 18
  • Best player score: 18
  • Position: #54 / 152
  • Number of attempts: 2
Interleave lines - 185 entries

This is some kind of « paste -d'\n' c b a ». There are many ways to achieve this.. just find the shortest!

  • Best score: 17
  • Best player score: 26
  • Position: #27 / 60
  • Number of attempts: 5
Space out the alphabet - 1657 entries

Put 3 spaces between adjacent letters.

  • Best score: 15
  • Best player score: 15
  • Position: #31 / 444
  • Number of attempts: 5
remove all lines in first part - 211 entries

From the second part, remove all lines in the first part. It can be useful when you have done something from a long list, you want to know what is not done yet!

  • Best score: 13
  • Best player score: 15
  • Position: #26 / 67
  • Number of attempts: 3
Fill visual area - 91 entries

Just have fun!

  • Best score: 20
  • Best player score: 38
  • Position: #19 / 38
  • Number of attempts: 2
Fix the XML - 1039 entries

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

  • Best score: 18
  • Best player score: 24
  • Position: #130 / 290
  • Number of attempts: 2
Line 'em up! - 421 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: #13 / 114
  • Number of attempts: 5
Shuffled numbers - 246 entries

Each number is paired with the number it should follow. That's enough information to put them in order.

  • Best score: 15
  • Best player score: 15
  • Position: #22 / 96
  • Number of attempts: 2
ASCII box - 347 entries

Don't forget to fix typos!

  • Best score: 23
  • Best player score: 23
  • Position: #28 / 107
  • Number of attempts: 4
Condensed Cases - 804 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: 15
  • Position: #164 / 247
  • Number of attempts: 1
I forgot quotes - 15983 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #202 / 4180
  • Number of attempts: 4
Shift down - 209 entries

Number words are back.

  • Best score: 19
  • Best player score: 28
  • Position: #40 / 69
  • Number of attempts: 2
vim1001 - 307 entries

change number 1001 into a "vim1001 sequence". (My first challenge, hope it is not too bad... )

  • Best score: 17
  • Best player score: 21
  • Position: #35 / 110
  • Number of attempts: 4
-a-b-c- - 3213 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #231 / 1137
  • Number of attempts: 4
Count both ways - 1022 entries

Right AND down.

  • Best score: 13
  • Best player score: 16
  • Position: #233 / 354
  • Number of attempts: 2
Suffix sort - 270 entries

Sort from the end of the line, as if the letters in each line were reversed.

  • Best score: 19
  • Best player score: 24
  • Position: #35 / 67
  • Number of attempts: 5
Lisp Condense - 460 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 15
  • Position: #99 / 158
  • Number of attempts: 1
Gray area - 747 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 13
  • Position: #177 / 271
  • Number of attempts: 2
Neither Fizz nor Buzz - 253 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 16
  • Position: #28 / 103
  • Number of attempts: 2
Do you demand a shrubbery? - 1158 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 18
  • Position: #144 / 300
  • Number of attempts: 1
Don't know what this is - 2022 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: #188 / 585
  • Number of attempts: 6
Where should I put the Newline? - 881 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 8
  • Position: #361 / 437
  • Number of attempts: 1
Mess in revision history - 1184 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 23
  • Position: #138 / 250
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10663 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #744 / 3683
  • Number of attempts: 3
Under the cupola - 57 entries

Taking some liberty about the name and plot of the Stephen King's famous novel (and TV series) to make this challenge. Are you able to recreate graphically the key phrase of the story? (I think is gonna be hard!)

  • Best score: 33
  • Best player score: 40
  • Position: #15 / 19
  • Number of attempts: 2
quotes inside quotes - 3159 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 :)

  • Best score: 14
  • Best player score: 16
  • Position: #619 / 1078
  • Number of attempts: 2
Words in parens - 12935 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #564 / 3963
  • Number of attempts: 2
Pairs of numbers - 363 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

  • Best score: 26
  • Best player score: 30
  • Position: #45 / 136
  • Number of attempts: 3
Hole-in-one - 1018 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: 16
  • Position: #84 / 304
  • Number of attempts: 2
abcd > a b c d - 291 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #153 / 222
  • Number of attempts: 1
Readable Rubyhash - 267 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 23
  • Best player score: 27
  • Position: #42 / 95
  • Number of attempts: 1
SFD-ROC: Tic-Tac-Toe - 159 entries

Tic-Tac-Toe You are 'X', and it is your turn. Stop 'O' from winning, and complete the game. Draw a diagonal line through your winning row of three X's.

  • Best score: 25
  • Best player score: 32
  • Position: #22 / 54
  • Number of attempts: 3
maximun and minimun - 73 entries

Find the maximum and minimum of the rows.

  • Best score: 50
  • Best player score: 52
  • Position: #10 / 26
  • Number of attempts: 3
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #84 / 445
  • Number of attempts: 4
Switch function arguments - 2139 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #289 / 663
  • Number of attempts: 1
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #87 / 419
  • Number of attempts: 3
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 13
  • Position: #1178 / 1748
  • Number of attempts: 1
The meaning - 575 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #253 / 363
  • Number of attempts: 1
Increment, increment, increment.... - 688 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #313 / 408
  • Number of attempts: 1
Indentation - 542 entries

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

  • Best score: 20
  • Best player score: 23
  • Position: #33 / 178
  • Number of attempts: 4
Context Insensitive completion 1 - 498 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #121 / 245
  • Number of attempts: 1

Contributed Challenges

Assign numbers to fields - 116 entries

You are given a list of space-separated strings. Add an increasing numeric prefix to each one.

Lifepillar
Twitter:

entered into 88 challenges

contributed 1 challenges