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 4d1a4d82a860b7447200008d

Whitespace, empty lines and tabs

Convert tabs to spaces, strip empty lines and trailing whitespace.

Start file
	convert tabs to spaces

		strip all blank lines 

	and remove any trailing spaces   
End file
  convert tabs to spaces
    strip all blank lines
  and remove any trailing spaces

View Diff

1,5c1,3
< 	convert tabs to spaces
< 
< 		strip all blank lines 
< 
< 	and remove any trailing spaces   
---
>   convert tabs to spaces
>     strip all blank lines
>   and remove any trailing spaces

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 574 remaining solutions by signing in and submitting your own entry
#575 Stephen Paul Weber / @singpolyma - Score: 94 - 12/28/10 @ 23:48
:%s/\t/  /g<CR>:s/ *$//<Left><Left><Left><Right><Left><Left><Left><Right><Right><Right><Right><Right><Right>g<CR><Up>dd<Up><Up>dd<Esc>:w<BS><BS><End>x:wq<CR>

0 comments


Created by: @igrigorik

575 active golfers, 2618 entries

Leaderboard (lowest score wins):
33
#481 - David Willming / @wdialvmeo

07/17/2015 at 03:47AM

33
#482 - Mike Adams / @davis_cromwell

10/03/2015 at 01:26AM

33
#483 - Jon McClennon / @mcclennon19

12/21/2016 at 10:08AM

33
#484 - Daniel / @Daniel00288663

03/27/2017 at 11:11AM

33
#485 - Prithviraj Patil / @dummyprithviraj

12/03/2017 at 09:39PM

33
#486 - Geoff / @RealGeoffErwin

12/14/2017 at 09:07PM

33
#487 - sspan / @sspantz

07/06/2018 at 01:24AM

33
#488 - Vim Golfer / @VimGolfer6

09/06/2019 at 11:26AM

33
#489 - γ‚†γ‹πŸ‘πŸ‘πŸ‘ / @yucao24hours

12/10/2019 at 04:41AM

34
#490 - Soliman Sylvain / @sylvain_soliman

12/28/2010 at 10:07PM

34
#491 - Andrei Dragomir / @adragomir

01/01/2011 at 09:45PM

34
#492 - Cartney McLennon / @mepsi_pax

01/05/2011 at 10:01PM

34
#493 - Misha (Mike) Granin / @Granin

01/19/2011 at 04:19PM

34
#494 - Matthieu Honel / @ocus

01/26/2011 at 08:09AM

34
#495 - Beau Dacious / @nocash

03/16/2011 at 04:21PM

34
#496 - Frederik Mogensen / @fmogensen

03/31/2011 at 09:39AM

34
#497 - asdaskdjn / @asdaskdjn

06/09/2011 at 07:58AM

34
#498 - khebbie / @khebbie

06/16/2011 at 07:04PM

34
#499 - Dave Bradford / @dbradf

06/17/2011 at 11:11PM

34
#500 - James Gary / @james_gary

06/22/2011 at 07:36PM

34
#501 - Øystein Walle / @oysteinwalle

07/04/2011 at 08:09AM

34
#502 - Gary Rennie / @TheGazler

08/04/2011 at 07:47PM

34
#503 - Stanley Wang / @stanleynwang

08/25/2011 at 11:54AM

34
#504 - cameron / @cameronaustgen

09/09/2011 at 05:13AM

34
#505 - yoshi / @yoshiiiine

10/22/2011 at 01:25AM

34
#506 - Yu-Hsuan Li / @Walker_tw

12/21/2011 at 06:47AM

34
#507 - Kieran / @kgleeson

02/08/2012 at 10:03PM

34
#508 - snuffling / @snuffling

02/12/2012 at 09:17PM

34
#509 - demon.mhm / @demonmhm

02/18/2012 at 09:33PM

34
#510 - jDeveloper / @jDevEE

04/21/2012 at 11:51PM