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):
22
#211 - David Pflug / @dpflug

05/17/2012 at 09:48PM

22
#212 - vansan / @VinceVansan

08/27/2012 at 08:53PM

22
#213 - deigen / @deigen0

08/28/2012 at 10:59PM

22
#214 - Lee Folkman / @leefolkman

09/24/2012 at 05:44PM

22
#215 - robin hafen / @rohafen

09/28/2012 at 03:29PM

22
#216 - z0k / @z0k

12/20/2012 at 12:16AM

22
#217 - Xinruo Sun / @xiaoruoruo

12/23/2012 at 10:47AM

22
#218 - Tom Duijf / @tomduijf

01/29/2013 at 10:29PM

22
#219 - igoodrich / @igoodrich

03/03/2013 at 07:03AM

22
#220 - Gonzalo Arreche / @grilix

03/05/2013 at 01:54AM

22
#221 - gnobbles / @gnobbles

03/30/2013 at 09:31PM

22
#222 - Tyler / @tylerbindon

03/31/2013 at 03:31AM

22
#223 - Hawk Newton / @hawknewton

07/24/2013 at 08:10PM

22
#224 - Andrew Crites / @ExplosionPills

09/12/2013 at 01:30PM

22
#225 - brett / @brettyukich

09/19/2013 at 12:02PM

22
#226 - Casey Dwyer / @caseydwyer

10/24/2013 at 05:12PM

22
#227 - gary.klindt@googlema / @garstekli

11/14/2013 at 09:34PM

22
#228 - Quota / @Quotad

01/15/2014 at 02:22PM

22
#229 - Ali El Amine / @Allouch95

02/02/2014 at 06:35PM

22
#230 - Mina Naguib / @minaguib

02/25/2014 at 04:06AM

22
#231 - Timothy Lin / @lzh9102

03/08/2014 at 03:21AM

22
#232 - ZorgroZ / @ZorgroZ

04/13/2014 at 10:37AM

22
#233 - John Meisner / @jmeisned

06/25/2014 at 08:37PM

22
#234 - kawas / @kawas44

01/01/2015 at 07:46PM

22
#235 - Árpád Krejczinger / @krarpi

11/11/2015 at 03:09PM

22
#236 - Marcel Akkerman / @MarcelAkkerman

12/22/2016 at 08:55AM

22
#237 - Carl Egbert / @CarlOEgbert

06/12/2017 at 07:45PM

22
#238 - Vytautas Jakutis / @jakutis0

04/12/2018 at 12:40PM

22
#239 - slicklash / @slicklash

04/12/2018 at 12:45PM

22
#240 - Rebecca V. / @rxbxccxv

09/16/2018 at 05:50AM