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

Find fix point of cos - 641 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: #80 / 179
  • Number of attempts: 1
Insert column data on Confluence-style table - 264 entries

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

  • Best score: 33
  • Best player score: 34
  • Position: #14 / 67
  • Number of attempts: 11
Surround the 'z' character with brackets, quotes, and print as formatted string. - 335 entries

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

  • Best score: 17
  • Best player score: 17
  • Position: #101 / 176
  • Number of attempts: 1
Easier Align - 187 entries

Align the columns of a markdown table

  • Best score: 57
  • Best player score: 62
  • Position: #7 / 66
  • Number of attempts: 7
Paste a column after a column - 1663 entries

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

  • Best score: 14
  • Best player score: 16
  • Position: #115 / 364
  • Number of attempts: 2
Filter number combinations that don't add to 11 - 243 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: 28
  • Position: #44 / 79
  • Number of attempts: 2
HS exam question - 1272 entries

Convert the data to a python dictionary

  • Best score: 47
  • Best player score: 48
  • Position: #30 / 346
  • Number of attempts: 6
Reformat symbols in list - 1198 entries

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

  • Best score: 24
  • Best player score: 24
  • Position: #45 / 272
  • Number of attempts: 6
Fizzbuzz - 422 entries

type the first 100 lines of the fizzbuzz problem

  • Best score: 47
  • Best player score: 48
  • Position: #22 / 133
  • Number of attempts: 6
Substraction (bis) - 448 entries

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

  • Best score: 22
  • Best player score: 25
  • Position: #28 / 90
  • Number of attempts: 1
Changing around text with citations - 236 entries

Based off of something I saw on reddit

  • Best score: 28
  • Best player score: 29
  • Position: #24 / 69
  • Number of attempts: 4
Poorly indented Python comments - 963 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #37 / 178
  • Number of attempts: 9
Many duplicates - 1044 entries

Quick and easy

  • Best score: 7
  • Best player score: 8
  • Position: #226 / 340
  • Number of attempts: 1
2 quick changes and a numbered list - 504 entries

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

  • Best score: 37
  • Best player score: 38
  • Position: #40 / 121
  • Number of attempts: 3
Generate a very basic Python constructor (fixed) - 995 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: #48 / 219
  • Number of attempts: 11
Fix the shell script! - 1841 entries

Fix the shell script with the fewest keystrokes!

  • Best score: 26
  • Best player score: 27
  • Position: #98 / 448
  • Number of attempts: 7
Visual block training - 842 entries

You see the input. You see the output. Go.

  • Best score: 17
  • Best player score: 17
  • Position: #6 / 155
  • Number of attempts: 13
Put a newline after every 10 lines in vim - 1421 entries

Goal is to put a newline after every 10 lines in vim.

  • Best score: 10
  • Best player score: 11
  • Position: #171 / 479
  • Number of attempts: 3
Wikitext headings to markdown - 854 entries

Convert the wikitext headings to markdown.

  • Best score: 20
  • Best player score: 20
  • Position: #40 / 181
  • Number of attempts: 1
hello-world-vimgolf - 2116 entries

Simple number generation

  • Best score: 10
  • Best player score: 10
  • Position: #280 / 598
  • Number of attempts: 2
Plotting some variables in python - 1431 entries

4 sets of (x,y) variables to plot. Just increment the numbers! Well, let's change the colors of the lines as well. Oh and we meant to plot the absolute values of course.

  • Best score: 34
  • Best player score: 35
  • Position: #74 / 305
  • Number of attempts: 3
Transpose a python matrix - 717 entries

Rotate the matrix in 90 degrees.

  • Best score: 23
  • Best player score: 23
  • Position: #17 / 121
  • Number of attempts: 9
Lowercase first characters - 435 entries

This is the (abridged) input for Day 3 in Advent of Code 2019. The output is a format more suitable for Prolog programming: the two lines of input become two lists of pairs, joined together in a wires functor.

  • Best score: 33
  • Best player score: 33
  • Position: #31 / 159
  • Number of attempts: 5
Inverting Lines - 1630 entries

A simple challenge to invert all lines, except the first.

  • Best score: 10
  • Best player score: 10
  • Position: #196 / 441
  • Number of attempts: 1
Making 3 line function a one liner. - 290 entries

Simple challenge for frequent action while programming.

  • Best score: 4
  • Best player score: 4
  • Position: #157 / 183
  • Number of attempts: 1
Modernise code - 1208 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 34
  • Position: #65 / 283
  • Number of attempts: 7
Staircase - 99 entries

