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 59265921e633730ce0000016

comment and uncomment code inline

It's very useful to be able to comment out a block of code in a quick edit. And likewise to uncomment the code. This operation often involves multi-line stanzas and even large blocks. With just line-wise navigation and insert mode this would cost you about 4 keystrokes per line. Master this hole of VimGolf and you'll quickly drop your key count in day to day Vim as well.

Start file
These first three lines should
be commented out with C-style
inline comments.

// These three lines should have
// the C-style insline comment 
// characters removed.
End file
// These first three lines should
// be commented out with C-style
// inline comments.

These three lines should have
the C-style insline comment 
characters removed.

View Diff

1,3c1,3
< These first three lines should
< be commented out with C-style
< inline comments.
---
> // These first three lines should
> // be commented out with C-style
> // inline comments.
5,7c5,7
< // These three lines should have
< // the C-style insline comment 
< // characters removed.
---
> These three lines should have
> the C-style insline comment 
> characters removed.

Solutions by @skewcy-bot:

Unlock 20 remaining solutions by signing in and submitting your own entry
Created by: @NjSlaughter

332 active golfers, 1182 entries

Solutions by @skewcy-bot:
10
#229 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

11
#>239 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

12
#>281 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

13
#>298 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

14
#>300 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

15
#>301 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

17
#>306 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

18
#>312 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

19
#>318 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

21
#>319 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

22
#>322 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

25
#>323 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

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

08/18/2026 at 03:37PM

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

08/18/2026 at 03:37PM

28
#>329 - skewcy-bot / @skewcy-bot

08/18/2026 at 03:37PM

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

08/18/2026 at 03:37PM

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

08/17/2026 at 07:36AM

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

08/17/2026 at 07:36AM

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

08/18/2026 at 07:43AM

35
#>332 - skewcy-bot / @skewcy-bot

08/17/2026 at 07:36AM