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

Fix the Scala Method - 37 entries

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

  • Best score: 22
  • Best player score: 22
  • Position: #3 / 16
  • Number of attempts: 3
Change class fields from camel case to snake case - 172 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #29 / 47
  • Number of attempts: 2
Reorganize Pokémon - 184 entries

Change the format of the each line and sort alphabetically.

  • Best score: 18
  • Best player score: 21
  • Position: #21 / 52
  • Number of attempts: 5
Replace csv column if it's not empty - 72 entries

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

  • Best score: 15
  • Best player score: 37
  • Position: #27 / 29
  • Number of attempts: 1
Change readonly files - 8 entries

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

  • Best score: 21
  • Best player score: 53
  • Position: #4 / 5
  • Number of attempts: 1
extract struct tag in go - 24 entries

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

  • Best score: 33
  • Best player score: 40
  • Position: #7 / 10
  • Number of attempts: 7
CaN yOuR ViM dO ThAt? #1 - 54 entries

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

  • Best score: 41
  • Best player score: 45
  • Position: #11 / 21
  • Number of attempts: 2
Append leading hyphen count to each line - 34 entries

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

  • Best score: 23
  • Best player score: 25
  • Position: #6 / 11
  • Number of attempts: 3
Move list of uuids into a SQL query - 54 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: 65
  • Position: #10 / 22
  • Number of attempts: 2
Markdown Blog Editing - 242 entries

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

  • Best score: 30
  • Best player score: 42
  • Position: #24 / 58
  • Number of attempts: 5
Fix timezone format - 207 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: 17
  • Position: #32 / 67
  • Number of attempts: 3
Search different SQL column with similar where clause - 134 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: 25
  • Position: #22 / 38
  • Number of attempts: 2
Rearrange array to single level - 1166 entries

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

  • Best score: 14
  • Best player score: 59
  • Position: #175 / 192
  • Number of attempts: 2
Rearrange array to one line - 571 entries

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

  • Best score: 13
  • Best player score: 30
  • Position: #120 / 137
  • Number of attempts: 2
Copy punctuation - 460 entries

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

  • Best score: 19
  • Best player score: 145
  • Position: #108 / 113
  • Number of attempts: 1
Column wise pasting - 147 entries

Make a table from 3 columns

  • Best score: 17
  • Best player score: 44
  • Position: #31 / 34
  • Number of attempts: 1
New teacher - 851 entries

Update the details of the new CS teacher.

  • Best score: 19
  • Best player score: 21
  • Position: #37 / 179
  • Number of attempts: 8
months to html list items - 971 entries

Turn the months into list items.

  • Best score: 22
  • Best player score: 25
  • Position: #118 / 259
  • Number of attempts: 5
Quicksort - 1890 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: 24
  • Position: #254 / 415
  • Number of attempts: 3
Populate 3D bone names list - 610 entries

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

  • Best score: 21
  • Best player score: 31
  • Position: #98 / 157
  • Number of attempts: 2
Find fix point of cos - 1382 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: 15
  • Position: #243 / 404
  • Number of attempts: 2
Surround the 'z' character with brackets, quotes, and print as formatted string. - 546 entries

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

  • Best score: 17
  • Best player score: 18
  • Position: #260 / 304
  • Number of attempts: 1
Paste a column after a column - 2518 entries

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

  • Best score: 14
  • Best player score: 24
  • Position: #380 / 549
  • Number of attempts: 3
HS exam question - 1577 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 61
  • Position: #133 / 415
  • Number of attempts: 6
Reformat symbols in list - 1607 entries

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

  • Best score: 24
  • Best player score: 32
  • Position: #206 / 345
  • Number of attempts: 3
delete swap - 1773 entries

delete all swap

  • Best score: 5
  • Best player score: 5
  • Position: #375 / 549
  • Number of attempts: 6
Fix the shell script! - 2544 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 42
  • Position: #425 / 589
  • Number of attempts: 2
Satisfy the go linter - 2374 entries

You just came up with this briliant go vars package. But dang, you forgot to add comments to the exported variables. Can you add a comment over each variable with a TODO-placeholder?

  • Best score: 20
  • Best player score: 28
  • Position: #352 / 469
  • Number of attempts: 5
Add quotes to ansible playbook - 952 entries

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

  • Best score: 8
  • Best player score: 10
  • Position: #255 / 304
  • Number of attempts: 4
Multiline to Single Line - 700 entries

Convert a multiline, indented file to a single line with no whitespace

  • Best score: 5
  • Best player score: 5
  • Position: #256 / 302
  • Number of attempts: 3
Data reformat - 294 entries

Reformat this copy-paste data! #csv

  • Best score: 36
  • Best player score: 62
  • Position: #48 / 65
  • Number of attempts: 1
xrandr outputs and dashes - 704 entries

uh oh, different video drivers identify display outputs with more dashes. Quick, need to change this xrandr script!

  • Best score: 12
  • Best player score: 12
  • Position: #150 / 221
  • Number of attempts: 9
Python: Lots of function arguments - 119 entries

The function definition is too long for one line. The modeline helps you with some typical Python indent settings.

  • Best score: 6
  • Best player score: 19
  • Position: #42 / 50
  • Number of attempts: 3
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: 30
  • Position: #74 / 95
  • Number of attempts: 4
Ruby 1.9 compat - 627 entries

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

  • Best score: 14
  • Best player score: 16
  • Position: #141 / 233
  • Number of attempts: 3
Change the content of a string - 1561 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #318 / 583
  • Number of attempts: 4
Sort and add attributes - 1431 entries

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

  • Best score: 33
  • Best player score: 34
  • Position: #382 / 556
  • Number of attempts: 3
Add fold markers to a .c file - 608 entries

Fold markers can make it easier to navigate source code. Add them to this .c file.

  • Best score: 30
  • Best player score: 36
  • Position: #113 / 181
  • Number of attempts: 1
Reconstruct the Sentence - 1484 entries

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

  • Best score: 20
  • Best player score: 21
  • Position: #248 / 408
  • Number of attempts: 2
Braces or Brackets? - 964 entries

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

  • Best score: 34
  • Best player score: 37
  • Position: #64 / 310
  • Number of attempts: 3
Simple text editing with Vim - 12712 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #2118 / 3671
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6901 entries

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

  • Best score: 28
  • Best player score: 34
  • Position: #323 / 1690
  • Number of attempts: 6

Contributed Challenges

Move list of uuids into a SQL query - 54 entries

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

Fix the Scala Method - 37 entries

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

Convert plain text into a markdown table - 12 entries

Convert the table to markdown to make it more usable

Replace csv column if it's not empty - 72 entries

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

Change class fields from snake case to camel case - 95 entries

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

Change class fields from camel case to snake case - 172 entries

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

Replace markdown sections with numbering - 39 entries

Replace each section and subsection with their respective numbers

Pablo Acuna
Github:

entered into 42 challenges

contributed 7 challenges