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

Lowercase first characters - 458 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: 41
  • Position: #93 / 172
  • Number of attempts: 2
simple replacements - 1536 entries

The goal is to see the replacement commands in action.

  • Best score: 19
  • Best player score: 19
  • Position: #14 / 336
  • Number of attempts: 7
Inverting Lines - 1797 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #92 / 486
  • Number of attempts: 6
CSV to MD format - 381 entries

To convert a CSV list to Markdown list

  • Best score: 36
  • Best player score: 36
  • Position: #7 / 89
  • Number of attempts: 9
Python dataclasses - 982 entries

Simple challenge to extract fields from a Python class

  • Best score: 19
  • Best player score: 19
  • Position: #12 / 248
  • Number of attempts: 3
RUST Cargo.toml version to last - 320 entries

RUST Cargo.toml version to last. rusty practice on vimgolf

  • Best score: 16
  • Best player score: 16
  • Position: #11 / 95
  • Number of attempts: 4
RUST match with enum for Coin - 176 entries

RUST match with enum for Coin rusty practice on vimgolf

  • Best score: 84
  • Best player score: 105
  • Position: #24 / 50
  • Number of attempts: 2
Modernise code - 1331 entries

Modernise and clean up some C++ code.

  • Best score: 34
  • Best player score: 34
  • Position: #32 / 306
  • Number of attempts: 15
swap number pairs - 2002 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #31 / 369
  • Number of attempts: 19
HS Final exam vimgolf - 864 entries

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

  • Best score: 21
  • Best player score: 22
  • Position: #65 / 227
  • Number of attempts: 3
Easy modification of ssh config - 335 entries

Just add another alias to each worker

  • Best score: 24
  • Best player score: 24
  • Position: #16 / 104
  • Number of attempts: 8
ssh config skills - 249 entries

Parse output from `kuebctl get no -o wide` into an .ssh/config file!

  • Best score: 41
  • Best player score: 60
  • Position: #37 / 63
  • Number of attempts: 1
Mr. Hacker - 78 entries

Elvin is hacker. He has piece of users database from some social net site. Recently he installed Vim, and he wants to convert CSV DB to specific format `key=value' where `key' is login and `value' is password, but password in DB is encrypted in ROT13. Help him.

  • Best score: 19
  • Best player score: 19
  • Position: #5 / 32
  • Number of attempts: 4
Python: Def to Lambda - 423 entries

LAMBDA!!!

  • Best score: 19
  • Best player score: 19
  • Position: #33 / 149
  • Number of attempts: 2
Turn the x - 297 entries

Turn the x to a +

  • Best score: 19
  • Best player score: 28
  • Position: #69 / 77
  • Number of attempts: 1
Satisfy the go linter - 2169 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: #106 / 434
  • Number of attempts: 9
Add quotes to ansible playbook - 872 entries

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

  • Best score: 8
  • Best player score: 9
  • Position: #148 / 274
  • Number of attempts: 4
Multiline to Single Line - 596 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #117 / 268
  • Number of attempts: 1
Data reformat - 271 entries

Reformat this copy-paste data! #csv

  • Best score: 38
  • Best player score: 55
  • Position: #37 / 60
  • Number of attempts: 8
xrandr outputs and dashes - 652 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: #116 / 213
  • Number of attempts: 5
Capitalize the Names - 361 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: #27 / 91
  • Number of attempts: 9
Replace pattern with 1, 2, 3, ... on each line - 1090 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: 21
  • Position: #36 / 223
  • Number of attempts: 14
Hogwarts Email Sorting - 875 entries

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

  • Best score: 20
  • Best player score: 21
  • Position: #95 / 253
  • Number of attempts: 4
Get mail address from outlook format - 621 entries

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

  • Best score: 15
  • Best player score: 15
  • Position: #67 / 196
  • Number of attempts: 10
Reconstruct the actual output from my unit test tool report - 151 entries