Going downstairs, while singing the alphabet song. Some vb practice to us all. Would it be much easier to make it go from left to right instead?

  • Best score: 21
  • Best player score: 22
  • Position: #5 / 27
  • Number of attempts: 13
Enumerate Bullets - 268 entries

We will need to refer to the bullet points in our document explicitly later, so we need to assign them some ID's!

  • Best score: 20
  • Best player score: 24
  • Position: #43 / 74
  • Number of attempts: 3
swap number pairs - 1925 entries

Swap the numbers in a bunch of 2-element arrays.

  • Best score: 16
  • Best player score: 17
  • Position: #108 / 354
  • Number of attempts: 12
HS Final exam vimgolf - 836 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: #35 / 221
  • Number of attempts: 4
Easy modification of ssh config - 320 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 25
  • Position: #36 / 100
  • Number of attempts: 3
Python: Def to Lambda - 418 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #82 / 146
  • Number of attempts: 4
Turn the x - 284 entries

Turn the x to a +

  • Best score: 19
  • Best player score: 19
  • Position: #18 / 73
  • Number of attempts: 6
Rural Post - 4285 entries

Simple challenge to remove all but the post code on each line

  • Best score: 9
  • Best player score: 9
  • Position: #195 / 1051
  • Number of attempts: 8
Satisfy the go linter - 2108 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: 20
  • Position: #149 / 427
  • Number of attempts: 9
Add quotes to ansible playbook - 848 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #134 / 268
  • Number of attempts: 3
Multiline to Single Line - 590 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #226 / 264
  • Number of attempts: 1
xrandr outputs and dashes - 632 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: #141 / 208
  • Number of attempts: 2
Capitalize the Names - 343 entries

I want to capitalize the names in quotes, but just the people's names, not the file names.

  • Best score: 21
  • Best player score: 21
  • Position: #45 / 86
  • Number of attempts: 12
Replace pattern with 1, 2, 3, ... on each line - 1058 entries

For each line replace a search pattern (in this case $) with numbers starting at 1 and then increasing by 1 for each replaced match. a$b$c$ -> a0b1c2

  • Best score: 21
  • Best player score: 22
  • Position: #85 / 216
  • Number of attempts: 2
Hogwarts Email Sorting - 858 entries

Given a list of emails, get the students full name and their associated house.

  • Best score: 20
  • Best player score: 20
  • Position: #55 / 248
  • Number of attempts: 4
Get mail address from outlook format - 609 entries

Create a mail list space separated of mail list formatted by outlook

  • Best score: 15
  • Best player score: 15
  • Position: #81 / 193
  • Number of attempts: 3
Add text at some column - 151 entries

Complete golang struct statement.

  • Best score: 31
  • Best player score: 31
  • Position: #20 / 57
  • Number of attempts: 4
Swap values - 4513 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 12
  • Position: #512 / 1250
  • Number of attempts: 5
prepend * to every non-blank line - 6141 entries

Prepend an asterisk to every non-blank line in the input file.

  • Best score: 10
  • Best player score: 11
  • Position: #736 / 1500
  • Number of attempts: 3
One number per line - 18559 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 27
  • Position: #3501 / 3830
  • Number of attempts: 2
Right Align Part of the line - 108 entries

The challenge is to right align a part of the line - this is useful in some SQL queries where it's more clear which are the fields displayed

  • Best score: 19
  • Best player score: 20
  • Position: #21 / 34
  • Number of attempts: 3
Quote modules - 1033 entries

Complete golang import statement.

  • Best score: 21
  • Best player score: 22
  • Position: #77 / 266
  • Number of attempts: 5
Aliases for cd - 830 entries

Create these beautiful aliases with as few strokes as possible. Are you up for the challenge?

  • Best score: 30
  • Best player score: 30
  • Position: #18 / 148
  • Number of attempts: 13
Quote modules (ver.2) - 200 entries

Complete golang import statement.

  • Best score: 22
  • Best player score: 23
  • Position: #23 / 54
  • Number of attempts: 3
citizen_hacks_2019_challenge2 - 187 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #63 / 97
  • Number of attempts: 1
Swap values inside brackets - 2443 entries

Easy challenge.

  • Best score: 14
  • Best player score: 14
  • Position: #99 / 566
  • Number of attempts: 5
Unsemantic linewrapping - 873 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: 9
  • Position: #100 / 221
  • Number of attempts: 4
Applying same text modification in several lines - 2816 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #24 / 833
  • Number of attempts: 3
Add string initializers to an enum - 850 entries

Change Typescript enum so that it has string initializers.

  • Best score: 21
  • Best player score: 22
  • Position: #99 / 250
  • Number of attempts: 2
