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

Create json from a .env file - 998 entries

A simple everyday task.

  • Best score: 39
  • Best player score: 39
  • Position: #3 / 230
  • Number of attempts: 11
Reordering properties - 880 entries

Arrange the CSS lines for the #topbar selector based on their complete line length, from shortest to longest.

  • Best score: 24
  • Best player score: 52
  • Position: #56 / 209
  • Number of attempts: 4
Sort and Tag - 532 entries

The goal is to sort these lines alphabetically, assign a unique identifier to each line in the format "[01]", "[02]", etc., and then restore the original order of the lines while preserving the assigned identifiers.

  • Best score: 36
  • Best player score: 102
  • Position: #66 / 103
  • Number of attempts: 3
Changing date formats - 509 entries

Change the date format to Y/M/D.

  • Best score: 37
  • Best player score: 85
  • Position: #89 / 151
  • Number of attempts: 2
YAML to dotenv - 1073 entries

Convert this YAML config file to a .env file.

  • Best score: 16
  • Best player score: 16
  • Position: #33 / 236
  • Number of attempts: 13
Change to ascending order - 403 entries

Change each line of numbers consistently from descending to ascending order.

  • Best score: 17
  • Best player score: 17
  • Position: #14 / 100
  • Number of attempts: 6
Generate an entry for each month - 274 entries

The input file contains a URI with a month in it. Generate the URIs for all the other months up to a couple of years

  • Best score: 27
  • Best player score: 32
  • Position: #11 / 72
  • Number of attempts: 8
Fix the git merge conflicts - 238 entries

Solve the merge conflicts in the Python file

  • Best score: 36
  • Best player score: 70
  • Position: #54 / 68
  • Number of attempts: 2
Nested JSON Flattener - 88 entries

Transform a deeply nested JSON structure into a flattened key-value format where each path is represented by dot notation

  • Best score: 44
  • Best player score: 56
  • Position: #5 / 23
  • Number of attempts: 8
The Fibonacci Spacer - 148 entries

Split the words, remove punctuation and add spaces before each line following the Fibonacci sequence (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89)

  • Best score: 25
  • Best player score: 25
  • Position: #6 / 41
  • Number of attempts: 10
Fix the Scala Method - 252 entries

Fix the missing semicolons and the Int type, ensure the floating point division, and remove the unnecessary return.

  • Best score: 2
  • Best player score: 22
  • Position: #29 / 81
  • Number of attempts: 2
Change class fields from camel case to snake case - 484 entries

This is the reverse of the previous challenge: https://www.vimgolf.com/challenges/9v006705493c000000000513

  • Best score: 18
  • Best player score: 18
  • Position: #31 / 114
  • Number of attempts: 3
Change class fields from snake case to camel case - 261 entries

Change the class fields in this Scala class from snake case to camel case

  • Best score: 13
  • Best player score: 13
  • Position: #51 / 99
  • Number of attempts: 2
Reorganize Pokémon - 651 entries

Change the format of the each line and sort alphabetically.

  • Best score: 18
  • Best player score: 19
  • Position: #51 / 178
  • Number of attempts: 5
Replace csv column if it's not empty - 221 entries

Replace the credit_score_percentile column with the value 0.0 but leave the empty ones untouched

  • Best score: 15
  • Best player score: 15
  • Position: #23 / 77
  • Number of attempts: 4
extract struct tag in go - 112 entries

Can you extract all struct tags in the fewest keystrokes possible?

  • Best score: 29
  • Best player score: 33
  • Position: #8 / 32
  • Number of attempts: 12
CaN yOuR ViM dO ThAt? #1 - 204 entries

Tsoding's famous "Can your Vim do that?" https://youtu.be/Bafo3hhheHU?si=DfcT4sUEMTSAevnx&t=1091

  • Best score: 41
  • Best player score: 41
  • Position: #16 / 80
  • Number of attempts: 5
Append leading hyphen count to each line - 84 entries

Append the number of leading hyphens to the end of each line.

  • Best score: 23
  • Best player score: 24
  • Position: #7 / 27
  • Number of attempts: 9
Move list of uuids into a SQL query - 169 entries

