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

76 active golfers, 211 entries

Leaderboard (lowest score wins):
20
#31 - churaki / @churaki

01/30/2019 at 07:55AM

21
#32 - Valacar / @valacar

08/16/2018 at 07:20AM

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

08/18/2018 at 11:13PM

21
#34 - Daniel Vaqueiro / @chimidea

09/01/2018 at 12:51AM

21
#35 - Daniel Steinberg / @dstein64

02/14/2019 at 06:07AM

22
#36 - Weston Neal / @wtneal

09/04/2018 at 10:11PM

22
#37 - prince ducaca / @prince_du_caca

09/27/2018 at 10:58PM

23
#38 - 村橋究理基M.Kuriki@北大 / @mkuriki_

08/11/2018 at 12:24PM

23
#39 - 徐学健 / @zebrallel

08/15/2018 at 10:21AM

23
#40 - daniel / @daniel31464605

08/22/2018 at 06:04AM

23
#41 - Fabio Branquinho / @branquif

11/08/2018 at 09:24PM

23
#42 - Mateen Ulhaq / @sicariusnoctis

02/12/2019 at 05:37AM

24
#43 - Kritixi Lithos / @kritixilithos

08/11/2018 at 11:54AM

24
#44 - h43z / @h43z

08/11/2018 at 11:16PM

24
#45 - Marco Magdy / @marcomacdee

08/13/2018 at 07:57PM

24
#46 - 安藤 / @andou2106

09/03/2018 at 03:47PM

24
#47 - a / @a05150445

09/06/2018 at 04:13AM

24
#48 - pankaj singh / @pankajsingh013

01/17/2019 at 04:40PM

25
#49 - SumOfAllN00bs / @SumOfAllN00bs

08/22/2018 at 04:40AM

25
#50 - Oren Koriat / @KoriatOren

12/23/2018 at 10:46AM

26
#51 - yqu212 / @yqu212

08/11/2018 at 02:23AM

26
#52 - Kristijan Husak / @kristijan_husak

08/11/2018 at 05:43PM

26
#53 - Dr. Rev. J. "Paranoid Android" Kirchartz / @JKirchartz

08/19/2018 at 05:11AM

26
#54 - Juliette but spooky / @namebrandloser

10/26/2018 at 11:32PM

26
#55 - Bruce Adams / @bruceadams1054

11/08/2018 at 08:18AM

26
#56 - Luis Rodriguez / @luisthecoder

11/14/2018 at 02:36AM

26
#57 - Chris Lesage / @chrislesage

06/07/2019 at 04:42AM

27
#58 - Christian Fosli / @porridge111

08/12/2018 at 07:17PM

27
#59 - Alexander Zheleznov / @ephemerr

08/17/2018 at 09:16AM

27
#60 - Sergio / @voyeg3r

08/19/2018 at 04:15PM