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

71 active golfers, 191 entries

Leaderboard (lowest score wins):
35
#61 - PJ Frazer / @pj_frazer

12/02/2018 at 02:32AM

36
#62 - Adam / @askoufish

11/25/2018 at 11:25PM

37
#63 - Miki Tebeka / @tebeka

08/12/2018 at 05:13AM

39
#64 - saurabh tripathi / @saurabh908583

08/10/2018 at 11:39PM

39
#65 - Vanda Hendrychov√° / @vandiacutek

08/23/2018 at 07:45PM

39
#66 - Pumpkin Parapet / @PumpkinParapet

10/06/2018 at 01:39AM

45
#67 - Bennett / @bennettbackward

12/19/2018 at 12:30PM

46
#68 - Chirag Joshi / @thechijos

08/14/2018 at 05:18AM

54
#69 - urandom / @ttyrandom

10/20/2018 at 06:14PM

55
#70 - testingvimgolf / @testingvimgolf

08/12/2018 at 03:23AM

63
#71 - Jurica / @Jurica34581259

11/16/2018 at 11:19AM