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 73 remaining solutions by signing in and submitting your own entry
#74 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

74 active golfers, 203 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

19
#16 - T A / @SirAviles

02/13/2019 at 12:14AM

19
#17 - alekfed / @alek_fed

04/15/2019 at 02:20PM

19
#18 - Grant / @grant_7788

05/13/2019 at 08:21AM

20
#19 - Jon Krause / @jkrause314

08/11/2018 at 12:59AM

20
#20 - Javier Blanco / @jbgutierrez

08/11/2018 at 09:08AM

20
#21 - PCS Solutions / @PeteSolutions

08/11/2018 at 11:11AM

20
#22 - Piotr Walkusz / @piotrwalkusz1

08/11/2018 at 03:36PM

20
#23 - tPenguinLTG / @tpenguinltg

08/12/2018 at 03:52AM

20
#24 - Coruja Queridinha / @miriamretka

08/19/2018 at 08:59PM

20
#25 - Cam Smith / @Comradesmith

08/21/2018 at 10:37AM

20
#26 - Joey / @joeyism101

09/03/2018 at 02:08AM

20
#27 - Roger Bongers / @RogerBongers

10/05/2018 at 07:27PM

20
#28 - Benjamin Kiesl / @BenjaminKiesl

10/15/2018 at 04:08PM

20
#29 - Mihai / @mihaicristiant

12/04/2018 at 07:36AM

20
#30 - churaki / @churaki

01/30/2019 at 07:55AM