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

Simple, Practical, and Common - 33612 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: 29
  • Position: #4886 / 7416
  • Number of attempts: 2
One number per line - 18722 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 19
  • Position: #1916 / 3860
  • Number of attempts: 1
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: 13
  • Position: #186 / 231
  • Number of attempts: 3
Add string initializers to an enum - 872 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 26
  • Position: #160 / 258
  • Number of attempts: 2
SCREAMING_SNAKE_CASE to Title Case - 1214 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: 34
  • Position: #210 / 249
  • Number of attempts: 2
Add semicolons - 10850 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 15
  • Position: #2216 / 3062
  • Number of attempts: 1
remove lines containing the word "reader" - 3583 entries

easy stuff

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

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

  • Best score: 12
  • Best player score: 16
  • Position: #485 / 864
  • Number of attempts: 5
Box it - 7904 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 28
  • Position: #1234 / 1875
  • 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: #2923 / 4194
  • Number of attempts: 4
Line under headers - 2037 entries

Put a line under each header, and remove the other markdown formatting.

  • Best score: 24
  • Best player score: 34
  • Position: #349 / 501
  • Number of attempts: 3
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: 34
  • Position: #180 / 227
  • Number of attempts: 2
Exchanging Quotes - 858 entries

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

  • Best score: 30
  • Best player score: 38
  • Position: #139 / 230
  • Number of attempts: 3
replacing each line of a block selection - 2999 entries

replace each line's ../assets/js with /javascripts

  • Best score: 18
  • Best player score: 21
  • Position: #338 / 777
  • Number of attempts: 5
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #153 / 419
  • Number of attempts: 4
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 16
  • Position: #88 / 199
  • Number of attempts: 4
Remove noise from HTTP log - 717 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 17
  • Position: #199 / 273
  • Number of attempts: 1
Remove semicolons after expressions - 654 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 8
  • Position: #155 / 263
  • Number of attempts: 3
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #96 / 1748
  • Number of attempts: 11
The meaning - 575 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #19 / 363
  • Number of attempts: 1
Calculate the table totals - 146 entries

Go ahead... commit the treachery of using vim as a spreadsheet.

  • Best score: 33
  • Best player score: 52
  • Position: #26 / 45
  • Number of attempts: 5
Replacing some words - 428 entries

How fast could it be?

  • Best score: 17
  • Best player score: 28
  • Position: #109 / 151
  • Number of attempts: 1
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #230 / 650
  • Number of attempts: 5
remove dupes from array - 1358 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

  • Best score: 17
  • Best player score: 22
  • Position: #166 / 336
  • Number of attempts: 3
Alphabetize the directory - 298 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 39
  • Position: #78 / 101
  • Number of attempts: 1
PHP Array Syntax -> MailChimp Merge Syntax - 545 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

  • Best score: 23
  • Best player score: 37
  • Position: #99 / 150
  • Number of attempts: 4
Refactor to Helpers - 50 entries

This Rails partial is almost all template escapes. Put it into a helper, and refactor each case to methods so we can build out the controls for each. (I've converted to tabs - fighting with Vimgolf's default config shouldn't be part of the challenge.)

  • Best score: 147
  • Best player score: 352
  • Position: #17 / 25
  • Number of attempts: 1
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 22
  • Position: #430 / 652
  • Number of attempts: 3

Contributed Challenges

Exchanging Quotes - 858 entries

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

Jonathan Lozinski
Twitter:

Director of Engineering at Arm, Cloud Services. Views expressed are not of my employer. We're lucky if they're even mine.

entered into 28 challenges

contributed 1 challenges