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 timezone format - 220 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: #29 / 73
  • Number of attempts: 1
Search different SQL column with similar where clause - 168 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: 24
  • Position: #20 / 45
  • Number of attempts: 2
Rearrange array to single level - 1267 entries

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

  • Best score: 14
  • Best player score: 19
  • Position: #42 / 202
  • Number of attempts: 3
Rearrange array to one line - 588 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #30 / 142
  • Number of attempts: 2
Copy punctuation - 483 entries

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

  • Best score: 19
  • Best player score: 25
  • Position: #24 / 119
  • Number of attempts: 3
Deleting text - 245 entries

Delete everything except some specific numbers.

  • Best score: 26
  • Best player score: 45
  • Position: #19 / 78
  • Number of attempts: 1
Case matching substitution - 55 entries

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

  • Best score: 31
  • Best player score: 108
  • Position: #13 / 15
  • Number of attempts: 1
Define Gray code states - 36 entries

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

  • Best score: 56
  • Best player score: 69
  • Position: #5 / 11
  • Number of attempts: 2
Hex to binary - 88 entries

Convert hexadecimal numbers into binary format.

  • Best score: 29
  • Best player score: 34
  • Position: #9 / 18
  • Number of attempts: 5
Count words - 62 entries

Merge duplicates and count each word.

  • Best score: 39
  • Best player score: 61
  • Position: #8 / 17
  • Number of attempts: 2
String decompression - 31 entries

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

  • Best score: 27
  • Best player score: 27
  • Position: #1 / 11
  • Number of attempts: 2
Format a long line - 80 entries

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

  • Best score: 17
  • Best player score: 29
  • Position: #14 / 26
  • Number of attempts: 1
Evil Numbers - 82 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: 52
  • Position: #11 / 23
  • Number of attempts: 1
Simple, Practical, and Common - 33609 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: #762 / 7415
  • Number of attempts: 4
Swap values inside brackets - 2493 entries

Easy challenge.

  • Best score: 14
  • Best player score: 16
  • Position: #220 / 578
  • Number of attempts: 2
Unsemantic linewrapping - 928 entries

