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):
29
#391 - Yariv / @yarivb

07/27/2014 at 01:56PM

29
#392 - Sabiki94@ブルスクの人 / @_jptomoya

10/18/2014 at 07:52AM

29
#393 - Dian Xiao / @dian_xiao

10/12/2015 at 03:13AM

29
#394 - Tj / @yrddy

03/18/2016 at 04:22AM

29
#395 - Gurukandhamoorthi / @Gurukandhamoor1

07/10/2017 at 03:04PM

29
#396 - Not real / @Notreal70353016

09/23/2018 at 03:15AM

30
#397 - Eric Budd / @clam_tea

12/28/2010 at 09:29PM

30
#398 - Prody / @Prody225

01/10/2011 at 05:23PM

30
#399 - Wesley Wong / @wesleymwwong

01/29/2011 at 08:14AM

30
#400 - TchiKong / @tchikong

01/29/2011 at 12:44PM

30
#401 - Kelan Champagne / @kelan

01/30/2011 at 03:48AM

30
#402 - marssong / @marssong

10/10/2011 at 04:01PM

30
#403 - Arlekin de Palermo / @arlekinpalermo

10/16/2011 at 01:04AM

30
#404 - peter shih / @peter50216

01/06/2012 at 08:30AM

30
#405 - Vishal / @vishl

06/22/2012 at 08:21PM

30
#406 - Nicolas Friedli / @NicolasFriedli

10/28/2012 at 08:51AM

30
#407 - Alec Chen / @alec929

11/03/2012 at 02:17PM

30
#408 - Kenneth Waters / @gen_witt

11/13/2012 at 07:36PM

30
#409 - Nicolas Goles / @ngoles

01/05/2013 at 05:42PM

30
#410 - Ryan Scarbery / @ryan_scarbery

01/11/2013 at 08:27PM

30
#411 - Woojung Kim 김우중 / @_kimwz

07/12/2013 at 04:35AM

30
#412 - Stefan Leszkiewicz / @stefanlz

11/17/2013 at 12:18AM

30
#413 - Will / @obiwan__k3n00bi

07/31/2016 at 08:26PM

30
#414 - Jeff / @sir_wiggles3

09/11/2018 at 07:33AM

31
#415 - uuu / @uu59

12/29/2010 at 08:27PM

31
#416 - David Shaw / @shawthings

12/30/2010 at 10:04AM

31
#417 - Solomon White / @rubysolo

02/08/2011 at 04:03PM

31
#418 - Mike Marion / @mikejmarion

03/21/2011 at 08:03AM

31
#419 - Tom N / @tomjnixon

12/09/2011 at 09:23PM

31
#420 - Alykhan Kanji / @alykhank

08/17/2012 at 06:02PM