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 59265921e633730ce0000016

comment and uncomment code inline

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.

Start file
These first three lines should
be commented out with C-style
inline comments.

// These three lines should have
// the C-style insline comment 
// characters removed.
End file
// These first three lines should
// be commented out with C-style
// inline comments.

These three lines should have
the C-style insline comment 
characters removed.

View Diff

1,3c1,3
< These first three lines should
< be commented out with C-style
< inline comments.
---
> // These first three lines should
> // be commented out with C-style
> // inline comments.
5,7c5,7
< // These three lines should have
< // the C-style insline comment 
< // characters removed.
---
> These three lines should have
> the C-style insline comment 
> characters removed.

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 136 remaining solutions by signing in and submitting your own entry
#137 Brandon Height / Lask0x - Score: 12 - 08/08/17 @ 01:30
G<C-V>2l2kxggPZZ

0 comments


#138 jirgn / jirgn - Score: 12 - 09/24/17 @ 17:15
G<C-V>kkllxggPZZ

0 comments


#139 Jeff / RealJeffIrwin - Score: 12 - 09/29/17 @ 13:38
G<C-V>kkllxggPZZ

0 comments


#140 Ron Alexssen / Ralexhere - Score: 12 - 10/18/17 @ 16:27
5G<C-V>GlldggPZZ

0 comments


#141 Ahmed Hasan / microbialwalrus - Score: 12 - 12/25/17 @ 18:24
G<C-V>2k2ldggPZZ

0 comments


#142 Tim / timothyscosta - Score: 12 - 04/08/18 @ 14:16
G<C-V>2l2kxggPZZ

0 comments


#143 cds / cdsudama - Score: 12 - 04/13/18 @ 07:55
4j<C-V>GtcdggPZZ

0 comments


#144 赤佐田奈葉 / akasatanaha_ - Score: 12 - 06/19/18 @ 04:44
G<C-V>kklldggPZZ

0 comments


#145 Paul Ewing / Wangledorf - Score: 13 - 05/26/17 @ 08:05
4j<C-V>lljjdggPZZ

0 comments


#146 lpag / lpag_ai - Score: 13 - 05/31/17 @ 20:54
4j<C-V>lljjdggPZZ

0 comments


#147 squdle / squdle - Score: 13 - 06/17/17 @ 13:16
5G<C-V>3jtcdggPZZ

0 comments


#148 grigouille / grigouille2 - Score: 13 - 07/05/17 @ 20:09
4j<C-V>lljjxggPZZ

0 comments


#149 黒澤亮二 / rjkuro - Score: 13 - 07/22/17 @ 08:28
5G<C-V>jjlldggPZZ

0 comments


#150 Marcin Paliwoda / eukaliptuss - Score: 13 - 08/25/17 @ 13:54
4j<C-V>2j2ld4kPZZ

0 comments


#151 Herr Joschka / HerrJoschka - Score: 13 - 10/18/17 @ 04:49
G<C-V>G5G2lxggPZZ

0 comments


#152 Wayne / lilwayne15561 - Score: 13 - 11/28/17 @ 01:54
4j<C-V>lljjxggPZZ

0 comments


#153 Akilan Anbalagan / akilananb - Score: 13 - 03/27/18 @ 08:50
}j<C-V>GlldggP:x<CR>

0 comments


#154 Jonathan Camilleri / Too_Many_Taken - Score: 13 - 05/26/18 @ 12:21
4j<C-V>2j2ld9kPZZ

0 comments


#155 k4 / k4limschka - Score: 14 - 08/30/17 @ 13:06
G<C-C><C-C><C-V>2l2kxggPZZ

0 comments


#156 Eric Coleman / EpicColeman - Score: 15 - 06/06/17 @ 18:48
4j<C-V>lljjxggP:wq<CR>

0 comments


#157 Paul Inc / hiniol1982 - Score: 15 - 07/13/17 @ 15:32
:5<CR><C-V>lljjd0ggPZZ

0 comments


#158 Chris Bywater / cbywater - Score: 17 - 05/26/17 @ 15:39
<C-V>jjI// <Esc>G<C-V>lkklxZZ

0 comments


#159 James Houghton / jamesthoughton - Score: 17 - 05/26/17 @ 17:06
<C-V>2jI// <Esc>5G<C-V>GllxZZ

0 comments


#160 Anne Pacalet / _Anne_P - Score: 17 - 07/06/17 @ 11:01
<C-V><Down><Down>I// <Esc>G<C-V><Up><Up><Right><Right>xZZ

0 comments


#161 Gurukandhamoorthi / Gurukandhamoor1 - Score: 17 - 07/09/17 @ 15:18
<C-V>jjI// <Esc>G<C-V>e kkxZZ

0 comments


