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

From brakets to parens - 1266 entries

This is one of the most common problem when you wrap an array for error handling. Vim is useful when you convert foo[i][j][k] into foo(i, j, k) for many times.

  • Best score: 24
  • Best player score: 25
  • Position: #20 / 284
  • Number of attempts: 1
Create json from a .env file - 1658 entries

A simple everyday task.

  • Best score: 38
  • Best player score: 39
  • Position: #13 / 407
  • Number of attempts: 1
Reordering properties - 1336 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: 24
  • Position: #2 / 294
  • Number of attempts: 7
Sort and Tag - 708 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: 36
  • Position: #1 / 153
  • Number of attempts: 3
Changing date formats - 734 entries

Change the date format to Y/M/D.

  • Best score: 37
  • Best player score: 37
  • Position: #1 / 207
  • Number of attempts: 2
YAML to dotenv - 1600 entries

Convert this YAML config file to a .env file.

  • Best score: 16
  • Best player score: 16
  • Position: #1 / 335
  • Number of attempts: 1
Change to ascending order - 540 entries

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

  • Best score: 17
  • Best player score: 17
  • Position: #1 / 131
  • Number of attempts: 2
Swap columns and transform to CSV format - 474 entries

Turn this spreadsheet output into a CSV file but first swap the columns

  • Best score: 16
  • Best player score: 16
  • Position: #1 / 171
  • Number of attempts: 1
Generate an entry for each month - 387 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: 27
  • Position: #1 / 97
  • Number of attempts: 3
Fix the git merge conflicts - 348 entries

Solve the merge conflicts in the Python file

  • Best score: 36
  • Best player score: 36
  • Position: #1 / 104
  • Number of attempts: 3
Nested JSON Flattener - 133 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: 44
  • Position: #1 / 31
  • Number of attempts: 2
The Fibonacci Spacer - 169 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: 14
  • Best player score: 25
  • Position: #2 / 51
  • Number of attempts: 4
Replace markdown sections with numbering - 321 entries

Replace each section and subsection with their respective numbers

  • Best score: 29
  • Best player score: 29
  • Position: #1 / 89
  • Number of attempts: 2
Fix the Scala Method - 368 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: #16 / 121
  • Number of attempts: 1
Change class fields from camel case to snake case - 662 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #20 / 152
  • Number of attempts: 1
Change class fields from snake case to camel case - 318 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #32 / 120
  • Number of attempts: 1
Reorganize Pokémon - 871 entries

Change the format of the each line and sort alphabetically.

  • Best score: 18
  • Best player score: 18
  • Position: #15 / 239
  • Number of attempts: 1
Replace csv column if it's not empty - 294 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: #15 / 98
  • Number of attempts: 1
Convert plain text into a markdown table - 102 entries

Convert the table to markdown to make it more usable

  • Best score: 56
  • Best player score: 56
  • Position: #1 / 33
  • Number of attempts: 1
Change readonly files - 117 entries

Try to write a file that was marked as read-only.

  • Best score: 20
  • Best player score: 20
  • Position: #3 / 35
  • Number of attempts: 1
extract struct tag in go - 157 entries

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

  • Best score: 29
  • Best player score: 29
  • Position: #1 / 48
  • Number of attempts: 3
CaN yOuR ViM dO ThAt? #2 - 106 entries

Tsoding's famous "Can your Vim do that?" https://www.youtube.com/watch?v=F4xc4jQO7ck&t=1429s

  • Best score: 49
  • Best player score: 49
  • Position: #5 / 28
  • Number of attempts: 2
CaN yOuR ViM dO ThAt? #1 - 295 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: #4 / 117
  • Number of attempts: 2
Append leading hyphen count to each line - 141 entries

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

  • Best score: 23
  • Best player score: 23
  • Position: #5 / 40
  • Number of attempts: 2
Move list of uuids into a SQL query - 245 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: 57
  • Position: #1 / 82
  • Number of attempts: 1
Markdown Blog Editing - 478 entries

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

  • Best score: 30
  • Best player score: 30
  • Position: #3 / 115
  • Number of attempts: 2
Word completion - 305 entries

Try to complete these options within 20 keystrokes.

  • Best score: 20
  • Best player score: 20
  • Position: #1 / 81
  • Number of attempts: 2
Fix timezone format - 351 entries

Add the missing T and Z in the datetime field. There should be a T instead of the space, and a Z at the end of the datetime. `2024-08-31 18:32:00;` -> `2024-08-31T18:32:00Z;`

  • Best score: 15
  • Best player score: 15
  • Position: #1 / 118
  • Number of attempts: 2
Search different SQL column with similar where clause - 360 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: #1 / 85
  • Number of attempts: 2
Remove adjacent duplicates - 718 entries

Try to find a way to remove adjacent duplicate letters.

  • Best score: 19
  • Best player score: 19
  • Position: #1 / 179
  • Number of attempts: 3
Move to corresponding lines - 324 entries

Move the values to the corresponding lines.

  • Best score: 16
  • Best player score: 16
  • Position: #1 / 75
  • Number of attempts: 2