Take the list of UUIDs and use them as a filter in the where statement of a SQL query

  • Best score: 57
  • Best player score: 61
  • Position: #11 / 58
  • Number of attempts: 3
Markdown Blog Editing - 392 entries

Convert the given link text in start file to a markdown link list.

  • Best score: 30
  • Best player score: 35
  • Position: #18 / 91
  • Number of attempts: 7
Word completion - 247 entries

Try to complete these options within 20 keystrokes.

  • Best score: 20
  • Best player score: 20
  • Position: #12 / 66
  • Number of attempts: 9
Search different SQL column with similar where clause - 273 entries

Replace a column in the where clause and convert all numbers from text to numeric, by replacing the leading 0 with the code 359.

  • Best score: 22
  • Best player score: 22
  • Position: #14 / 63
  • Number of attempts: 13
Remove adjacent duplicates - 595 entries

Try to find a way to remove adjacent duplicate letters.

  • Best score: 19
  • Best player score: 19
  • Position: #14 / 155
  • Number of attempts: 6
Rearrange array to single level - 1570 entries

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

  • Best score: 14
  • Best player score: 43
  • Position: #221 / 262
  • Number of attempts: 2
Rearrange array to one line - 724 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #23 / 176
  • Number of attempts: 8
Copy punctuation - 606 entries

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

  • Best score: 19
  • Best player score: 21
  • Position: #18 / 152
  • Number of attempts: 13
Column wise pasting - 239 entries

Make a table from 3 columns

  • Best score: 17
  • Best player score: 17
  • Position: #9 / 50
  • Number of attempts: 8
Define Gray code states - 41 entries

List the states using Gray code and assign Gray code values to each state.

  • Best score: 56
  • Best player score: 80
  • Position: #7 / 12
  • Number of attempts: 5
Hex to binary - 106 entries

Convert hexadecimal numbers into binary format.

  • Best score: 29
  • Best player score: 31
  • Position: #5 / 22
  • Number of attempts: 10
Count words - 83 entries

Merge duplicates and count each word.

  • Best score: 39
  • Best player score: 42
  • Position: #6 / 21
  • Number of attempts: 12
Format a long line - 99 entries

Reformat long lines (gq), textwidth=78, no trailing spaces.

  • Best score: 17
  • Best player score: 31
  • Position: #21 / 31
  • Number of attempts: 6
Evil Numbers - 103 entries

Print the first 100 evil numbers https://oeis.org/A001969. This is an advert for code.golf https://code.golf/evil-numbers#viml

  • Best score: 25
  • Best player score: 25
  • Position: #8 / 26
  • Number of attempts: 9
Mirror image - 102 entries

Add the second eye

  • Best score: 15
  • Best player score: 17
  • Position: #8 / 34
  • Number of attempts: 8
Find anomalies - 161 entries

There is one special character per line

  • Best score: 30
  • Best player score: 54
  • Position: #30 / 43
  • Number of attempts: 6
New teacher - 1393 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 19
  • Position: #23 / 291
  • Number of attempts: 13
Quicksort - 2049 entries

We need the numbers in the first row sorted as quickly as possible! Be careful not to disturb the data below the divider though: that must remain unchanged.

  • Best score: 6
  • Best player score: 6
  • Position: #135 / 454
  • Number of attempts: 3
Python dataclasses - 1220 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 19
  • Position: #83 / 303
  • Number of attempts: 5
Change double quotes to single quotes, but with a twist - 319 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.

  • Best score: 22
  • Best player score: 38
  • Position: #47 / 58
  • Number of attempts: 3
Palindrome numbers - 30 entries

For each number compute its associated palindrome. First number (first line) has been eaten! #prime

  • Best score: 30
  • Best player score: 76
  • Position: #16 / 17
  • Number of attempts: 1
V to the i - 4826 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #803 / 1900
  • Number of attempts: 6
SCREAMING_SNAKE_CASE to Title Case - 1241 entries

Convert strings in SCREAMING_SNAKE_CASE to Title Case. Examples: EMPLOYEE_NAME -> Employee Name REVENUE_YEAR_TO_DATE -> Revenue Year To Date SALARY -> Salary

  • Best score: 19
  • Best player score: 20
  • Position: #121 / 258
  • Number of attempts: 8
