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):
19
#121 - Justin Love / @wondible

06/05/2011 at 07:47PM

19
#122 - dtennant / @dtennant

06/06/2011 at 07:57PM

19
#123 - Rolf Bjaanes / @rolfb

06/15/2011 at 10:08PM

19
#124 - not so punk :] / @notsopunk

06/19/2011 at 08:05AM

19
#125 - Hu Junfeng / @junfeng

07/14/2011 at 08:53AM

19
#126 - Sammasati / @sammasati0

07/15/2011 at 03:49PM

19
#127 - Glenn / @glennular

07/17/2011 at 11:16PM

19
#128 - Ed Gibbs / @edward_gibbs

08/02/2011 at 04:13AM

19
#129 - Neil / @spameldoon

08/21/2011 at 03:14PM

19
#130 - Daniel Stoza / @dstoza

08/26/2011 at 12:40AM

19
#131 - Tim Tsu / @vimgolfpunk

08/29/2011 at 12:34PM

19
#132 - Ben Sherman / @bensherman

09/27/2011 at 06:02AM

19
#133 - p0ckets / @p0ckets

10/07/2011 at 12:35AM

19
#134 - André Kvist Aronsen / @andrearonsen

10/24/2011 at 12:41PM

19
#135 - Al / @96258

12/12/2011 at 02:41PM

19
#136 - Peter Anselmo / @peter_anselmo

03/08/2012 at 08:11PM

19
#137 - Chris Penkett / @chrispenkett

04/03/2012 at 07:13PM

19
#138 - learninghang / @learninghang

04/14/2012 at 02:49PM

19
#139 - skarrok / @skarrok

06/17/2012 at 10:37AM

19
#140 - ineb / @ineb0

08/18/2012 at 10:07AM

19
#141 - a24f0600 / @a24f0600

12/13/2012 at 06:52PM

19
#142 - Sebastian Heil / @sebokopter

03/16/2013 at 04:31AM

19
#143 - no name / @vimgol

01/27/2015 at 06:36PM

20
#144 - fred6 / @_fred6

12/19/2011 at 03:08AM

20
#145 - murky-satyr / @m_satyr

12/29/2011 at 04:30PM

20
#146 - tmr / @tmr314

09/07/2012 at 09:07AM

20
#147 - Marcin Sza / @coot_

10/10/2013 at 09:50PM

20
#148 - 赤佐田奈葉 / @akasatanaha_

07/03/2018 at 05:27AM

21
#149 - Emeric Dupont / @stucule

08/23/2011 at 06:47AM

21
#150 - quintin / @quintinjeannoel

08/29/2011 at 08:52AM