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 58753af0f5ef5c0006000006

Change attribute to getter

Wrap attributes with a getter method.

Start file
function() {
  var a = thing.index < other.attribute;
  var b = thing.index < other.attribute;
  var c = thing.attribute < other.index;
  var d = thing.attribute < other.index;
}
End file
function() {
  var a = thing.get('index') < other.get('attribute');
  var b = thing.get('index') < other.get('attribute');
  var c = thing.get('attribute') < other.get('index');
  var d = thing.get('attribute') < other.get('index');
}

View Diff

2,5c2,5
<   var a = thing.index < other.attribute;
<   var b = thing.index < other.attribute;
<   var c = thing.attribute < other.index;
<   var d = thing.attribute < other.index;
---
>   var a = thing.get('index') < other.get('attribute');
>   var b = thing.get('index') < other.get('attribute');
>   var c = thing.get('attribute') < other.get('index');
>   var d = thing.get('attribute') < other.get('index');

Solutions by @GavinKoeng:

Unlock 9 remaining solutions by signing in and submitting your own entry
Created by: @wyne

65 active golfers, 172 entries

Solutions by @GavinKoeng:
24
#38 - Gavin / @GavinKoeng

03/17/2026 at 03:08PM

25
#>50 - Gavin / @GavinKoeng

03/17/2026 at 03:08PM

26
#>52 - Gavin / @GavinKoeng

03/17/2026 at 03:07PM

27
#>53 - Gavin / @GavinKoeng

03/17/2026 at 03:06PM

29
#>56 - Gavin / @GavinKoeng

03/17/2026 at 03:06PM

30
#>56 - Gavin / @GavinKoeng

03/17/2026 at 03:05PM

33
#>59 - Gavin / @GavinKoeng

03/17/2026 at 03:04PM

34
#>60 - Gavin / @GavinKoeng

03/17/2026 at 03:04PM

35
#>60 - Gavin / @GavinKoeng

03/17/2026 at 03:03PM