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 - 198 entries

A simple everyday task.

  • Best score: 39
  • Best player score: 39
  • Position: #3 / 54
  • Number of attempts: 11
Reordering properties - 562 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: #41 / 149
  • Number of attempts: 4
Sort and Tag - 274 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: #47 / 68
  • Number of attempts: 3
Changing date formats - 326 entries

Change the date format to Y/M/D.

  • Best score: 37
  • Best player score: 85
  • Position: #64 / 106
  • Number of attempts: 2
YAML to dotenv - 668 entries

Convert this YAML config file to a .env file.

  • Best score: 16
  • Best player score: 17
  • Position: #39 / 163
  • Number of attempts: 8
Generate an entry for each month - 186 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: #9 / 55
  • Number of attempts: 8
Nested JSON Flattener - 57 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 / 19
  • Number of attempts: 8
The Fibonacci Spacer - 114 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 / 34
  • Number of attempts: 10
Fix the Scala Method - 181 entries

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

  • Best score: 9
  • Best player score: 22
  • Position: #28 / 62
  • Number of attempts: 2
Reorganize Pokémon - 507 entries

Change the format of the each line and sort alphabetically.

  • Best score: 18
  • Best player score: 19
  • Position: #45 / 141
  • Number of attempts: 5
Replace csv column if it's not empty - 166 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 / 60
  • Number of attempts: 4
extract struct tag in go - 69 entries

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

  • Best score: 29
  • Best player score: 33
  • Position: #8 / 24
  • Number of attempts: 12
CaN yOuR ViM dO ThAt? #1 - 158 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 / 65
  • Number of attempts: 5
Append leading hyphen count to each line - 69 entries

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

  • Best score: 23
  • Best player score: 24
  • Position: #7 / 21
  • Number of attempts: 9
Move list of uuids into a SQL query - 116 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: #7 / 44
  • Number of attempts: 3
Markdown Blog Editing - 326 entries

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

  • Best score: 30
  • Best player score: 35
  • Position: #16 / 75
  • Number of attempts: 7
Search different SQL column with similar where clause - 237 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 / 56
  • Number of attempts: 13
Remove adjacent duplicates - 550 entries

Try to find a way to remove adjacent duplicate letters.

  • Best score: 19
  • Best player score: 19
  • Position: #14 / 142
  • Number of attempts: 6
Rearrange array to single level - 1435 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: #201 / 235
  • Number of attempts: 2
Rearrange array to one line - 691 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #23 / 166
  • Number of attempts: 8
Copy punctuation - 563 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 / 141
  • Number of attempts: 13
Column wise pasting - 203 entries

Make a table from 3 columns

  • Best score: 17
  • Best player score: 17
  • Position: #9 / 44
  • 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 - 101 entries

Convert hexadecimal numbers into binary format.

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

Merge duplicates and count each word.

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

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

  • Best score: 17
  • Best player score: 31
  • Position: #20 / 28
  • Number of attempts: 6
Evil Numbers - 91 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 / 24
  • Number of attempts: 9
New teacher - 1258 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 19
  • Position: #23 / 262
  • Number of attempts: 13
Quicksort - 2010 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 / 443
  • Number of attempts: 3
Python dataclasses - 1207 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 19
  • Position: #83 / 298
  • Number of attempts: 5
Change double quotes to single quotes, but with a twist - 312 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: #46 / 57
  • Number of attempts: 3
V to the i - 4824 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #803 / 1899
  • Number of attempts: 6
Wrap the text of an email message to 79 characters - 804 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #329 / 423
  • Number of attempts: 4
Extract argument from function - 2369 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #275 / 756
  • Number of attempts: 5
comments galore - 1057 entries

Basic comment reformatting

  • Best score: 10
  • Best player score: 10
  • Position: #310 / 426
  • 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
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
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
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
Insert a Markdown link - 459 entries

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

  • Best score: 22
  • Best player score: 23
  • Position: #45 / 151
  • 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 - 1061 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 / 669
  • 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 - 857 entries

You did the simple deletion, now reverse it.

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

Vim likes macros

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

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #291 / 534
  • 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 - 755 entries

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

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

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 56
  • Position: #86 / 194
  • Number of attempts: 4
Get rid of html tags - 415 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 / 239
  • Number of attempts: 3
Change the content of a string - 1608 entries

This docstring is a complete lie. Fix it.

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

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

  • Best score: 33
  • Best player score: 33
  • Position: #302 / 577
  • Number of attempts: 3
Reconstruct the Sentence - 1623 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 / 429
  • Number of attempts: 7
Braces or Brackets? - 1062 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: #278 / 327
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3775 entries

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

  • Best score: 16
  • Best player score: 24
  • Position: #394 / 809
  • Number of attempts: 4
Flodder-challenge - 1367 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 44
  • Position: #287 / 351
  • Number of attempts: 2
Simple text editing with Vim - 13029 entries

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

  • Best score: 13
  • Best player score: 36
  • Position: #3542 / 3748
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 7190 entries

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

  • Best score: 28
  • Best player score: 41
  • Position: #949 / 1765
  • Number of attempts: 6
Leon Kacowicz
Github:

entered into 61 challenges

contributed 0 challenges