Rearrange array to single level - 1814 entries

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

  • Best score: 14
  • Best player score: 14
  • Position: #2 / 306
  • Number of attempts: 2
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: 13
  • Position: #5 / 205
  • Number of attempts: 1
Copy punctuation - 736 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #6 / 179
  • Number of attempts: 1
Change LaTex itemizations formats - 132 entries

Inspired by the way my professor formats their LaTeX assignments.

  • Best score: 43
  • Best player score: 43
  • Position: #1 / 23
  • Number of attempts: 7
Column wise pasting - 262 entries

Make a table from 3 columns

  • Best score: 17
  • Best player score: 17
  • Position: #1 / 56
  • Number of attempts: 2
Deleting text - 342 entries

Delete everything except some specific numbers.

  • Best score: 26
  • Best player score: 26
  • Position: #1 / 110
  • Number of attempts: 7
Resolve the spreadsheet - 37 entries

Replace the formulas in column C with the resulting values. Divisions by zero result in NaN. Operations with NaN also result in NaN.

  • Best score: 118
  • Best player score: 118
  • Position: #1 / 8
  • Number of attempts: 3
Case matching substitution - 89 entries

Swap every "lorem" for "ipsum", keeping the letter cases the same.

  • Best score: 31
  • Best player score: 31
  • Position: #5 / 21
  • Number of attempts: 1
Define Gray code states - 56 entries

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

  • Best score: 54
  • Best player score: 56
  • Position: #2 / 16
  • Number of attempts: 5
Hex to binary - 129 entries

Convert hexadecimal numbers into binary format.

  • Best score: 29
  • Best player score: 31
  • Position: #2 / 25
  • Number of attempts: 8
Count words - 123 entries

Merge duplicates and count each word.

  • Best score: 39
  • Best player score: 39
  • Position: #2 / 27
  • Number of attempts: 4
String decompression - 43 entries

3a4b2c => aaabbbbcc. Start a new line when you exceed 79 columns.

  • Best score: 27
  • Best player score: 27
  • Position: #6 / 15
  • Number of attempts: 1
Reverse even lines - 44 entries

Reverse only the even lines without altering the odd lines.

  • Best score: 7
  • Best player score: 7
  • Position: #2 / 14
  • Number of attempts: 5
Format a long line - 129 entries

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

  • Best score: 17
  • Best player score: 17
  • Position: #1 / 37
  • Number of attempts: 2
Evil Numbers - 117 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: #6 / 28
  • Number of attempts: 1
Mirror image - 126 entries

Add the second eye

  • Best score: 15
  • Best player score: 15
  • Position: #3 / 37
  • Number of attempts: 2
Find anomalies - 166 entries

There is one special character per line

  • Best score: 30
  • Best player score: 30
  • Position: #7 / 45
  • Number of attempts: 1
Coordinate extraction - 67 entries

Get the coordinates of all "M"s from the Vim logo

  • Best score: 43
  • Best player score: 43
  • Position: #2 / 18
  • Number of attempts: 5
Morse - 181 entries

Translate Morse code to Text

  • Best score: 31
  • Best player score: 31
  • Position: #1 / 37
  • Number of attempts: 3
New teacher - 1513 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 19
  • Position: #3 / 318
  • Number of attempts: 2
Truth Table to ModelSim - 66 entries

Convert this truth table to simulator instructions!

  • Best score: 64
  • Best player score: 64
  • Position: #1 / 19
  • Number of attempts: 2
Replace word while reserving first letter case - 665 entries

Window -> Door window -> door Windows -> Windows windows -> windows

  • Best score: 24
  • Best player score: 24
  • Position: #1 / 127
  • Number of attempts: 2
months to html list items - 1146 entries

Turn the months into list items.

  • Best score: 22
  • Best player score: 22
  • Position: #1 / 310
  • Number of attempts: 1
Instance creation in Verilog - 48 entries

Creating an instance of a module is a very frequent task in Verilog. Let's see how efficiently can it be done

  • Best score: 107
  • Best player score: 107
  • Position: #2 / 10
  • Number of attempts: 10
Quicksort - 2113 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: #3 / 472
  • Number of attempts: 1
EDN reformat - 1218 entries

The goal is to make the code more readable and concise while maintaining its functionality.

  • Best score: 17
  • Best player score: 17
  • Position: #1 / 172
  • Number of attempts: 2
Tic-Tac-Toe Grid Transformation - 450 entries

Your mission is to efficiently convert the original Tic-Tac-Toe grid, represented by 'x's and 'o's, into a neat and well-organized game board.

  • Best score: 56
  • Best player score: 56
  • Position: #1 / 88
  • Number of attempts: 2
Pick and sort servers from mirror list - 463 entries

Retrieve the primary server for each country from a mirror list file and organize them alphabetically by country name. Given a mirror list file containing server information for various countries, the objective is to extract the primary server from each country and then arrange these servers in alphabetical order based on the respective country names.

  • Best score: 28
  • Best player score: 28
  • Position: #1 / 92
  • Number of attempts: 5
Populate 3D bone names list - 656 entries