SCREAMING_SNAKE_CASE to Title Case - 1133 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: 20
  • Position: #100 / 237
  • Number of attempts: 10
Add semicolons - 10744 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 10
  • Position: #758 / 3030
  • Number of attempts: 3
Bad Copy Syntax - 1966 entries

Copy should be from right to left, but sometimes you type it wrong.

  • Best score: 18
  • Best player score: 19
  • Position: #214 / 506
  • Number of attempts: 4
remove lines containing the word "reader" - 3502 entries

easy stuff

  • Best score: 9
  • Best player score: 15
  • Position: #1058 / 1134
  • Number of attempts: 2
Com(m)a Trouble - 3552 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #165 / 798
  • Number of attempts: 6
Extract wireshark capture filter - 196 entries

Extract wireshark capture filter from IP plan

  • Best score: 25
  • Best player score: 25
  • Position: #8 / 65
  • Number of attempts: 3
Box it - 7782 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 22
  • Position: #547 / 1853
  • Number of attempts: 4
Tables, Functions, Sprocs - 123 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: 11
  • Position: #35 / 43
  • Number of attempts: 2
Hash staircase - 46 entries

Can you use a strategy to come up with this pattern?

  • Best score: 21
  • Best player score: 21
  • Position: #13 / 21
  • Number of attempts: 5
Cool or not? - 773 entries

abc trying to be cool or not...

  • Best score: 15
  • Best player score: 16
  • Position: #119 / 222
  • Number of attempts: 1
multiple cursor alternative - 1460 entries

from: https://www.reddit.com/r/vim/comments/6w5pfa/crosspost_from_remacs_how_would_you_do_this_in_vim/

  • Best score: 19
  • Best player score: 19
  • Position: #95 / 374
  • Number of attempts: 5
Two pairs of cluster of letters creates word - 729 entries

Clean and group.

  • Best score: 17
  • Best player score: 17
  • Position: #58 / 172
  • Number of attempts: 7
Convert Application Output to CSV - 184 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 17
  • Position: #35 / 51
  • Number of attempts: 4
Preferably without multi-cursor plugin - 530 entries

Originally asked as question on reddit by kpthunder: https://www.reddit.com/r/vim/comments/9fvsro/what_is_the_most_efficient_way_to_go_about/

  • Best score: 30
  • Best player score: 31
  • Position: #38 / 125
  • Number of attempts: 3
Number Sort - 300 entries

sort the list of newline-separated numbers incrementally. Numbers are in the range 1 to 1000, with 500 missing

  • Best score: 9
  • Best player score: 9
  • Position: #135 / 160
  • Number of attempts: 1
Flip the bit - 117 entries

Change the specific 0 to a 1.

  • Best score: 8
  • Best player score: 9
  • Position: #39 / 68
  • Number of attempts: 2
Just the middle - 11318 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 12
  • Position: #4007 / 4152
  • Number of attempts: 1
Team names - 1795 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 16
  • Position: #279 / 578
  • Number of attempts: 1
Learn some german verbs - 529 entries

The list needs to be structured so we can print in verbatim and feel ok about how it looks.

  • Best score: 21
  • Best player score: 21
  • Position: #54 / 130
  • Number of attempts: 2
Subnetting - 109 entries

Split up the IP addresses in the right way.

  • Best score: 29
  • Best player score: 29
  • Position: #13 / 35
  • Number of attempts: 4
Remember VimGolf Rules ! - 254 entries

Rules, ... and don't forget !

  • Best score: 7
  • Best player score: 8
  • Position: #127 / 136
  • Number of attempts: 1
Basic renumbering - 5514 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #240 / 1249
  • Number of attempts: 1
Interactive git rebase changing commands - 160 entries

How to change the action of some commits in git rebase dialog.

  • Best score: 15
  • Best player score: 15
  • Position: #57 / 76
  • Number of attempts: 2
ninja substitution - 1350 entries

How can you reuse a previous substitution ?

  • Best score: 14
  • Best player score: 15
  • Position: #137 / 258
  • Number of attempts: 4
Vice versa - 7675 entries

Little role switching.

  • Best score: 12
  • Best player score: 17
  • Position: #1647 / 2078
  • Number of attempts: 2
citizen_hacks_2019_challenge4 - 85 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 5
  • Best player score: 5
  • Position: #49 / 59
  • Number of attempts: 1
One to Ten - 2128 entries

Generate the sequence of numbers from 1 to 10, one number per line. Inspired by this Reddit thread: https://redd.it/ak4it2

  • Best score: 12
  • Best player score: 12
  • Position: #314 / 652
  • Number of attempts: 5
