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):
13
#151 - Herr Joschka / HerrJoschka

10/18/2017 at 04:49AM

13
#152 - Wayne / lilwayne15561

11/28/2017 at 01:54AM

13
#153 - Akilan Anbalagan / akilananb

03/27/2018 at 08:50AM

13
#154 - Jonathan Camilleri / Too_Many_Taken

05/26/2018 at 12:21PM

14
#155 - k4 / k4limschka

08/30/2017 at 01:06PM

15
#156 - Eric Coleman / EpicColeman

06/06/2017 at 06:48PM

15
#157 - Paul Inc / hiniol1982

07/13/2017 at 03:32PM

17
#158 - Chris Bywater / cbywater

05/26/2017 at 03:39PM

17
#159 - James Houghton / jamesthoughton

05/26/2017 at 05:06PM

17
#160 - Anne Pacalet / _Anne_P

07/06/2017 at 11:01AM

17
#161 - Gurukandhamoorthi / Gurukandhamoor1

07/09/2017 at 03:18PM

17
#162 - Sean Earle / Hell_Rok

05/07/2018 at 05:35AM

18
#163 - Ryan Coopersmith / RyanCoopersmit1

06/03/2017 at 04:05PM

19
#164 - Karl Hepler / oldtimeguitar

05/25/2017 at 03:56PM

19
#165 - vimgolfer / vimgolfinger

11/06/2017 at 01:24PM

19
#166 - Ntinos Mavrakis / konmavrakis

05/04/2018 at 02:06PM

22
#167 - Justin Hoyt / JustinHoyt24

05/03/2018 at 08:46PM

27
#168 - John Doe Jr / bf4648

06/04/2017 at 05:29AM

27
#169 - JD Kaplan / jedeleh

04/25/2018 at 02:30PM

28
#170 - Nathan J Slaughter / NjSlaughter

05/25/2017 at 04:11AM

35
#171 - Thomas Gebert / realtombert

09/29/2017 at 03:43PM