When a test fails, my unit test tool reports differences between the actual output and the expected output as follow: - line in the expected output but missing in the actual output are prefixed with a dash - unexpected lines in the actual output are prefixed with a plus sign - comments added by the unit test tool are prefixed with a question mark - common lines are showed `as-is` (well, almost;) From that "diff" format, I would like to reconstruct the actual output.

  • Best score: 16
  • Best player score: 16
  • Position: #20 / 51
  • Number of attempts: 5
Add text at some column - 154 entries

Complete golang struct statement.

  • Best score: 31
  • Best player score: 32
  • Position: #35 / 60
  • Number of attempts: 2
prepend * to every non-blank line - 6202 entries

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

  • Best score: 10
  • Best player score: 10
  • Position: #408 / 1514
  • Number of attempts: 3
Right Align Part of the line - 117 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: 19
  • Position: #4 / 38
  • Number of attempts: 6
TAR archive pretty print - 24 entries

Will you use isk ?

  • Best score: 24
  • Best player score: 25
  • Position: #6 / 11
  • Number of attempts: 5
Quote modules (ver.2) - 211 entries

Complete golang import statement.

  • Best score: 22
  • Best player score: 23
  • Position: #21 / 56
  • Number of attempts: 12
Separate the lines - 175 entries

Every other line is mixed up. Separate them into their original texts.

  • Best score: 11
  • Best player score: 11
  • Position: #52 / 89
  • Number of attempts: 7
citizen_hacks_2019_challenge2 - 189 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 7
  • Position: #87 / 99
  • Number of attempts: 1
Palindrome numbers - 21 entries

For each number compute its associated palindrome. First number (first line) has been eaten! #prime

  • Best score: 30
  • Best player score: 33
  • Position: #9 / 14
  • Number of attempts: 3
V to the i - 4743 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 7
  • Position: #773 / 1878
  • Number of attempts: 2
Refactor typescript arrow function type - 302 entries

Make arrow function type less verbose and easier to read

  • Best score: 20
  • Best player score: 20
  • Position: #22 / 68
  • Number of attempts: 7
Add semicolons - 10785 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 11
  • Position: #1737 / 3042
  • Number of attempts: 6
remove lines containing the word "reader" - 3528 entries

easy stuff

  • Best score: 9
  • Best player score: 9
  • Position: #479 / 1142
  • Number of attempts: 4
Box it - 7818 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 28
  • Position: #1271 / 1861
  • Number of attempts: 3
Tables, Functions, Sprocs - 125 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: #31 / 44
  • Number of attempts: 3
Triangular Numbers - 90 entries

Generate the first 50 triangular numbers.

  • Best score: 18
  • Best player score: 18
  • Position: #15 / 26
  • Number of attempts: 8
multiple cursor alternative - 1474 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: #91 / 376
  • Number of attempts: 6
Convert Application Output to CSV - 187 entries

Change the application output to comma-separated values

  • Best score: 17
  • Best player score: 17
  • Position: #33 / 52
  • Number of attempts: 4
Preferably without multi-cursor plugin - 538 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: 30
  • Position: #20 / 127
  • Number of attempts: 8
Number Sort - 303 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: 10
  • Position: #154 / 162
  • Number of attempts: 2
Flip the bit - 119 entries

Change the specific 0 to a 1.

  • Best score: 8
  • Best player score: 8
  • Position: #32 / 70
  • Number of attempts: 3
Learn some german verbs - 531 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: #50 / 131
  • Number of attempts: 5
Todo list specification - 385 entries

The every item on the todo list must be done today. Modify the list to reflect that.

  • Best score: 37
  • Best player score: 37
  • Position: #90 / 176
  • Number of attempts: 5
For all cases. - 141 entries

In this case... change it! :) Watch the line.

  • Best score: 8
  • Best player score: 8
  • Position: #76 / 100
  • Number of attempts: 1
Stairstep digits - 376 entries