Change part of a function name in multiple occurrences - 627 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: 15
  • Position: #122 / 200
  • Number of attempts: 1
citizen_hacks_2019_challenge5 - 132 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #45 / 71
  • Number of attempts: 1
Line under headers - 1959 entries

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

  • Best score: 24
  • Best player score: 25
  • Position: #46 / 483
  • Number of attempts: 7
Build a six - 268 entries

Just enjoy building "a" floors...

  • Best score: 22
  • Best player score: 22
  • Position: #57 / 90
  • Number of attempts: 1
Increment each number - 970 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 17
  • Position: #88 / 240
  • Number of attempts: 5
simple format (3) - 65 entries

reverse two column values!

  • Best score: 34
  • Best player score: 34
  • Position: #6 / 19
  • Number of attempts: 5
Around the clock - 187 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: 14
  • Position: #50 / 73
  • Number of attempts: 1
Join 'em - 243 entries

This shouldn't be too tough

  • Best score: 4
  • Best player score: 4
  • Position: #18 / 144
  • Number of attempts: 1
Delete to the end of the current line - 729 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #253 / 359
  • Number of attempts: 2
Song Transcription Oops - 229 entries

When transcribing vocal music to Canjo Tab you can start by finding the lowest note and assigning that to zero and working your way up from there. However, without fail, I tend to miscount the notes and when I am near done I find a lower note. I mark this with a "z". This means I have to increase all the previous ones by 1. just a sting of numbers :)

  • Best score: 15
  • Best player score: 15
  • Position: #56 / 73
  • Number of attempts: 2
change parenthesis - 276 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #91 / 155
  • Number of attempts: 1
Label grid cells (6x6) - 42 entries

Label the cells of a grid with its coordinates. Rows are labelled top to bottom from A to F, and columns left to right from A to F. Each cell has a coordinate MN, where M is the row letter and N is the column letter.

  • Best score: 31
  • Best player score: 31
  • Position: #4 / 16
  • Number of attempts: 8
Remove quotes after first field - 340 entries

Remove the quotes around each field except for the first field.

  • Best score: 16
  • Best player score: 16
  • Position: #32 / 85
  • Number of attempts: 6
Put the months in order - 926 entries

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

  • Best score: 20
  • Best player score: 20
  • Position: #19 / 157
  • Number of attempts: 4
Reorder the groups - 1128 entries

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

  • Best score: 14
  • Best player score: 14
  • Position: #93 / 257
  • Number of attempts: 4
move titles next to url, in quotes - 501 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 20
  • Position: #28 / 133
  • Number of attempts: 3
convert yml into java pojo field - 829 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: 29
  • Position: #90 / 223
  • Number of attempts: 3
unknown command - 154 entries

I want change 5 words

  • Best score: 7
  • Best player score: 7
  • Position: #65 / 80
  • Number of attempts: 1
Collect List - 4228 entries

Convert to comma separated list.

  • Best score: 12
  • Best player score: 13
  • Position: #615 / 1179
  • Number of attempts: 1
I forgot quotes - 15880 entries

Oops.

  • Best score: 10
  • Best player score: 27
  • Position: #4015 / 4146
  • Number of attempts: 1
Words in parens - 12821 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 18
  • Position: #2984 / 3938
  • Number of attempts: 2
Resort and deup a CSV list - 140 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: 44
  • Position: #12 / 38
  • Number of attempts: 5
If-then-else regexp - 41 entries

Rules: - golf is never following golf - vim comes first! Drawing a finite-state machine diagram could help. #regexp

  • Best score: 37
  • Best player score: 37
  • Position: #6 / 10
  • Number of attempts: 4
ASCII-art Histogram - 307 entries

Create an ASCCI-art histogram for the given numbers. Make sure not to leave trailing whitespaces. Thanks to VimGolf I recently discovered a feature of Vim thAT blew my mind. I'm curious to see what real ninjas make of it ;-)

  • Best score: 33
  • Best player score: 33
  • Position: #9 / 54
  • Number of attempts: 7
Alphabet soup - 406 entries

Create a column of all alphabet characters organized in a funky way

  • Best score: 25
  • Best player score: 25
  • Position: #16 / 99
  • Number of attempts: 4
Reverse characters in a line - 701 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 12
  • Best player score: 13
  • Position: #84 / 248
  • Number of attempts: 1
Simple text editing with Vim - 11962 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1838 / 3502
  • Number of attempts: 3
moh ayaya
Twitter:

entered into 109 challenges

contributed 0 challenges