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 553b97364ba96c319d0296eb

readability

Make the code readable by adding some spaces

Start file
J=J-y(i)*log(h)-(1-y(i))*log(1-h)+(lambda/2)*sumtheta2;
End file
J = J - y(i) * log(h) - (1 - y(i)) * log(1 - h) + (lambda / 2) * sumtheta2;

View Diff

diff --git a/vimgolf2-in b/vimgolf2-out
index 3babd97..ddbb1af 100644
--- a/vimgolf2-in
+++ b/vimgolf2-out
@@ -1 +1 @@
-J=J-y(i)*log(h)-(1-y(i))*log(1-h)+(lambda/2)*sumtheta2;
+J = J - y(i) * log(h) - (1 - y(i)) * log(1 - h) + (lambda / 2) * sumtheta2;

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 105 remaining solutions by signing in and submitting your own entry
#106 raghu erapaneedi / raghue9 - Score: 19 - 06/19/15 @ 13:44
:s:[-=+*/]: & :g<CR>ZZ

0 comments

#107 Jack Z / itszhou - Score: 19 - 06/28/15 @ 16:07
:s/[-+*/=]/ & /g<CR>ZZ

0 comments

#108 Teemu Okkonen / TeemuOkkonen - Score: 19 - 07/08/15 @ 21:17
:s#[/=*+-]# & #g<CR>ZZ

0 comments

#109 Endre Galaczi / galacziendre - Score: 19 - 08/07/15 @ 13:17
:s%[+*/=-]% & %g<CR>ZZ

0 comments

#110 Walker Boh / walker_boh - Score: 19 - 10/05/15 @ 14:15
:s#[-+=*/]# & #g<CR>ZZ

0 comments

#111 Domingue Justin / _jdomingue - Score: 19 - 10/16/15 @ 15:01
:s:[+-/*=]: & :g<CR>ZZ

0 comments

#112 Bogumił Kamiński / BogumilKaminski - Score: 19 - 10/26/15 @ 21:03
:s?[-=+*/]? & ?g<CR>ZZ

0 comments

#113 David Mauskop / mauskop - Score: 19 - 11/15/15 @ 16:40
:s/[-=+*/]/ & /g<CR>ZZ

0 comments

#114 Cristian Lupașcu / clupasq - Score: 19 - 02/22/16 @ 15:46
:s/[=<kPlus><kMultiply><kDivide><kMinus>]/ & /g<CR>ZZ

0 comments

#115 Dimitar Dimitrov / kurkale6ka - Score: 19 - 03/16/16 @ 11:46
:s:[-*+=/]: & :g|x<CR>

0 comments

#116 Will / obiwan__k3n00bi - Score: 19 - 10/15/16 @ 18:22
:s/[-=*+/]/ & /g<CR>ZZ

0 comments

#117 Michał Dytko / DytkoM - Score: 19 - 12/28/16 @ 10:29
:s/[/=*+-]/ & /g<CR>ZZ

0 comments

#118 Gurukandhamoorthi / Gurukandhamoor1 - Score: 19 - 07/15/17 @ 16:31
:s:[-=+/*]: & :g<CR>ZZ

0 comments

#119 Daniel Byron / dansolo17 - Score: 20 - 04/27/15 @ 11:01
:s/[-+=/*]/ \0 /g|x<CR>

0 comments

#120 Kevin Ilphrin Pellet / Kilphrin - Score: 20 - 05/03/15 @ 09:14
:s![-=+*/]! & !g<CR>:x<CR>

0 comments

#121 Mauro Persano / fzort - Score: 20 - 05/23/15 @ 16:30
:s/[-+*\/=]/ & /g<CR>ZZ

0 comments

#122 Andrew Reece / azmreece - Score: 20 - 09/11/15 @ 13:48
::s;[-+=*/]; & ;g<CR>ZZ

0 comments

#123 Brian Olpin / bolpin - Score: 21 - 04/28/15 @ 21:26
:s;[-+=/*]; & ;g<CR>:wq<CR>

0 comments

#124 shugen / shugeno - Score: 21 - 05/04/15 @ 19:59
:s/[-\+\/=*]/ & /g<CR>ZZ

0 comments

#125 luffy / raxcoi - Score: 21 - 05/12/15 @ 15:27
:s/[=*+\-\/]/ & /g<CR>ZZ

0 comments

#126 Ásgeir Bjarnason / abjarnasn - Score: 21 - 07/25/15 @ 15:47
:s/[-+=*/]/ g<BS>& /g|x<CR>

