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 5fd623f3cf017601b2b63cbc

Making 3 line function a one liner.

Simple challenge for frequent action while programming.

Start file
Pixel *operator[](Position p) {
    return &pixels[p.getc()][p.getr()];
}
End file
Pixel *operator[](Position p) { return &pixels[p.getc()][p.getr()]; }

View Diff

1,3c1
< Pixel *operator[](Position p) {
<     return &pixels[p.getc()][p.getr()];
< }
---
> Pixel *operator[](Position p) { return &pixels[p.getc()][p.getr()]; }

Solutions by @thomasyang18:

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

209 active golfers, 340 entries

Solutions by @thomasyang18:
4
#185 - thomasyang18 / @thomasyang18

05/15/2025 at 10:46PM

5
#>191 - thomasyang18 / @thomasyang18

05/15/2025 at 10:45PM

8
#>201 - thomasyang18 / @thomasyang18

05/15/2025 at 10:43PM

10
#>201 - thomasyang18 / @thomasyang18

05/15/2025 at 10:38PM

14
#>203 - thomasyang18 / @thomasyang18

05/15/2025 at 10:36PM

15
#>205 - thomasyang18 / @thomasyang18

05/15/2025 at 10:35PM

16
#>205 - thomasyang18 / @thomasyang18

05/15/2025 at 10:31PM

18
#>205 - thomasyang18 / @thomasyang18

05/15/2025 at 10:34PM

70
#>208 - thomasyang18 / @thomasyang18

05/15/2025 at 10:32PM