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

67 active golfers, 175 entries

Leaderboard (lowest score wins):
22
#31 - prince ducaca / @prince_du_caca

09/27/2018 at 10:58PM

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

08/11/2018 at 12:24PM

23
#33 - 徐学健 / @zebrallel

08/15/2018 at 10:21AM

23
#34 - daniel / @daniel31464605

08/22/2018 at 06:04AM

23
#35 - Fabio Branquinho / @branquif

11/08/2018 at 09:24PM

24
#36 - Kritixi Lithos / @kritixilithos

08/11/2018 at 11:54AM

24
#37 - h43z / @h43z

08/11/2018 at 11:16PM

24
#38 - Marco Magdy / @marcomcdee

08/13/2018 at 07:57PM

24
#39 - 安藤 / @andou2106

09/03/2018 at 03:47PM

24
#40 - a / @a05150445

09/06/2018 at 04:13AM

24
#41 - pankaj singh / @pankajsingh013

01/17/2019 at 04:40PM

25
#42 - SumOfAllN00bs / @SumOfAllN00bs

08/22/2018 at 04:40AM

25
#43 - Oren Koriat / @KoriatOren

12/23/2018 at 10:46AM

26
#44 - yqu212 / @yqu212

08/11/2018 at 02:23AM

26
#45 - Kristijan Husak / @kristijan_husak

08/11/2018 at 05:43PM

26
#46 - Dr. Rev. J. Lurch-artz / @JKirchartz

08/19/2018 at 05:11AM

26
#47 - Juliette but spooky / @namebrandloser

10/26/2018 at 11:32PM

26
#48 - Bruce Adams / @bruceadams1054

11/08/2018 at 08:18AM

26
#49 - Luis Rodriguez / @luisthecoder

11/14/2018 at 02:36AM

27
#50 - Christian Fosli / @porridge111

08/12/2018 at 07:17PM

27
#51 - Alexander Zheleznov / @ephemerr

08/17/2018 at 09:16AM

27
#52 - Sergio / @voyeg3r

08/19/2018 at 04:15PM

27
#53 - Roberto Martínez / @nilp0inter

08/20/2018 at 09:17PM

28
#54 - Vanildo S. Mangueira / @vanildo_souto

08/13/2018 at 01:51PM

29
#55 - Sxcy / @SxcyX

10/22/2018 at 01:52PM

32
#56 - Shunichi Kanade / @shunkana

11/23/2018 at 09:13AM

35
#57 - PJ Frazer / @pj_frazer

12/02/2018 at 02:32AM

36
#58 - Adam / @askoufish

11/25/2018 at 11:25PM

37
#59 - Miki Tebeka / @tebeka

08/12/2018 at 05:13AM

39
#60 - saurabh tripathi / @saurabh908583

08/10/2018 at 11:39PM