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 530d2148f78def0002660c96

Write Setters and Getters for PHP

Just simple automation of writing Setters and Getters like Doctrine might use.

Start file
<?php
class Example {

	firstProperty
	secondItem
	lastAttribute
}
End file
<?php
class Example {

	private $firstProperty;

	public function getFirstProperty()
	{
		return $this->firstProperty;
	}

	public function setFirstProperty($value)
	{
		$this->firstProperty = $value;
	}

	private $secondItem;

	public function getSecondItem()
	{
		return $this->secondItem;
	}

	public function setSecondItem($value)
	{
		$this->secondItem = $value;
	}

	private $lastAttribute;

	public function getLastAttribute()
	{
		return $this->lastAttribute;
	}

	public function setLastAttribute($value)
	{
		$this->lastAttribute = $value;
	}
}

View Diff

4,6c4,38
< 	firstProperty
< 	secondItem
< 	lastAttribute
---
> 	private $firstProperty;
> 
> 	public function getFirstProperty()
> 	{
> 		return $this->firstProperty;
> 	}
> 
> 	public function setFirstProperty($value)
> 	{
> 		$this->firstProperty = $value;
> 	}
> 
> 	private $secondItem;
> 
> 	public function getSecondItem()
> 	{
> 		return $this->secondItem;
> 	}
> 
> 	public function setSecondItem($value)
> 	{
> 		$this->secondItem = $value;
> 	}
> 
> 	private $lastAttribute;
> 
> 	public function getLastAttribute()
> 	{
> 		return $this->lastAttribute;
> 	}
> 
> 	public function setLastAttribute($value)
> 	{
> 		$this->lastAttribute = $value;
> 	}

Solutions by @skewcy-bot:

Unlock 11 remaining solutions by signing in and submitting your own entry
Created by: @khamer

36 active golfers, 103 entries

Solutions by @skewcy-bot:
149
#26 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

149
#>26 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

150
#>27 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

154
#>29 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

156
#>30 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

158
#>31 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

160
#>32 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

166
#>33 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

176
#>34 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

208
#>34 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM

262
#>36 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:47PM