0 comments

#127 [Esc],[Z],[Z] / dvvrt - Score: 22 - 07/31/15 @ 06:27
:s![+*/=-]! & !g | wq<CR>

0 comments

#128 Yann Moisan / YannMoisan - Score: 24 - 04/25/15 @ 13:47
:s/\([*/=+-]\)/ \1 /g<CR>ZZ

0 comments

#129 Steven Craft / stevenjohncraft - Score: 24 - 05/26/15 @ 11:18
:s/\([*/=<kPlus><kMinus>]\)/ \1 /g<CR>ZZ

0 comments

#130 Michael Cordell / mike_cordell - Score: 27 - 04/25/15 @ 19:44
:s/\([*=+\/-]\)/ \1 /g<CR>:wq<CR>

0 comments

#131 Ivan Kasatenko / sky31338 - Score: 28 - 05/09/15 @ 16:26
:%s/\([\-\+*/=]\)/ \1 /g<CR>:x<CR>

0 comments

#132 Personal Life Trackr / PersLifeTrackr - Score: 53 - 05/24/15 @ 21:25
a <Esc>w.w.w.f).w.f).w.f1.w.5l.w.5l.w.2l.w.fafa.w.2l.w.ZZ

0 comments

Created by: YannMoisan

132 active golfers, 264 entries

Leaderboard (lowest score wins):
18
#1 - Tim Chase / gumnos

04/25/2015 at 02:20PM

18
#2 - pftb12345 / pftb12345

04/25/2015 at 02:31PM

18
#3 - matthieu le grix / mlegrix

04/25/2015 at 03:35PM

18
#4 - Urtica dioica / udioica

04/25/2015 at 03:56PM

18
#5 - Thameera Senanayaka / thameera

04/25/2015 at 04:17PM

18
#6 - Petro Тrouq / zulolosi

04/25/2015 at 05:00PM

18
#7 - Louis Caruana / louiecaruana

04/25/2015 at 05:34PM

18
#8 - Andreas Carben / meiner_eins

04/25/2015 at 08:05PM

18
#9 - Phil Runninger / PhilRunninger

04/26/2015 at 12:54AM

18
#10 - Johannes Elferich / jojoelfe

04/26/2015 at 01:01AM

18
#11 - Rathrio / Rathrio

04/26/2015 at 09:48AM

18
#12 - Oleg Parashchenko / olparko

04/26/2015 at 09:58PM

18
#13 - Bruce Park / bpark0

04/27/2015 at 12:42AM

18
#14 - Roman Zolotarev / romanzolotarev

04/27/2015 at 02:42AM

18
#15 - Antony Scriven / antonyscriven

04/27/2015 at 04:44AM

18
#16 - Kai Yuan / kentyuan

04/27/2015 at 08:13AM

18
#17 - Sam Cristall / sbcristall

04/27/2015 at 03:03PM

18
#18 - Wandering ponderer / 0proxycon

04/27/2015 at 03:57PM

18
#19 - John Braxler / braxler

04/27/2015 at 05:29PM

18
#20 - Dr Rev J Kirchartz / JKirchartz

04/27/2015 at 06:34PM

18
#21 - Pratik / prathik_t

04/28/2015 at 12:34PM

18
#22 - skrobul / skrobul

04/28/2015 at 12:42PM

18
#23 - Jason Walton / jay_ay_y

04/28/2015 at 07:27PM

18
#24 - Olivier Debon / OlivierSwift

04/30/2015 at 09:58AM

18
#25 - wlads / wlads

04/30/2015 at 02:45PM

18
#26 - B Wilson / ncatwill

04/30/2015 at 11:16PM

18
#27 - Corentin Lapeyre / c_lapeyre

05/01/2015 at 05:15PM

18
#28 - Rui Mendes / rcm_dium

05/01/2015 at 05:50PM

18
#29 - Charles Joachim / cacplate

05/02/2015 at 12:41AM

18
#30 - Fan Zhang / 2bDeactivat3d

05/02/2015 at 12:41AM

18
#31 - Pierpaolo Frasa / Tainnor

05/03/2015 at 04:03AM

18
#32 - Oleg Alfalfa / 6alfalfa9

05/03/2015 at 09:30AM

18
#33 - Mickael Le Gal / mickaellegal

05/03/2015 at 06:36PM

