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 138 remaining solutions by signing in and submitting your own entry
#139 Priyanshu Katuwal / @priyanshulxiv - Score: 114 - 12/05/25 @ 03:26
dd:%s/\(\w\+\)\[\(.*\)]\[\(.*\)]\[\(.*\)]-\(\w\+\)\[\(.*\)]\[\(.*\)\<BS>]\[\(.*\)]/\1(\2, \3, \4)-\5(\6, \7, \8)<CR>:wq<CR>

0 comments


Created by: @mirroris

139 active golfers, 611 entries

Leaderboard (lowest score wins):
54
#121 - Andrew Sauber / @asauber

09/10/2025 at 10:58AM

59
#122 - Emilia Jacob / @EmiliaJacob

08/22/2025 at 07:11PM

59
#123 - Batres / @Batres3

11/25/2025 at 06:11PM

61
#124 - Manuel Boldrer / @manuelboldrer

12/06/2025 at 11:27PM

63
#125 - hartun9 / @hartun9

10/03/2025 at 05:26AM

63
#126 - NT-physics / @NT-physics

11/28/2025 at 01:53AM

64
#127 - Suraj Kumar / @kumarsuraj512

08/15/2025 at 08:43AM

65
#128 - John Flynn / @xflynx25

11/16/2025 at 12:42PM

66
#129 - Julius von Froreich / @fvj

09/13/2025 at 12:06AM

68
#130 - Kevin Svetlitski / @Svetlitski

07/25/2025 at 12:39AM

71
#131 - Henry Pham / @henryphz

09/10/2025 at 06:26PM

74
#132 - Pedram Khojaste Rad / @p3dr4m0098

11/24/2025 at 09:22PM

75
#133 - Blake Raymond / @bit-ray

09/01/2025 at 01:56AM

77
#134 - ChessMartin / @ChessMartin

11/17/2025 at 10:01PM

78
#135 - James Appleton / @jmsapt

08/16/2025 at 12:56AM

80
#136 - Artem Tarasevich / @CheckSelfy

10/22/2025 at 04:55PM

82
#137 - Jesse / @Solopie

08/05/2025 at 04:31AM

104
#138 - EdgarQuinonez / @EdgarQuinonez

08/15/2025 at 04:25AM

114
#139 - Priyanshu Katuwal / @priyanshulxiv

12/05/2025 at 03:26AM