[Inspired by a blog post I read: https://scott.mn/2014/02/21/semantic_linewrapping/. Text adapted.] Sometimes when editing a Markdown file, I wrap the lines semantically. Instead of inserting a newline at 70 columns (or whatever), or making paragraphs one long line, I put in newlines at a point that seems logical to me. This may seem silly, but it produces better diffs. Semantic linewrapping also makes editing snappier. I can delete, edit or insert sentences easily using linewise operations. Code-oriented text editors like Vim and [REDACTED] are really good at this kind of manipulation. Editing text that hasn't been wrapped semantically is a pain, though:

  • Best score: 9
  • Best player score: 10
  • Position: #105 / 231
  • Number of attempts: 2
Applying same text modification in several lines - 2877 entries

Remove identical text at the beginning of several lines and the closing parenthesis.

  • Best score: 12
  • Best player score: 15
  • Position: #493 / 850
  • Number of attempts: 2
Swap the operands under comparison - 297 entries

Swap the operands under comparison to prevent null pointer exception (at least in java)

  • Best score: 19
  • Best player score: 21
  • Position: #43 / 101
  • Number of attempts: 1
Add semicolons - 10848 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #776 / 3061
  • Number of attempts: 1
remove lines containing the word "reader" - 3583 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #4 / 1161
  • Number of attempts: 2
Com(m)a Trouble - 3815 entries

Someone was real stupid when placing his commas. Can you fix it?

  • Best score: 12
  • Best player score: 13
  • Position: #225 / 864
  • Number of attempts: 2
Box it - 7902 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 22
  • Position: #457 / 1874
  • Number of attempts: 2
Tables, Functions, Sprocs - 135 entries

In order to load some scripts into my database in the correct order I need to load tables first (t_), then functions (fn_), then stored procedures (sp_). The order of the t_ lines and the order of the sp_ lines should also match. Reorder the lines so they will load correctly.

  • Best score: 10
  • Best player score: 12
  • Position: #42 / 47
  • Number of attempts: 1
Just the middle - 11446 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 8
  • Position: #2002 / 4194
  • Number of attempts: 1
On Being Stylish - 81 entries

Your PR cannot be accepted if you don't follow our corporate style guide.

  • Best score: 33
  • Best player score: 46
  • Position: #15 / 21
  • Number of attempts: 2
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 67 entries

I bumped into this in a dailywtf code: http://pastebin.com/QApa5ycS I didn't want to translate a string whenever I wanted to be [Ss][Aa][Rr][Cc][Aa][Ss][Tt][Ii][Cc] on slack, so I figured a script (python, sed, whatever) would be helpful. Well, or a few vim keystroke!

  • Best score: 18
  • Best player score: 18
  • Position: #9 / 39
  • Number of attempts: 1
Adam's challenge - 984 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: #4 / 270
  • Number of attempts: 3
Nesting SASS - 266 entries

Move a block inside another block and indent it

  • Best score: 9
  • Best player score: 9
  • Position: #16 / 96
  • Number of attempts: 4
Combines all items - 313 entries

For each line that starts with the same number I want to combine its contents

  • Best score: 9
  • Best player score: 9
  • Position: #18 / 140
  • Number of attempts: 2
ninja substitution - 1420 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 16
  • Position: #147 / 267
  • Number of attempts: 2
Order and join - 983 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 12
  • Position: #170 / 259
  • Number of attempts: 3
Python challenge - 172 entries

Change the types of the variables in the list from str to float, while keeping the truncation.

  • Best score: 31
  • Best player score: 35
  • Position: #19 / 46
  • Number of attempts: 2
Change part of a function name in multiple occurrences - 662 entries

Change the middle part of the function name in multiple places, preferably using the next and dot commands.

  • Best score: 14
  • Best player score: 18
  • Position: #166 / 208
  • Number of attempts: 1
Around the clock - 199 entries

You'll want to use 2 special commands to complete this. If you haven't yet, read through 'input.txt', especially :help simple-changes

  • Best score: 13
  • Best player score: 13
  • Position: #13 / 77
  • Number of attempts: 2
Join 'em - 251 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 5
  • Position: #53 / 151
  • Number of attempts: 1
Delete to the end of the current line - 811 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #2 / 390
  • Number of attempts: 1
change parenthesis - 296 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #11 / 161
  • Number of attempts: 1
Put the months in order - 974 entries

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

  • Best score: 20
  • Best player score: 27
  • Position: #42 / 163
  • Number of attempts: 3
Reorder the groups - 1181 entries

Change the order so that the groups of fruit come before the vegetables.

  • Best score: 14
  • Best player score: 14
  • Position: #12 / 264
  • Number of attempts: 1
convert yml into java pojo field - 857 entries

How fast vim can create fields for java pojo i.e class declaration referring to a (simple) yml file

  • Best score: 29
  • Best player score: 30
  • Position: #96 / 227
  • Number of attempts: 1
I forgot quotes - 15977 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #281 / 4177
  • Number of attempts: 4
Words in parens - 12929 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1703 / 3961
  • Number of attempts: 2
Resort and deup a CSV list - 167 entries

I'm always adding items to a sorted list. There has to be a better way dedup and resort the lists. There are multiple lists with varying lengths to discourage manual sorting. Also Australia's animals are weird.

  • Best score: 44
  • Best player score: 70
  • Position: #33 / 43
  • Number of attempts: 1
Rule 110 - 46 entries

Compute the next 5 iterations of Rule 110 with the given starting state. https://en.wikipedia.org/wiki/Rule_110

  • Best score: 43
  • Best player score: 63
  • Position: #10 / 13
  • Number of attempts: 3
Simple text editing with Vim - 12746 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #543 / 3682
  • Number of attempts: 2

Contributed Challenges

Reorder the groups - 1181 entries

Change the order so that the groups of fruit come before the vegetables.

Valacar
Twitter:

entered into 45 challenges

contributed 1 challenges