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):
21
#151 - sol / @dichotomizer

12/19/2011 at 02:25AM

21
#152 - Nicolas Terray / @nterray

12/27/2011 at 09:34PM

21
#153 - David / @ebonhand09

06/11/2012 at 01:54PM

21
#154 - Tom Sisk / @TomSisk

07/05/2012 at 07:40PM

21
#155 - Darcy Parker / @DarcyParker

10/15/2012 at 11:24PM

21
#156 - Domon / @Domon

02/22/2013 at 07:26AM

21
#157 - Kuldeep Bora / @kuldeep_bora

04/17/2013 at 12:06PM

21
#158 - US Dollar Price / @USDollarPrice

11/04/2013 at 05:26AM

21
#159 - Aleksander Gajewski / @adgajewski

04/20/2014 at 03:55PM

21
#160 - eBrnd / @eBrnd

11/02/2014 at 07:47PM

21
#161 - Matt / @mcr05

01/14/2015 at 08:29PM

21
#162 - TweetDreams / @TweetMusicians

10/11/2016 at 03:40AM

22
#163 - Danny Dulai / @dannydulai

12/31/2010 at 07:26AM

22
#164 - fukamikaze / @fukamikaze

01/01/2011 at 04:22AM

22
#165 - Vincent Isambart / @vincentisambart

01/01/2011 at 07:35AM

22
#166 - h_east (トロッコ6個) / @h_east

01/01/2011 at 03:52PM

22
#167 - Jordi Romero / @jordiromero

01/01/2011 at 06:34PM

22
#168 - wyl rof / @wylrof

01/02/2011 at 02:28PM

22
#169 - Tom Burger / @thomasburger

01/04/2011 at 03:31PM

22
#170 - Mark Smith-Guerrero / @msmithgu

01/04/2011 at 06:17PM

22
#171 - Tim Dean / @Tmdean

01/04/2011 at 09:06PM

22
#172 - derp derp / @derp__

01/05/2011 at 07:07AM

22
#173 - Wei Dai / @clvv42

01/07/2011 at 03:52AM

22
#174 - Tim Chase / @gumnos

01/08/2011 at 12:42PM

22
#175 - Balkoth / @_Balkoth_

01/08/2011 at 04:46PM

22
#176 - Saša / @jendvatri

01/09/2011 at 03:13AM

22
#177 - Rörd Hinrichsen / @roerdhh

01/09/2011 at 10:29PM

22
#178 - Luke Sheridan / @lukesheridan

01/10/2011 at 05:11AM

22
#179 - alex scott / @4l3xsc0tt

01/10/2011 at 05:47PM

22
#180 - Pete Johns / @johnsyweb

01/14/2011 at 10:50PM