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 802 remaining solutions by signing in and submitting your own entry
#803 Zac sliker / @Zacsliker - Score: 125 - 01/29/20 @ 16:29
<Left>d5w<Down>dwd<Left><Left><Left><Left>d5w<Down>dw<Left>d6wi<Up><Up><50-53>  convert tabs to spaces<CR>    strip all blank lines<CR>  and remove any trailing spaces<Esc>[201~<Down><Down><BS><BS><Esc>:wq!<CR>

0 comments


Created by: @igrigorik

803 active golfers, 3742 entries

Leaderboard (lowest score wins):
29
#511 - metaphract / @metaphract

07/29/2012 at 12:29PM

29
#512 - Eric Andres / @eric_m_andres

12/06/2012 at 05:17AM

29
#513 - Arun / @UArunKumar

12/08/2012 at 04:28AM

29
#514 - くま ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้้้้ 55 / @kumack55

04/03/2013 at 09:09AM

29
#515 - Foo Bar / @FooWatson

12/11/2013 at 09:27PM

29
#516 - Ian Laird / @irlaird

12/13/2013 at 01:23AM

29
#517 - Ram Tamtam / @ramtamtamtam

06/29/2014 at 08:34PM

29
#518 - Yariv / @yarivb

07/27/2014 at 01:56PM

29
#519 - jptomoya / @_jptomoya

10/18/2014 at 07:52AM

29
#520 - Dian Xiao / @dian_xiao

10/12/2015 at 03:13AM

29
#521 - Tj / @yrddy

03/18/2016 at 04:22AM

29
#522 - Gurukandhamoorthi / @Gurukandhamoor1

07/10/2017 at 03:04PM

29
#523 - Not real / @Notreal70353016

09/23/2018 at 03:15AM

29
#524 - Michael / @triorph

11/12/2021 at 07:26AM

29
#525 - POSIX / @po6ix

01/31/2022 at 05:17PM

29
#526 - Oisin Ward / @OisinWard_vg

07/05/2023 at 04:07PM

29
#527 - sprock / @sprocklem

12/06/2023 at 04:56AM

29
#528 - Oleksii Sanin / @AlexSanin

12/07/2024 at 09:53AM

29
#529 - k1mosabe / @k1mosabe

12/08/2024 at 05:42PM

30
#530 - Eric Budd / @clam_tea

12/28/2010 at 09:29PM

30
#531 - Prody / @Prody225

01/10/2011 at 05:23PM

30
#532 - Wesley Wong / @wesleymwwong

01/29/2011 at 08:14AM

30
#533 - TchiKong / @tchikong

01/29/2011 at 12:44PM

30
#534 - Kelan Champagne / @kelan

01/30/2011 at 03:48AM

30
#535 - marssong / @marssong

10/10/2011 at 04:01PM

30
#536 - Arlekin de Palermo / @arlekinpalermo

10/16/2011 at 01:04AM

30
#537 - peter shih / @peter50216

01/06/2012 at 08:30AM

30
#538 - Vishal / @vishl

06/22/2012 at 08:21PM

30
#539 - Nicolas Friedli / @NicolasFriedli

10/28/2012 at 08:51AM

30
#540 - Alec Chen / @alec929

11/03/2012 at 02:17PM