Remove the evens. Double the odds.

  • Best score: 9
  • Best player score: 9
  • Position: #45 / 141
  • Number of attempts: 4
Back to the roots - 52 entries

Johnny has a file with more integers. He wants to change each number with its square root. Can you help him?

  • Best score: 22
  • Best player score: 23
  • Position: #27 / 36
  • Number of attempts: 1
Turn a ninja to case-insensitive [Nn][Ii][Nn][Jj][Aa] regexp! - 63 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: #25 / 37
  • Number of attempts: 1
Missing Library and a Typo - 856 entries

I forgot to add a c library, please add it for me. Also I'm bad at typing so fix my typo too.

  • Best score: 15
  • Best player score: 17
  • Position: #119 / 209
  • Number of attempts: 10
Long prime list - filter version - 26 entries

I've used the maximum input/diff/output size allowed by vimgolf to get a list of integers up to 1460 separated by newlines, and your goal is to only keep the lines containing primes. There are 232 of them I hope some of you will golf vimscript itself to create some function to run as a primality check for each line, which is a good exercise if you haven't done much vimscript yet! You're invited to also try copy-pasting and doing other non-smart text manipulation. Even more interesting would be to see a solution that uses text manipulation to do the filtering! Whether you use vimscript, normal-mode primality checks, or text manipulation, as long as the end result is valid, your answer will be valid! Let's see which method does better here. Best of luck!

  • Best score: 27
  • Best player score: 28
  • Position: #4 / 8
  • Number of attempts: 5
Basic renumbering - 5584 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 11
  • Position: #255 / 1257
  • Number of attempts: 2
create arrows in a list - 103 entries

Add arrow at same distance

  • Best score: 10
  • Best player score: 10
  • Position: #54 / 70
  • Number of attempts: 4
sort python functions and methods alphabetically - 22 entries

* sort functions in the python file alphabetically * sort functions within a Class alphabetically * sort Classes alphabetically

  • Best score: 20
  • Best player score: 20
  • Position: #6 / 13
  • Number of attempts: 3
Create a table - 325 entries

Convert the given input into a formatted table

  • Best score: 16
  • Best player score: 16
  • Position: #45 / 104
  • Number of attempts: 9
Fiddle percentages into real numbers - 840 entries

Get rid of the '%' symbols and shift the decimal place. This is the easier version - all the columns line up.

  • Best score: 13
  • Best player score: 20
  • Position: #269 / 287
  • Number of attempts: 1
Add to end of each line... kinda - 323 entries

Visual-block mode can be used to add something to the end of each line, even if they are of differing lengths. However, what if it's not quite at the end?

  • Best score: 12
  • Best player score: 13
  • Position: #150 / 170
  • Number of attempts: 1
Pretty multi-line bash - 218 entries

Bash line continuations are much prettier when they're column aligned.

  • Best score: 15
  • Best player score: 19
  • Position: #33 / 75
  • Number of attempts: 2
Paragraph sort - 430 entries

My large herbivorous mammals, Vim commands, and POSIX utilities need to be sorted separately.

  • Best score: 14
  • Best player score: 14
  • Position: #42 / 123
  • Number of attempts: 18
Triangle of arrows - 166 entries

I made this by accident when working on another challenge. How would you go about making this?

  • Best score: 14
  • Best player score: 14
  • Position: #9 / 39
  • Number of attempts: 11
Order and join - 948 entries

There's something special about the input order.

  • Best score: 10
  • Best player score: 10
  • Position: #74 / 254
  • Number of attempts: 6
Paragraph breaks - 505 entries

Swap the blank lines and the aaa lines.

  • Best score: 10
  • Best player score: 11
  • Position: #82 / 165
  • Number of attempts: 13
Mirrored text - 163 entries

backward and forward, and long enough to be challenging

  • Best score: 14
  • Best player score: 15
  • Position: #30 / 69
  • Number of attempts: 1
Generate a list of numbers - 283 entries