18
#34 - i5513 / i5513

05/03/2015 at 08:49PM

18
#35 - diziet.sma / diziet__sma

05/04/2015 at 11:23PM

18
#36 - Wade / vvandy

05/06/2015 at 08:25PM

18
#37 - たんたる / tantal_mech

05/07/2015 at 02:21AM

18
#38 - vim_ninja / vim_ninja

05/08/2015 at 02:40AM

18
#39 - Felix / DoubleFelix_

05/10/2015 at 02:41AM

18
#40 - DrHobo / _DrHobo_

05/10/2015 at 10:14PM

18
#41 - Christopher Rhodes / crr0004

05/12/2015 at 01:53PM

18
#42 - Spy / thatspysaspy

05/12/2015 at 10:26PM

18
#43 - danweaver / danweaver

05/13/2015 at 05:39PM

18
#44 - Douglas Pollock / desudation

05/15/2015 at 10:43PM

18
#45 - Peter Burt / peterburt

05/17/2015 at 09:56PM

18
#46 - Clark DuVall / theclarkatron

05/20/2015 at 05:03PM

18
#47 - David Stensland / DavidStensland

05/20/2015 at 05:48PM

18
#48 - mat / matgeist

05/21/2015 at 05:00PM

18
#49 - Stephen Drodge / sjdrodge

05/21/2015 at 06:55PM

18
#50 - Marcelo Montu / _mMontu_

05/26/2015 at 11:25AM

18
#51 - Adetque / Adetque

05/29/2015 at 09:13AM

18
#52 - Sir Chauffeur / sebdul

06/02/2015 at 04:47PM

18
#53 - Max Br / maxbr91

06/04/2015 at 11:21AM

18
#54 - Lifepillar / lifepillar

06/15/2015 at 08:43PM

18
#55 - Dan Piponi / sigfpe

07/21/2015 at 07:48PM

18
#56 - Ferdev vimgolf / fergvimgolf

08/11/2015 at 09:59PM

18
#57 - Liam Thurston / lthurston188

08/17/2015 at 04:31AM

18
#58 - Blake Tereau / BlakeTereau

08/22/2015 at 10:44PM

18
#59 - Jörg Meyer / JoergMy

08/24/2015 at 06:36PM

18
#60 - T A / SirAviles

08/31/2015 at 10:50AM

18
#61 - Ralf Gueldemeister / rgueldem

09/24/2015 at 11:50PM

18
#62 - Mikael Saltzman / MikaelSaltzman

09/27/2015 at 11:20AM

18
#63 - Mike Adams / davis_cromwell

10/02/2015 at 04:52PM

18
#64 - Jon Krause / jkrause314

10/17/2015 at 02:34AM

18
#65 - Árpád Krejczinger / krarpi

11/11/2015 at 02:15PM

18
#66 - Aleksey Zhidkov / AlexeyZhidkov

02/24/2016 at 11:23AM

18
#67 - T. Sakuma / taku39

05/05/2016 at 02:48PM

18
#68 - Jordan Wightman / tuo2

08/13/2016 at 12:37PM

18
#69 - Daniel / Daniel00288663

03/31/2017 at 07:17AM

18
#70 - Daniel Capo Sobral / dcsobral

05/26/2017 at 11:18PM

18
#71 - Ben Hill / KaizenSoze70

09/26/2017 at 01:18PM

18
#72 - Turkey Man / lvturkeyman

11/25/2017 at 04:42AM

19
#73 - Assaf Lavie / AssafLavie

04/25/2015 at 04:00PM

19
#74 - vgmct / vgmct

04/25/2015 at 05:18PM

19
#75 - Michael Cramer / mlcramer

04/25/2015 at 07:14PM

19
#76 - Jerome Korlowski / nolifish

04/25/2015 at 07:29PM

19
#77 - E Both / enboth

04/25/2015 at 08:38PM

19
#78 - chvzvhn / chvzvhn

04/25/2015 at 10:20PM

19
#79 - Gammelin Guillaume / ggammelin

04/26/2015 at 08:23AM

19
#80 - Chase Vasic / ChaseVasic

04/26/2015 at 10:07AM

19
#81 - ushumpei / ushumpei_

04/26/2015 at 01:16PM

19
#82 - Kevin Yokley / kyokley19

04/26/2015 at 11:54PM

19
#83 - mnx / mnxx

04/27/2015 at 09:41AM

19
#84 - kungfuchad / kungfuchad

