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
#91 - platypusDancing / platypusDancing

05/03/2018 at 05:47AM

9
#92 - 石奕心 / allenshih1

06/11/2018 at 08:35PM

10
#93 - Victor Ramirez / virako

05/31/2017 at 09:05PM

10
#94 - martin tourneboeuf / martintournebo1

06/01/2017 at 05:47PM

10
#95 - Sergey Lisakov / pozitron57

06/06/2017 at 08:19PM

10
#96 - Harsh Kumar / datsleepyguy

06/07/2017 at 05:58PM

10
#97 - Benoit Tigeot / Benoit_Tgt

06/08/2017 at 04:49PM

10
#98 - Carl Egbert / CarlOEgbert

06/09/2017 at 05:51AM

10
#99 - Robert Mosher / rcmosher

06/15/2017 at 05:26PM

10
#100 - John Smith / john828495

06/16/2017 at 02:01PM

10
#101 - John Smith / johns32768

06/16/2017 at 06:46PM

10
#102 - Tom Sisk / TomSisk

06/21/2017 at 12:43AM

10
#103 - Kieron Browne / KieronBrowne1

06/30/2017 at 08:04AM

10
#104 - Ben Hill / KaizenSoze70

06/30/2017 at 12:40PM

10
#105 - Pfhor / PfhorShark

07/02/2017 at 02:53PM

10
#106 - Scott Mills / smm1729

07/11/2017 at 03:31AM

10
#107 - Jacob Buete / JBuete

07/20/2017 at 12:14PM

10
#108 - adeel hussain / adeelhussain

07/31/2017 at 06:15AM

10
#109 - Will / obiwan__k3n00bi

08/05/2017 at 03:54AM

10
#110 - Elton Kamami / pixel_grid

10/09/2017 at 08:29PM

10
#111 - しぇぱっち / shepabashi

10/22/2017 at 12:26AM

10
#112 - Vim Golf / golf_vim

10/27/2017 at 12:35AM

10
#113 - Lisa Ugray / lisa_ugray

03/16/2018 at 03:48PM

10
#114 - Guirec CORBEL / GuirecCorbel

04/01/2018 at 01:03AM

11
#115 - tPenguinLTG / tpenguinltg

05/25/2017 at 04:41AM

11
#116 - Anoop Kumar / anooplive

05/25/2017 at 04:53AM

11
#117 - Benedikt Ames / wisp3rwind

06/01/2017 at 03:17PM

11
#118 - Laurent Atlan / laurentatlan1

09/10/2017 at 07:00PM

12
#119 - AleksandarTrifunovic / akstrfn

05/25/2017 at 03:46PM

12
#120 - Cristian / cris_perez_b

05/26/2017 at 08:29AM