remove lines containing the word "reader" - 3616 entries

easy stuff

  • Best score: 9
  • Best player score: 10
  • Position: #874 / 1174
  • Number of attempts: 2
Wrap the text of an email message to 79 characters - 826 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #329 / 431
  • Number of attempts: 4
Box it - 7956 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 21
  • Position: #455 / 1887
  • Number of attempts: 2
multiple cursor alternative - 1547 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: #199 / 385
  • Number of attempts: 5
Every other line - 2922 entries

AaAaAaA

  • Best score: 12
  • Best player score: 13
  • Position: #271 / 706
  • Number of attempts: 6
Extract argument from function - 2372 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #275 / 757
  • Number of attempts: 5
Number Sort - 319 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

  • Best score: 9
  • Best player score: 9
  • Position: #143 / 170
  • Number of attempts: 1
comment and uncomment code inline - 1151 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.

  • Best score: 9
  • Best player score: 9
  • Position: #166 / 328
  • Number of attempts: 8
Extract HTML option values from tag values - 115 entries

Generate HTML option values from the text in the option tag. If the text contains multiple words, replace the spaces with an underscore and convert all capital letters to small letters.

  • Best score: 34
  • Best player score: 35
  • Position: #14 / 45
  • Number of attempts: 5
Todo list specification - 404 entries

The every item on the todo list must be done today. Modify the list to reflect that.

  • Best score: 37
  • Best player score: 37
  • Position: #101 / 182
  • Number of attempts: 2
Stairstep digits - 407 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 9
  • Position: #56 / 149
  • Number of attempts: 3
Adam's challenge - 1008 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: 18
  • Position: #103 / 275
  • Number of attempts: 5
Fiddle percentages into real numbers - 873 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #166 / 294
  • Number of attempts: 4
7th Birthday - 210 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: 23
  • Position: #46 / 76
  • Number of attempts: 8
Paragraph breaks - 527 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 10
  • Position: #47 / 168
  • Number of attempts: 5
comments galore - 1073 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #310 / 429
  • Number of attempts: 9
Angular naming conventions - 326 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: 18
  • Position: #48 / 119
  • Number of attempts: 6
Create bison tokens - 48 entries

Create tokens for bison out of a known list of words

  • Best score: 85
  • Best player score: 114
  • Position: #16 / 19
  • Number of attempts: 1
Hello ${world} - 327 entries

Migrate a JavaScript String from concatenation to ES6 interpolation.

  • Best score: 24
  • Best player score: 41
  • Position: #80 / 98
  • Number of attempts: 1
One to Ten - 2240 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

  • Best score: 12
  • Best player score: 12
  • Position: #372 / 681
  • Number of attempts: 3
Build a six - 307 entries

Just enjoy building "a" floors...

  • Best score: 22
  • Best player score: 22
  • Position: #62 / 100
  • Number of attempts: 6
Increment each number - 1043 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 15
  • Position: #59 / 255
  • Number of attempts: 4
Delete to the end of the current line - 851 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #278 / 408
  • Number of attempts: 3
Put the months in order - 979 entries

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

  • Best score: 20
  • Best player score: 44
  • Position: #96 / 165
  • Number of attempts: 4
Array transposition - 2430 entries

Transpose two arrays into one.

  • Best score: 16
  • Best player score: 35
  • Position: #397 / 451
  • Number of attempts: 2
Cartesian product - 266 entries

{1,2,3,4,5} X {1,2,3,4,5}

  • Best score: 24
  • Best player score: 32
  • Position: #51 / 99
  • Number of attempts: 5
VimGolfNight - 575 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #300 / 352
  • Number of attempts: 2
120 Degrees - 505 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 14
  • Position: #41 / 146
  • Number of attempts: 12
Neither Fizz nor Buzz - 257 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 13
  • Position: #17 / 104
  • Number of attempts: 4
Do you demand a shrubbery? - 1164 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 23
  • Position: #189 / 301
  • Number of attempts: 6
Where should I put the Newline? - 883 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Position: #225 / 438
  • Number of attempts: 2
