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 9v00686695ea000000000723

From brakets to parens

This is one of the most common problem when you wrap an array for error handling. Vim is useful when you convert foo[i][j][k] into foo(i, j, k) for many times.

Start file
int main() {
	glm::vec3 umax(
		(vx[i+1][j][k]-vx[i][j][k])/2,
		(vy[i][j+1][k]-vy[i-1][j+1][k])/2,
		(vz[i][j][k+1]-vz[i-1][j][k+1])/2
	);
	glm::vec3 umin(
		(m_vx[i][j][k]-m_vx[i-1][j][k])/2,
		(m_vy[i][j][k]-m_vy[i-1][j][k])/2,
		(m_vz[i][j][k]-m_vz[i-1][j][k])/2
	);
}
End file
int main() {
	glm::vec3 umax(
		(vx(i+1, j, k)-vx(i, j, k))/2,
		(vy(i, j+1, k)-vy(i-1, j+1, k))/2,
		(vz(i, j, k+1)-vz(i-1, j, k+1))/2
	);
	glm::vec3 umin(
		(m_vx(i, j, k)-m_vx(i-1, j, k))/2,
		(m_vy(i, j, k)-m_vy(i-1, j, k))/2,
		(m_vz(i, j, k)-m_vz(i-1, j, k))/2
	);
}

View Diff

1d0
< 
4,6c3,5
< 		(vx[i+1][j][k]-vx[i][j][k])/2,
< 		(vy[i][j+1][k]-vy[i-1][j+1][k])/2,
< 		(vz[i][j][k+1]-vz[i-1][j][k+1])/2
---
> 		(vx(i+1, j, k)-vx(i, j, k))/2,
> 		(vy(i, j+1, k)-vy(i-1, j+1, k))/2,
> 		(vz(i, j, k+1)-vz(i-1, j, k+1))/2
9,11c8,10
< 		(m_vx[i][j][k]-m_vx[i-1][j][k])/2,
< 		(m_vy[i][j][k]-m_vy[i-1][j][k])/2,
< 		(m_vz[i][j][k]-m_vz[i-1][j][k])/2
---
> 		(m_vx(i, j, k)-m_vx(i-1, j, k))/2,
> 		(m_vy(i, j, k)-m_vy(i-1, j, k))/2,
> 		(m_vz(i, j, k)-m_vz(i-1, j, k))/2
13c12
< }
\ No newline at end of file
---
> }

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 11 remaining solutions by signing in and submitting your own entry
#12 awelormro / @awelormro - Score: 54 - 07/05/25 @ 18:44
:%s/\]\[/, /g<CR>:%s/\[\(/g<CR>:<Up><Left><Left><Left><BS>/<CR>:<Up><Left><Left><Left><Left><BS>]<Right><Right><BS>)<CR>ggdd:wq<CR>

0 comments


Created by: @mirroris

12 active golfers, 37 entries

Leaderboard (lowest score wins):
25
#1 - Peppa Pig / @PeppaPigSg

07/05/2025 at 08:17AM

25
#2 - ZEraX4 / @ZEraX4

07/05/2025 at 09:51AM

25
#3 - Paul Yates / @PYates77

07/07/2025 at 08:36PM

26
#4 - “Smylers” / @Smylers2

07/04/2025 at 03:02PM

26
#5 - Egor Derevlev / @Neofuturist

07/04/2025 at 03:35PM

27
#6 - Cameron Wolfe / @Camty1

07/04/2025 at 11:41PM

28
#7 - Maximilian Ballard / @ediw8311xht

07/04/2025 at 09:00PM

28
#8 - Mostafa Kashwaa / @MostafaKashwaa

07/10/2025 at 07:14AM

28
#9 - Zach McKenna / @zcmckenna

07/10/2025 at 01:00PM

30
#10 - Ming / @x51ming

07/10/2025 at 11:11AM

42
#11 - Jonathan Cooper / @ReallySnazzy

07/04/2025 at 04:46AM

54
#12 - awelormro / @awelormro

07/05/2025 at 06:44PM