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):
27
#61 - Roberto Martínez / @nilp0inter

08/20/2018 at 09:17PM

28
#62 - Vanildo S. Mangueira / @vanildo_souto

08/13/2018 at 01:51PM

29
#63 - Sxcy / @SxcyX

10/22/2018 at 01:52PM

29
#64 - Phoon / @justflashhim

05/10/2019 at 09:54PM

32
#65 - Shunichi Kanade / @shunkana

11/23/2018 at 09:13AM

35
#66 - PJ Frazer / @pj_frazer

12/02/2018 at 02:32AM

36
#67 - Adam / @askoufish

11/25/2018 at 11:25PM

37
#68 - Miki Tebeka / @tebeka

08/12/2018 at 05:13AM

39
#69 - saurabh tripathi / @saurabh908583

08/10/2018 at 11:39PM

39
#70 - Vanda Hendrychov√° / @vandiacutek

08/23/2018 at 07:45PM

39
#71 - Pumpkin Parapet / @PumpkinParapet

10/06/2018 at 01:39AM

45
#72 - Bennett / @bennettbackward

12/19/2018 at 12:30PM

46
#73 - Chirag Joshi / @thechijos

08/14/2018 at 05:18AM

54
#74 - urandom / @ttyrandom

10/20/2018 at 06:14PM

55
#75 - testingvimgolf / @testingvimgolf

08/12/2018 at 03:23AM

63
#76 - Jurica / @Jurica34581259

11/16/2018 at 11:19AM