Five Pillars - 65 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

  • Best score: 41
  • Best player score: 83
  • Position: #24 / 25
  • Number of attempts: 2
Piphilology - 158 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: 28
  • Position: #3 / 54
  • Number of attempts: 12
A HAPPY NEW YEAR 2014 ! - 10703 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #2525 / 3696
  • Number of attempts: 2
attr_aligner - 3525 entries

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

  • Best score: 19
  • Best player score: 76
  • Position: #702 / 706
  • Number of attempts: 1
Delete unwanted lines - 431 entries

Delete all lines which does not end in "o.."

  • Best score: 9
  • Best player score: 11
  • Position: #217 / 234
  • Number of attempts: 1
abcd > a b c d - 299 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #210 / 228
  • Number of attempts: 1
Readable Rubyhash - 274 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: 24
  • Position: #15 / 97
  • Number of attempts: 6
Exchanging Quotes - 859 entries

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

  • Best score: 30
  • Best player score: 52
  • Position: #221 / 231
  • Number of attempts: 1
Append semicolon after expressions - 1061 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #268 / 421
  • Number of attempts: 1
Happy New Year! - 147 entries

This is a simple new year's challenge.

  • Best score: 22
  • Best player score: 64
  • Position: #55 / 60
  • Number of attempts: 2
Insert a Markdown link - 462 entries

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

  • Best score: 22
  • Best player score: 23
  • Position: #45 / 153
  • Number of attempts: 5
Getters & Setters: Java - 212 entries

Boilerplate getters & setters - it's a tedious fact of life in Java, and probably the only thing that still pulls me back to an IDE. Perhaps someone knows a fast, pure vim way...

  • Best score: 89
  • Best player score: 110
  • Position: #24 / 60
  • Number of attempts: 1
A Simple One - 1064 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #594 / 670
  • Number of attempts: 2
Table Reshuffle - 450 entries

Fix the column order in this table... also append the new 'username' column.

  • Best score: 22
  • Best player score: 23
  • Position: #34 / 144
  • Number of attempts: 9
Reverse Simple Deletion - 859 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 11
  • Position: #60 / 462
  • Number of attempts: 3
Increment, increment, increment.... - 701 entries

Vim likes macros

  • Best score: 10
  • Best player score: 10
  • Position: #76 / 413
  • Number of attempts: 4
The Cake is a Lie - 1376 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #291 / 535
  • Number of attempts: 5
Compile C - 441 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 19
  • Position: #28 / 143
  • Number of attempts: 9
Make Fancy Header - 1070 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 16
  • Position: #131 / 348
  • Number of attempts: 5
Reformat most common surnames - 758 entries

Reformat copy-pasted table into a list of the most common surnames

  • Best score: 23
  • Best player score: 27
  • Position: #94 / 220
  • Number of attempts: 3
Remember FizzBuzz? - 747 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 56
  • Position: #87 / 197
  • Number of attempts: 4
Get rid of html tags - 417 entries

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

  • Best score: 12
  • Best player score: 16
  • Position: #28 / 241
  • Number of attempts: 3
Change the content of a string - 1686 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #244 / 621
  • Number of attempts: 3
Sort and add attributes - 1519 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 33
  • Position: #302 / 587
  • Number of attempts: 3
Reconstruct the Sentence - 1654 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 19
  • Best player score: 19
  • Position: #7 / 436
  • Number of attempts: 7
Braces or Brackets? - 1075 entries

Someone forgot whether to use braces or brackets and you have to clean up their code!

  • Best score: 34
  • Best player score: 54
  • Position: #280 / 333
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3814 entries

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

  • Best score: 16
  • Best player score: 24
  • Position: #397 / 820
  • Number of attempts: 4
Flodder-challenge - 1391 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 44
  • Position: #291 / 357
  • Number of attempts: 2
Simple text editing with Vim - 13183 entries

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

  • Best score: 13
  • Best player score: 36
  • Position: #3578 / 3789
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 7309 entries

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

  • Best score: 7
  • Best player score: 41
  • Position: #960 / 1805
  • Number of attempts: 6
Leon Kacowicz
Github:

entered into 102 challenges

contributed 0 challenges