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 5b6e21c9a893790006232531

Swap the operands under comparison

Swap the operands under comparison to prevent null pointer exception (at least in java)

Start file
if(lang.equals("en_US")) {
	System.out.println("The lang is en_US i.e english US"+
}

if(lang.equals("es_US")) {
	System.out.println("The lang is es_US i.e spanish US"+
}

if(lang.equals("fr_US")) {
	System.out.println("The lang is fr_US i.e france US"+
}
End file
if("en_US".equals(lang)) {
	System.out.println("The lang is en_US i.e english US"+
}

if("es_US".equals(lang)) {
	System.out.println("The lang is es_US i.e spanish US"+
}

if("fr_US".equals(lang)) {
	System.out.println("The lang is fr_US i.e france US"+
}

View Diff

1c1
< if(lang.equals("en_US")) {
---
> if("en_US".equals(lang)) {
5c5
< if(lang.equals("es_US")) {
---
> if("es_US".equals(lang)) {
9c9
< if(lang.equals("fr_US")) {
---
> if("fr_US".equals(lang)) {

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 59 remaining solutions by signing in and submitting your own entry
#60 Jurica / @Jurica34581259 - Score: 63 - 11/16/18 @ 11:19
:%s/lang\.equals(\(.*\)")/\1"/<CR>:%s/US")/US".equals(lang))/<CR>:wq<CR>

0 comments


Created by: @saurabh908583

60 active golfers, 164 entries

Leaderboard (lowest score wins):
7
#1 - dyson dark / @U9gJt7mOEOjbRN7

11/17/2018 at 06:45PM

19
#2 - Kerson Hsiao / @KersonHsiao

08/12/2018 at 03:27AM

19
#3 - Pratik / @prathik_t

08/12/2018 at 11:36AM

19
#4 - John Braxler / @braxler

08/13/2018 at 11:55AM

19
#5 - Smylers / @Smylers2

08/13/2018 at 02:00PM

19
#6 - Keldwik Chaldain / @Suskeyhose

08/14/2018 at 08:43PM

19
#7 - fucus / @fishlovebanana

08/19/2018 at 07:27AM

19
#8 - Epecb / @BceEpecb

09/05/2018 at 12:41AM

19
#9 - Jeff / @sir_wiggles3

09/07/2018 at 09:50AM

19
#10 - Rich Cheng / @sedm0784

09/10/2018 at 03:29PM

19
#11 - royer / @RoyerMoyer1

09/15/2018 at 12:03AM

19
#12 - Turkey Man / @lvturkeyman

09/21/2018 at 03:45AM

19
#13 - Rasmus Bergström / @JRasmusBm

09/27/2018 at 08:54AM

19
#14 - Dax / @zacoxi

11/01/2018 at 03:12AM

19
#15 - name / @name65894813

11/16/2018 at 07:59PM

20
#16 - Jon Krause / @jkrause314

08/11/2018 at 12:59AM

20
#17 - Javier Blanco / @jbgutierrez

08/11/2018 at 09:08AM

20
#18 - PCS Solutions / @PeteSolutions

08/11/2018 at 11:11AM

20
#19 - Piotr Walkusz / @piotrwalkusz1

08/11/2018 at 03:36PM

20
#20 - tPenguinLTG / @tpenguinltg

08/12/2018 at 03:52AM

20
#21 - 🌀🦋Miriam Retka🦋🌀 / @miriamretka

08/19/2018 at 08:59PM

20
#22 - Cam Smith / @Comradesmith

08/21/2018 at 10:37AM

20
#23 - Joey / @joeyism101

09/03/2018 at 02:08AM

20
#24 - Roger Bongers / @RogerBongers

10/05/2018 at 07:27PM

20
#25 - Benjamin Kiesl / @BenjaminKiesl

10/15/2018 at 04:08PM

21
#26 - Valacar / @valacar

08/16/2018 at 07:20AM

21
#27 - Артем Мухометзянов / @Timon_Surikat

08/18/2018 at 11:13PM

21
#28 - Daniel Vaqueiro / @chimidea

09/01/2018 at 12:51AM

22
#29 - Weston Neal / @wtneal

09/04/2018 at 10:11PM

22
#30 - prince ducaca / @prince_du_caca

09/27/2018 at 10:58PM