04/27/2015 at 11:07AM

19
#85 - Matthieu Crapet / mcr05

04/27/2015 at 02:21PM

19
#86 - ipson_nek / ipson_nek

04/27/2015 at 04:23PM

19
#87 - Aludirk Wong / Aludirk

04/28/2015 at 02:56PM

19
#88 - Hendrik Lammers / hendriklammers

04/28/2015 at 08:37PM

19
#89 - AC / quadface

04/29/2015 at 10:42PM

19
#90 - Jonny / Jonnytron

05/01/2015 at 05:42PM

19
#91 - Zach Morgan / zpmorgan

05/01/2015 at 10:16PM

19
#92 - ZC-死理性派 / zecyzhang

05/02/2015 at 01:14PM

19
#93 - Alan Rafael / alanrrb

05/03/2015 at 04:18AM

19
#94 - Marcin Sza / coot_

05/04/2015 at 11:07AM

19
#95 - Slurpie Chapdash / SlurpieChapdash

05/06/2015 at 07:32PM

19
#96 - Tom van der Lee / TomVdLee

05/08/2015 at 06:47AM

19
#97 - Marcio Junior / marciojunior_me

05/10/2015 at 06:47PM

19
#98 - Strabs / artistavenue

05/11/2015 at 02:39PM

19
#99 - Elizabeth / sprinkles418

05/11/2015 at 05:40PM

19
#100 - Rickard Fransson / xxRion

05/11/2015 at 09:30PM

19
#101 - Vivek Sunder / sviveksunder

05/13/2015 at 02:06PM

19
#102 - Ammar Najjar / ammarnajjar

05/25/2015 at 06:21PM

19
#103 - Hao Deng / haodeng

06/12/2015 at 04:28AM

19
#104 - Grisha Pushkov / readoonly

06/16/2015 at 10:28AM

19
#105 - Mutter Mumble / muttermumble

06/18/2015 at 07:43PM

19
#106 - raghu erapaneedi / raghue9

06/19/2015 at 01:44PM

19
#107 - Jack Z / itszhou

06/28/2015 at 04:07PM

19
#108 - Teemu Okkonen / TeemuOkkonen

07/08/2015 at 09:17PM

19
#109 - Endre Galaczi / galacziendre

08/07/2015 at 01:17PM

19
#110 - Walker Boh / walker_boh

10/05/2015 at 02:15PM

19
#111 - Domingue Justin / _jdomingue

10/16/2015 at 03:01PM

19
#112 - Bogumił Kamiński / BogumilKaminski

10/26/2015 at 09:03PM

19
#113 - David Mauskop / mauskop

11/15/2015 at 04:40PM

19
#114 - Cristian Lupașcu / clupasq

02/22/2016 at 03:46PM

19
#115 - Dimitar Dimitrov / kurkale6ka

03/16/2016 at 11:46AM

19
#116 - Will / obiwan__k3n00bi

10/15/2016 at 06:22PM

19
#117 - Michał Dytko / DytkoM

12/28/2016 at 10:29AM

19
#118 - Gurukandhamoorthi / Gurukandhamoor1

07/15/2017 at 04:31PM

20
#119 - Daniel Byron / dansolo17

04/27/2015 at 11:01AM

20
#120 - Kevin Ilphrin Pellet / Kilphrin

05/03/2015 at 09:14AM

20
#121 - Mauro Persano / fzort

05/23/2015 at 04:30PM

20
#122 - Andrew Reece / azmreece

09/11/2015 at 01:48PM

21
#123 - Brian Olpin / bolpin

04/28/2015 at 09:26PM

21
#124 - shugen / shugeno

05/04/2015 at 07:59PM

21
#125 - luffy / raxcoi

05/12/2015 at 03:27PM

21
#126 - Ásgeir Bjarnason / abjarnasn

07/25/2015 at 03:47PM

22
#127 - [Esc],[Z],[Z] / dvvrt

07/31/2015 at 06:27AM

24
#128 - Yann Moisan / YannMoisan

04/25/2015 at 01:47PM

24
#129 - Steven Craft / stevenjohncraft

05/26/2015 at 11:18AM

27
#130 - Michael Cordell / mike_cordell

04/25/2015 at 07:44PM

28
#131 - Ivan Kasatenko / sky31338

05/09/2015 at 04:26PM

53
#132 - Personal Life Trackr / PersLifeTrackr

05/24/2015 at 09:25PM