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):
27
#331 - Dezső Zoltán / @zakiazigazi

01/22/2011 at 06:57AM

27
#332 - Avinash Baliga / @avinashbaliga

03/24/2011 at 05:18AM

27
#333 - こばばー / @symmet

05/01/2011 at 02:51PM

27
#334 - mightyfoo / @mightyfoo

05/25/2011 at 12:17PM

27
#335 - Black Wolf / @LoboVimGolf

06/15/2011 at 03:29PM

27
#336 - giggzy / @giggzy

08/17/2011 at 10:52AM

27
#337 - palentine / @palentine

12/12/2011 at 07:36PM

27
#338 - Tesnorth / @Tesnorth

01/31/2012 at 04:58PM

27
#339 - David Xia / @davidxia_

03/24/2012 at 01:16AM

27
#340 - Reed Riley / @ReedRile

08/13/2012 at 07:13PM

27
#341 - Nick Miller / @ItsMeNickMiller

08/17/2012 at 12:15PM

27
#342 - Arne Ehrlich / @typedlambda

09/06/2012 at 06:41AM

27
#343 - Kai Yuan / @kentyuan

02/21/2013 at 01:51PM

27
#344 - Joel Elkins / @dice_tea

03/11/2013 at 03:50PM

27
#345 - HongKilDong / @HongKilDong

03/15/2013 at 11:53AM

27
#346 - Ben / @bdchauvette

05/03/2013 at 08:23AM

27
#347 - Sheng / @shenghis

08/25/2013 at 08:12PM

27
#348 - Oliver Christ / @0liverChrist

09/20/2013 at 03:00PM

27
#349 - Roger Spencer / @RojSpencer

02/02/2014 at 11:59PM

27
#350 - barnabaguy / @barnabaguy

03/02/2014 at 08:41PM

27
#351 - Gerald Tilma / @GeraldTilma

10/18/2015 at 10:26PM

27
#352 - Bogumił Kamiński / @BogumilKaminski

10/26/2015 at 10:37PM

27
#353 - SK Liew / @liewsk

11/06/2015 at 04:39AM

27
#354 - jb M / @Jiboo_hey

04/20/2016 at 07:44PM

27
#355 - Christian / @paierlep

09/03/2019 at 10:38PM

28
#356 - Samus_ Michael / @gonna_hate

12/29/2010 at 02:19AM

28
#357 - Arjen Schat / @arjenschat

12/29/2010 at 06:24PM

28
#358 - jacobangel / @jacobangel

12/31/2010 at 05:38AM

28
#359 - garygordon / @garygordon

01/01/2011 at 07:37PM

28
#360 - Nick / @quinks25

01/10/2011 at 03:37AM