Please generate list of numbers from 1 to 20.

  • Best score: 14
  • Best player score: 14
  • Position: #59 / 136
  • Number of attempts: 4
One to Ten - 2159 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: #336 / 660
  • Number of attempts: 5
citizen_hacks_2019_challenge5 - 137 entries

For the Citizen Hacks 2019 Vim competition.

  • Best score: 6
  • Best player score: 6
  • Position: #36 / 73
  • Number of attempts: 3
Increment each number - 977 entries

Increment each number individually by one

  • Best score: 15
  • Best player score: 16
  • Position: #83 / 242
  • Number of attempts: 8
Join 'em - 247 entries

This shouldn't be too tough

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

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

  • Best score: 5
  • Best player score: 5
  • Position: #244 / 363
  • Number of attempts: 1
Song Transcription Oops - 234 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: #51 / 75
  • Number of attempts: 6
change parenthesis - 278 entries

change the pair of braces into a pair of parentheses

  • Best score: 9
  • Best player score: 9
  • Position: #79 / 156
  • Number of attempts: 2
Remove quotes after first field - 353 entries

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

  • Best score: 16
  • Best player score: 18
  • Position: #41 / 87
  • Number of attempts: 7
Reorder the groups - 1137 entries

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

  • Best score: 14
  • Best player score: 14
  • Position: #86 / 259
  • Number of attempts: 11
Add Go XML to structure tags - 152 entries

The Go programming language can directly map XML to structure fields. Add the correct XML tag after each field.

  • Best score: 23
  • Best player score: 24
  • Position: #14 / 66
  • Number of attempts: 9
move titles next to url, in quotes - 504 entries

had trouble with something similar

  • Best score: 19
  • Best player score: 19
  • Position: #11 / 135
  • Number of attempts: 6
Assign numbers to fields - 105 entries

You are given a list of space-separated strings. Add an increasing numeric prefix to each one.

  • Best score: 19
  • Best player score: 21
  • Position: #50 / 59
  • Number of attempts: 1
Mirror Symmetry - 798 entries

Add backslashes.

  • Best score: 7
  • Best player score: 7
  • Position: #89 / 266
  • Number of attempts: 6
Simple format (2) - 334 entries

try again!

  • Best score: 23
  • Best player score: 23
  • Position: #17 / 69
  • Number of attempts: 13
Line 'em up! - 392 entries

It can be so hard to keep everything neatly lined-up. Somebody clearly hasn't bothered here. Tidy it up, please!

  • Best score: 17
  • Best player score: 18
  • Position: #54 / 110
  • Number of attempts: 20
50 factorials mod 97 - 47 entries

List 1! to 50!, but give your answer mod 97.

  • Best score: 28
  • Best player score: 29
  • Position: #8 / 18
  • Number of attempts: 6
Sorting database text output - 219 entries

Sometimes it is nice to be able to quickly take column-formatted text output from the SQL command line and turn it into a list of useful data. In this case we want a unique, sorted list of the values from the second column combined into one comma-separated list. What is the fewest strokes you can do this in?

  • Best score: 24
  • Best player score: 25
  • Position: #52 / 81
  • Number of attempts: 7
Comparing scores - 94 entries

If Alice and Bob both did the challenge, put their entries together in the top paragraph, so we can compare their scores more easily.

  • Best score: 18
  • Best player score: 21
  • Position: #11 / 33
  • Number of attempts: 9
NATO phonetic alphabet - 498 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 20
  • Position: #54 / 189
  • Number of attempts: 7
Alphabet soup - 419 entries

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

  • Best score: 25
  • Best player score: 26
  • Position: #46 / 103
  • Number of attempts: 3
calculations - 262 entries

Complete these (weird) calculations.

  • Best score: 38
  • Best player score: 38
  • Position: #14 / 64
  • Number of attempts: 8
pikjes
Twitter:

entered into 87 challenges

contributed 0 challenges