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
#1 - Cristian Lupașcu / clupasq

05/25/2017 at 06:16AM

9
#2 - Melvin Cheung / MelvinCheung

05/25/2017 at 06:25AM

9
#3 - Smylers / Smylers2

05/25/2017 at 06:43AM

9
#4 - Андрей / andreyrmg

05/25/2017 at 06:46AM

9
#5 - Urtica dioica / udioica

05/25/2017 at 06:54AM

9
#6 - John Braxler / braxler

05/25/2017 at 11:26AM

9
#7 - Rodrigo Dorantes G. / ruydg

05/25/2017 at 01:59PM

9
#8 - Saki Gw / Sakigw

05/26/2017 at 09:14AM

9
#9 - David / Revan4Vendetta

05/26/2017 at 10:23AM

9
#10 - Tomas Sikula / tomsmicroblog

05/26/2017 at 12:31PM

9
#11 - Assaf Lavie / AssafLavie

05/26/2017 at 01:56PM

9
#12 - ybw / yossibenwolf

05/28/2017 at 09:40AM

9
#13 - Petro Тrouq / zulolosi

05/28/2017 at 03:27PM

9
#14 - Zachary Neubert / Mr_Saturn16347

05/28/2017 at 11:45PM

9
#15 - Stanislav / prstad

05/29/2017 at 11:56AM

9
#16 - Kristian Haug / krimhaug

05/29/2017 at 07:16PM

9
#17 - Vaughn Cato / vaughncato

05/29/2017 at 08:50PM

9
#18 - Eloi S. Quesnel / EloiSimardQ

05/30/2017 at 03:20AM

9
#19 - Christian Abbott / etopixi

05/30/2017 at 11:43AM

9
#20 - TongHyun Kim / crowdy

05/30/2017 at 01:45PM

9
#21 - Jye Sawtell-Rickson / jsawtellrickson

05/31/2017 at 09:01AM

9
#22 - Marco Fontani / mfontani

05/31/2017 at 03:49PM

9
#23 - Lukas Tobler / lut0bler

06/03/2017 at 07:12PM

9
#24 - ssh89 / ssh89

06/04/2017 at 01:30PM

9
#25 - Bruce Park / bpark0

06/04/2017 at 10:44PM

9
#26 - 梧桐王子 / WutongYujie

06/05/2017 at 05:04AM

9
#27 - .... / coffman_r

06/07/2017 at 12:23AM

9
#28 - David Gustavsson / mrGustaphe

06/08/2017 at 06:42AM

9
#29 - sebastian pech / specht08

06/08/2017 at 12:30PM

9
#30 - Daniel Hjelm / dhjelm

06/09/2017 at 05:10PM