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]

25650 active golfers, 287130 entries, 458 challenges

Open VimGolf challenges

switch variable - 4345 entries

how fast can you switch two variable ?

Split line with dots - 1865 entries

This line is too long, split it.

Join 'em - 159 entries

This shouldn't be too tough

multiple cursor alternative - 1101 entries

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

Remove quotes after first field - 143 entries

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

-a-b-c- - 2637 entries

Put hyphens everywhere.

attr_aligner - 3040 entries

Two attr keywords. Two separate indentations. Align the colons.

move titles next to url, in quotes - 315 entries

had trouble with something similar

From argument to object - 1115 entries

This task typifies those programmers endure while coding. This C-family pseudocode needs a function argument to be repurposed as an object call. Simply search and replace? Repeat a pattern of edits?

citizen_hacks_2019_challenge3 - 17 entries

For the Citizen Hacks 2019 Vim competition.

Search and Replace 0 - 4170 entries

Replace every instance of 'aaa' with 'xaaax'.

quotes inside quotes - 2807 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

Around the clock - 131 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

That hyphen - 2205 entries

"vim vi improved"

Extract argument from function - 2019 entries

The aim is to see if you can do some refactoring very fast.

Build a six - 222 entries

Just enjoy building "a" floors...

comment and uncomment code inline - 826 entries

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

citizen_hacks_2019_part6 - 12 entries

For the Citizen Hacks 2019 Vim competition

Don't know what this is - 1775 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

Adam's challenge - 804 entries

Change both normal to bold and 4 by 2. Adam Wathan challenge this on twitter . He did it in 11 keystrokes on Sublime.

replacing each line of a block selection - 2545 entries

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

Missing Library and a Typo - 714 entries

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

Space out the alphabet - 1382 entries

Put 3 spaces between adjacent letters.

Preferably without multi-cursor plugin - 296 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/

Vertical Limit - 2126 entries

transform a succession of one word lines to a an array of strings

Whitespace, empty lines and tabs - 2557 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

Fiddle percentages into real numbers - 724 entries

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

Simple format (2) - 238 entries

try again!

Tables, Functions, Sprocs - 77 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.

Order and join - 756 entries

There's something special about the input order.

Saving the hashes(#) - 1770 entries

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

Resort and deup a CSV list - 119 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.

Learn some german verbs - 393 entries

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

Switch function arguments - 1843 entries

How to switch two arguments of a function.

Align commas - 854 entries

There are 15,000 aligning challenges on vimgolf.com, and they're all exactly the same. I hope this one is a little different.

Convert Application Output to CSV - 123 entries

Change the application output to comma-separated values

comments galore - 908 entries

Basic comment reformatting

Letter case trickery - 1448 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

Label grid cells (6x6) - 13 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.

citizen_hacks_2019_part1 - 8 entries

For the Citizen Hacks 2019 Vim competition

Make it more readable - 1761 entries

Insert blank lines to make it more organized and readable

Make HTML List - 910 entries

Turn the comma separated list into an unordered html list.

Scrambled numbers - 730 entries

Four is NOT 1. One is 1.

C Reformatting - 640 entries

You may use Visual mode... or not. #uppercase

Numbering a List - 1743 entries

Pretty simple, number the list.

Swap the operands under comparison - 220 entries

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

Do you demand a shrubbery? - 1016 entries

Use :redir and crush the emacsgolfers.

Fix the XML - 867 entries

The challenge consists in having a valid xml from an incomplete source.

Number Sort - 244 entries

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

SFD-ROC: vimvimvim - 1294 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

VimGolf Chatter