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 109 remaining solutions by signing in and submitting your own entry
#110 Jack Z / itszhou - Score: 19 - 06/28/15 @ 16:07
:s/[-+*/=]/ & /g<CR>ZZ

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


#122 Joe Heywood / joehabsjoe - Score: 19 - 01/30/18 @ 22:28
:s/[-+*/=]/ & /g<CR>ZZ

0 comments


#123 DHM / DHM29978992 - Score: 19 - 04/30/18 @ 17:24
:s/[-=+*/]/ & /g<CR>ZZ

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

0 comments


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

137 active golfers, 278 entries

Leaderboard (lowest score wins):
19
#91 - Hendrik Lammers / hendriklammers

04/28/2015 at 08:37PM

19
#92 - AC / quadface

04/29/2015 at 10:42PM

19
#93 - Jonny / Jonnytron

05/01/2015 at 05:42PM

19
#94 - Zach Morgan / zpmorgan

05/01/2015 at 10:16PM

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

05/02/2015 at 01:14PM

19
#96 - Alan Rafael / alanrrb

05/03/2015 at 04:18AM

19
#97 - Marcin Sza / coot_

05/04/2015 at 11:07AM

19
#98 - Slurpie Chapdash / SlurpieChapdash

05/06/2015 at 07:32PM

19
#99 - Tom van der Lee / TomVdLee

05/08/2015 at 06:47AM

19
#100 - Marcio Junior / marciojunior_me

05/10/2015 at 06:47PM

19
#101 - Strabs / artistavenue

05/11/2015 at 02:39PM

19
#102 - Elizabeth / sprinkles418

05/11/2015 at 05:40PM

19
#103 - Rickard Fransson / xxRion

05/11/2015 at 09:30PM

19
#104 - Vivek Sunder / sviveksunder

05/13/2015 at 02:06PM

19
#105 - Ammar Najjar / ammarnajjar

05/25/2015 at 06:21PM

19
#106 - Hao Deng / haodeng

06/12/2015 at 04:28AM

19
#107 - Grisha Pushkov / readoonly

06/16/2015 at 10:28AM

19
#108 - Mutter Mumble / muttermumble

06/18/2015 at 07:43PM

19
#109 - raghu erapaneedi / raghue9

06/19/2015 at 01:44PM

19
#110 - Jack Z / itszhou

06/28/2015 at 04:07PM

19
#111 - Teemu Okkonen / TeemuOkkonen

07/08/2015 at 09:17PM

19
#112 - Endre Galaczi / galacziendre

08/07/2015 at 01:17PM

19
#113 - Walker Boh / walker_boh

10/05/2015 at 02:15PM

19
#114 - Domingue Justin / _jdomingue

10/16/2015 at 03:01PM

19
#115 - Bogumił Kamiński / BogumilKaminski

10/26/2015 at 09:03PM

19
#116 - David Mauskop / mauskop

11/15/2015 at 04:40PM

19
#117 - Cristian Lupașcu / clupasq

02/22/2016 at 03:46PM

19
#118 - Dimitar Dimitrov / kurkale6ka

03/16/2016 at 11:46AM

19
#119 - Will / obiwan__k3n00bi

10/15/2016 at 06:22PM

19
#120 - Michał Dytko / DytkoM

12/28/2016 at 10:29AM