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 97 remaining solutions by signing in and submitting your own entry
#98 Jon Doe / JonDoe33157611 - Score: 12 - 06/19/17 @ 01:57
G<C-V>2l2kxggPZZ

0 comments

#99 Daniel Smith / _Tysonzero - Score: 12 - 06/20/17 @ 17:15
G<C-V>kklldggPZZ

0 comments

#100 el pollo diablo / bjagojevich - Score: 12 - 06/21/17 @ 20:02
}j<C-V>GlldggPZZ

0 comments

#101 Michael Rees / reesmichael1 - Score: 12 - 06/22/17 @ 22:40
G<C-V>5G2lxggPZZ

0 comments

#102 Julian Felix / h4wked - Score: 12 - 06/27/17 @ 16:04
5G<C-V>GlldggPZZ

0 comments

#103 Ezra Zigmond / ezrazig - Score: 12 - 06/27/17 @ 23:55
5G<C-V>GlldggPZZ

0 comments

#104 Sergio Semedi / SergioSemedi - Score: 12 - 07/16/17 @ 13:18
G<C-V>2l2kdggPZZ

0 comments

#105 Brandon Height / Lask0x - Score: 12 - 08/08/17 @ 01:30
G<C-V>2l2kxggPZZ

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

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

0 comments

#117 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

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

0 comments

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

0 comments

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

0 comments

#121 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

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

zulolosi: Nice complication !...

1 comment

Created by: NjSlaughter

122 active golfers, 345 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

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 ArteStyle / 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

9
#61 - Terry Ding / TerryDing77

08/23/2017 at 07:49PM

9
#62 - harpocrates744 / harpocrates744

09/05/2017 at 08:34PM

9
#63 - zava / znl1087

09/07/2017 at 10:17AM

9
#64 - Дима / dimkino

09/07/2017 at 04:04PM

9
#65 - bazkila@gmail.com / bazkila

09/08/2017 at 08:10AM

10
#66 - Victor Ramirez / virako

05/31/2017 at 09:05PM

10
#67 - martin tourneboeuf / martintournebo1

06/01/2017 at 05:47PM

10
#68 - Sergey Lisakov / pozitron57

06/06/2017 at 08:19PM

10
#69 - Harsh Kumar / datsleepyguy

06/07/2017 at 05:58PM

10
#70 - Benoit Tigeot / Benoit_Tgt

06/08/2017 at 04:49PM

10
#71 - Carl Egbert / CarlOEgbert

06/09/2017 at 05:51AM

10
#72 - Robert Mosher / rcmosher

06/15/2017 at 05:26PM

10
#73 - John Smith / john828495

06/16/2017 at 02:01PM

10
#74 - John Smith / johns32768

06/16/2017 at 06:46PM

10
#75 - Tom Sisk / TomSisk

06/21/2017 at 12:43AM

10
#76 - Kieron Browne / KieronBrowne1

06/30/2017 at 08:04AM

10
#77 - Ben Hill / KaizenSoze70

06/30/2017 at 12:40PM

10
#78 - J / J02108006

07/02/2017 at 02:53PM

10
#79 - Scott Mills / smm1729

07/11/2017 at 03:31AM

10
#80 - Jacob Buete / JBuete

07/20/2017 at 12:14PM

10
#81 - adeel hussain / adeelhussain

07/31/2017 at 06:15AM

10
#82 - Will / obiwan__k3n00bi

08/05/2017 at 03:54AM

11
#83 - tPenguinLTG / tpenguinltg

05/25/2017 at 04:41AM

11
#84 - Anoop Kumar / anooplive

05/25/2017 at 04:53AM

11
#85 - Benedikt Ames / wisp3rwind

06/01/2017 at 03:17PM

11
#86 - Laurent Atlan / laurentatlan1

09/10/2017 at 07:00PM

12
#87 - AleksandarTrifunovic / akstrfn

05/25/2017 at 03:46PM

12
#88 - Cristian / cris_perez_b

05/26/2017 at 08:29AM

12
#89 - squid / zerosquid

05/26/2017 at 11:50PM

12
#90 - jakeroberts / jakeroberts

05/27/2017 at 07:31PM

12
#91 - duke of garda / dukeofgarda

05/29/2017 at 07:32PM

12
#92 - Edouard Piette / EdPiette

05/30/2017 at 11:41AM

12
#93 - James / Dronak

05/31/2017 at 01:15AM

12
#94 - Davis Fields / i301585

06/09/2017 at 04:37AM

12
#95 - Ayman Farhat / aymanfarhat

06/11/2017 at 11:28AM

12
#96 - jsg / jsg1122

06/13/2017 at 12:31AM

12
#97 - Robert Goeddel / f0rdpr3fect

06/15/2017 at 10:41PM

12
#98 - Jon Doe / JonDoe33157611

06/19/2017 at 01:57AM

12
#99 - Daniel Smith / _Tysonzero

06/20/2017 at 05:15PM

12
#100 - el pollo diablo / bjagojevich

06/21/2017 at 08:02PM

12
#101 - Michael Rees / reesmichael1

06/22/2017 at 10:40PM

12
#102 - Julian Felix / h4wked

06/27/2017 at 04:04PM

12
#103 - Ezra Zigmond / ezrazig

06/27/2017 at 11:55PM

12
#104 - Sergio Semedi / SergioSemedi

07/16/2017 at 01:18PM

12
#105 - Brandon Height / Lask0x

08/08/2017 at 01:30AM

13
#106 - Paul Ewing / Wangledorf

05/26/2017 at 08:05AM

13
#107 - lpag / lpag_ai

05/31/2017 at 08:54PM

13
#108 - squdle / squdle

06/17/2017 at 01:16PM

13
#109 - grigouille / grigouille2

07/05/2017 at 08:09PM

13
#110 - 黒澤亮二 / rjkuro

07/22/2017 at 08:28AM

13
#111 - Marcin Paliwoda / eukaliptuss

08/25/2017 at 01:54PM

14
#112 - k4 / k4limschka

08/30/2017 at 01:06PM

15
#113 - Eric Coleman / EpicColeman

06/06/2017 at 06:48PM

15
#114 - Paul Inc / hiniol1982

07/13/2017 at 03:32PM

17
#115 - Chris Bywater / cbywater

05/26/2017 at 03:39PM

17
#116 - James Houghton / jamesthoughton

05/26/2017 at 05:06PM

17
#117 - Anne Pacalet / _Anne_P

07/06/2017 at 11:01AM

17
#118 - Gurukandhamoorthi / Gurukandhamoor1

07/09/2017 at 03:18PM

18
#119 - Ryan Coopersmith / RyanCoopersmit1

06/03/2017 at 04:05PM

19
#120 - Karl Hepler / oldtimeguitar

05/25/2017 at 03:56PM

27
#121 - John Doe Jr / bf4648

06/04/2017 at 05:29AM

28
#122 - Nathan J Slaughter / NjSlaughter

05/25/2017 at 04:11AM