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):
12
#121 - squid / zerosquid

05/26/2017 at 11:50PM

12
#122 - jakeroberts / jakeroberts

05/27/2017 at 07:31PM

12
#123 - duke of garda / dukeofgarda

05/29/2017 at 07:32PM

12
#124 - Edouard Piette / EdPiette

05/30/2017 at 11:41AM

12
#125 - James / Dronak

05/31/2017 at 01:15AM

12
#126 - Davis Fields / i301585

06/09/2017 at 04:37AM

12
#127 - Ayman Farhat / aymanfarhat

06/11/2017 at 11:28AM

12
#128 - jsg / jsg1122

06/13/2017 at 12:31AM

12
#129 - Robert Goeddel / f0rdpr3fect

06/15/2017 at 10:41PM

12
#130 - Jon Doe / JonDoe33157611

06/19/2017 at 01:57AM

12
#131 - Daniel Smith / _Tysonzero

06/20/2017 at 05:15PM

12
#132 - el pollo diablo / bjagojevich

06/21/2017 at 08:02PM

12
#133 - Michael Rees / reesmichael1

06/22/2017 at 10:40PM

12
#134 - Julian Felix / h4wked

06/27/2017 at 04:04PM

12
#135 - Ezra Zigmond / ezrazig

06/27/2017 at 11:55PM

12
#136 - Sergio Semedi / SergioSemedi

07/16/2017 at 01:18PM

12
#137 - Brandon Height / Lask0x

08/08/2017 at 01:30AM

12
#138 - jirgn / jirgn

09/24/2017 at 05:15PM

12
#139 - Jeff / RealJeffIrwin

09/29/2017 at 01:38PM

12
#140 - Ron Alexssen / Ralexhere

10/18/2017 at 04:27PM

12
#141 - Ahmed Hasan / microbialwalrus

12/25/2017 at 06:24PM

12
#142 - Tim / timothyscosta

04/08/2018 at 02:16PM

12
#143 - cds / cdsudama

04/13/2018 at 07:55AM

12
#144 - 赤佐田奈葉 / akasatanaha_

06/19/2018 at 04:44AM

13
#145 - Paul Ewing / Wangledorf

05/26/2017 at 08:05AM

13
#146 - lpag / lpag_ai

05/31/2017 at 08:54PM

13
#147 - squdle / squdle

06/17/2017 at 01:16PM

13
#148 - grigouille / grigouille2

07/05/2017 at 08:09PM

13
#149 - 黒澤亮二 / rjkuro

07/22/2017 at 08:28AM

13
#150 - Marcin Paliwoda / eukaliptuss

08/25/2017 at 01:54PM