Ran into this at work, excited to see how this gets optimized

  • Best score: 21
  • Best player score: 21
  • Position: #2 / 169
  • Number of attempts: 2
Remove line numbers - 784 entries

From http://web.archive.org/web/20140831121704/http://dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php#investigatingthestackwithgdb.

  • Best score: 8
  • Best player score: 12
  • Position: #5 / 208
  • Number of attempts: 1
Find fix point of cos - 1485 entries

Write a function to find the fix point of cos. It is not a good code; It is just to use vim. Inspired by the excellent https://mvanier.livejournal.com/2897.html about the Y combinator.

  • Best score: 14
  • Best player score: 14
  • Position: #10 / 434
  • Number of attempts: 1
Insert column data on Confluence-style table - 503 entries

Add ip addresses into new "IP" column based on the last digits from the "Server" column

  • Best score: 33
  • Best player score: 33
  • Position: #4 / 114
  • Number of attempts: 2
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: 17
  • Position: #30 / 328
  • Number of attempts: 1
Easier Align - 443 entries

Align the columns of a markdown table

  • Best score: 51
  • Best player score: 51
  • Position: #1 / 100
  • Number of attempts: 7
Paste a column after a column - 2668 entries

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

  • Best score: 14
  • Best player score: 14
  • Position: #56 / 578
  • Number of attempts: 1
Filter number combinations that don't add to 11 - 427 entries

Append the sum of each line to its end, alongside an equals sign, and remove any that do not sum to 11. The ordering of lines should stay the same. Note that the combinations are semi-arbitrary and not all 4-number combinations are present in the file.

  • Best score: 27
  • Best player score: 27
  • Position: #19 / 123
  • Number of attempts: 1
Tabbed Table to Python Array - 773 entries

Not payed by the hour? So make it fast ;-) The table contains the relative occurencies of bigrams (two consecutive letters) in 1/100,000 in the german language, copy-pasted from http://www.mathe.tu-freiberg.de/~hebisch/cafe/kryptographie/bigramme.html

  • Best score: 50
  • Best player score: 50
  • Position: #1 / 185
  • Number of attempts: 2
HS exam question - 1613 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 47
  • Position: #1 / 422
  • Number of attempts: 2
Reformat symbols in list - 1656 entries

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

  • Best score: 24
  • Best player score: 24
  • Position: #4 / 356
  • Number of attempts: 1
Fizzbuzz - 614 entries

type the first 100 lines of the fizzbuzz problem

  • Best score: 44
  • Best player score: 44
  • Position: #1 / 172
  • Number of attempts: 3
Substraction (bis) - 638 entries

Solve the equations (adapted from the original @Caek_'s challenge).

  • Best score: 21
  • Best player score: 21
  • Position: #3 / 117
  • Number of attempts: 2
Changing around text with citations - 362 entries

Based off of something I saw on reddit

  • Best score: 28
  • Best player score: 28
  • Position: #9 / 96
  • Number of attempts: 2
Poorly indented Python comments - 1350 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #54 / 225
  • Number of attempts: 1
Many duplicates - 1484 entries

Quick and easy

  • Best score: 7
  • Best player score: 7
  • Position: #27 / 483
  • Number of attempts: 1
2 quick changes and a numbered list - 661 entries

The ascii will not be lost, but rather numbered in 4 digit blocks with leading zeros.

  • Best score: 37
  • Best player score: 37
  • Position: #12 / 157
  • Number of attempts: 1
delete swap - 1884 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #93 / 578
  • Number of attempts: 1
Generate a very basic Python constructor (fixed) - 1295 entries

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

  • Best score: 29
  • Best player score: 29
  • Position: #31 / 278
  • Number of attempts: 1
Fix the shell script! - 2681 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 26
  • Position: #31 / 624
  • Number of attempts: 1
hello-world-vimgolf - 2533 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #205 / 726
  • Number of attempts: 1
Fill in the chess board - 980 entries

Fill in the name of each square using its file (a-h) and rank (1-8).

  • Best score: 19
  • Best player score: 19
  • Position: #21 / 187
  • Number of attempts: 2
Generate a very basic Python constructor - 337 entries

I actually needed to do this myself, so I look forward to learning how.

  • Best score: 38
  • Best player score: 38
  • Position: #21 / 102
  • Number of attempts: 1
Making 3 line function a one liner. - 347 entries

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #98 / 214
  • Number of attempts: 1
HS Final exam vimgolf - 936 entries

Change the initial file to a single line containing all names comma-separated with numbers inside parentheses.

  • Best score: 21
  • Best player score: 21
  • Position: #26 / 245
  • Number of attempts: 2
Python: Def to Lambda - 479 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #72 / 161
  • Number of attempts: 1
Word frequency alignment - 307 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

  • Best score: 5
  • Best player score: 5
  • Position: #126 / 165
  • Number of attempts: 1
Danilo J. S. Bellini 🥊🇧🇷
Twitter:

Music, Python, Linux/shell, DSP/Audio, Maths/Statistics, Science, LaTeX, Economics, Brazilian stocks, Games, Analytic Philosophy, Game theory, ...

entered into 86 challenges

contributed 0 challenges