#162 Sean Earle / Hell_Rok - Score: 17 - 05/07/18 @ 05:35
<C-V>jjI// <Esc>}<C-V>3jlldZZ

0 comments


#163 Ryan Coopersmith / RyanCoopersmit1 - Score: 18 - 06/03/17 @ 16:05
<C-V>2jI// <Esc>5G<C-V>2j2lxZZ

0 comments


#164 Karl Hepler / oldtimeguitar - Score: 19 - 05/25/17 @ 15:56
<C-V>2jI// <Esc>4j<C-V>G2ld:wq<CR>

0 comments


#165 vimgolfer / vimgolfinger - Score: 19 - 11/06/17 @ 13:24
<C-V>2jI// <Esc>:5<CR><C-V>2j2lxZZ

0 comments


#166 Ntinos Mavrakis / konmavrakis - Score: 19 - 05/04/18 @ 14:06
<C-V>3GI// <Esc>5Gd3lj.j.ZZ

0 comments


#167 Justin Hoyt / JustinHoyt24 - Score: 22 - 05/03/18 @ 20:46
I// <Esc>j.j.jjbdwj.j.:wq<CR>

0 comments


#168 John Doe Jr / bf4648 - Score: 27 - 06/04/17 @ 05:29
:1,3norm<Tab> i// <CR>:5<CR><C-V>Gllx:wq<CR>

0 comments


#169 JD Kaplan / jedeleh - Score: 27 - 04/25/18 @ 14:30
3:norm i// <CR>jj3:norm xxx<CR>ZZ

0 comments


#170 Nathan J Slaughter / NjSlaughter - Score: 28 - 05/25/17 @ 04:11
v2j:s!^!// !<CR>5GvG:s!// !!<CR>ZZ

zulolosi: Nice complication !...

1 comment


#171 Thomas Gebert / realtombert - Score: 35 - 09/29/17 @ 15:43
qa0i// <Esc>jq@a@@jqa0xxx<Esc>qj@@j@@<Esc><Esc>:wq<CR>

0 comments


Created by: NjSlaughter

171 active golfers, 502 entries

Leaderboard (lowest score wins):
9
#31 - Anthony George / Xanuthatusu

06/12/2017 at 08:03PM

9
#32 - kanazawak / _kanazawak

06/13/2017 at 03:11PM

9
#33 - Michael Buckley / apolatg

06/13/2017 at 09:26PM

9
#34 - xer0x / xer0x

06/16/2017 at 05:16AM

9
#35 - Brian Hall / _bruab_

06/16/2017 at 05:42PM

9
#36 - Sebastián Etra / EtraStyle

06/17/2017 at 04:07AM

9
#37 - Joel Meyer-Hamme / JoelMeyerHamme

06/18/2017 at 12:06PM

9
#38 - Super VedoVatto / supervedovatto

06/18/2017 at 12:14PM

9
#39 - Meriadec Pillet / loomisBroom

06/18/2017 at 05:36PM

9
#40 - Артем Верхоглядов / artditel

06/19/2017 at 03:26PM

9
#41 - Kawin Nikomborirak / KNikomborirak

06/21/2017 at 05:06AM

9
#42 - Christian Stammen / c0smiq

06/21/2017 at 09:11PM

9
#43 - YamasakiKenta / ymknjugg

06/24/2017 at 08:10AM

9
#44 - Mayank Suman / mayank_suman

06/24/2017 at 05:28PM

9
#45 - akanb / GAkt6L6SlKhy8zA

06/28/2017 at 03:49AM

9
#46 - Bennett Bernardoni / BBernardoni

06/28/2017 at 04:54PM

9
#47 - 杨洋 / 176795444

07/01/2017 at 05:21AM

9
#48 - Stop and think / ms_uncountable

07/07/2017 at 07:58PM

9
#49 - Dick Quixly / DickQuixly

07/09/2017 at 02:24PM

9
#50 - Jon Barker / j0nbarker

07/13/2017 at 11:24PM

9
#51 - Ryan McNamara / MadDogMcNamara

07/16/2017 at 05:21PM

9
#52 - zhangxspace / zhangxspace1

07/25/2017 at 09:21AM

9
#53 - Gabriel Siqueira / Gabriel_HSiq

07/27/2017 at 01:24PM

9
#54 - huho / huho_xu

07/29/2017 at 06:08PM

9
#55 - Matthieu Crapet / mcr05

08/06/2017 at 09:37PM

9
#56 - Cheer / yougec

08/11/2017 at 04:00AM

9
#57 - Jonathan Eidsness / jonathaneidsnes

08/11/2017 at 10:39PM

9
#58 - Baine Wedlock / BaineWedlock

08/13/2017 at 05:54PM

9
#59 - Daniel / 0x9ABC

08/16/2017 at 05:47PM

9
#60 - Philippe Brouillard / _kurowasan

08/20/2017 at 03:38AM