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):
28
#481 - Petrik de Heus / @four54

08/24/2011 at 05:41PM

28
#482 - Scott Mathson / @smathson

02/04/2012 at 01:40AM

28
#483 - Jyun-Fan Tsai / @fakecolor

02/04/2012 at 08:28AM

28
#484 - Daniel Cohen / @danielissimo

02/07/2012 at 06:12PM

28
#485 - Daniel Rucci / @drucci

02/07/2012 at 07:20PM

28
#486 - Tim Uruski / @timuruski

02/08/2012 at 05:52AM

28
#487 - Glen / @Glen_S

08/11/2012 at 12:41AM

28
#488 - Michi Loro / @michiloro

07/22/2014 at 10:45AM

28
#489 - Evan Coleman / @edc1591

04/22/2015 at 02:54PM

28
#490 - we’re going to need a bigger bot / @assaflavie

05/10/2015 at 05:51PM

28
#491 - Hendrik Lammers / @hendriklammers

05/19/2015 at 06:37PM

28
#492 - Kyouma / @kyoumaJohn

10/14/2016 at 06:02PM

28
#493 - timerella® / @timerella

11/17/2016 at 12:55AM

28
#494 - Matthew Mackay / @matthewmackay26

08/01/2018 at 04:54PM

28
#495 - Ivo Blöchliger / @aigledesalpes

08/06/2019 at 08:54AM

28
#496 - ram / @rambory

01/25/2020 at 10:12PM

28
#497 - migoo / @migoo00668679

11/06/2021 at 01:34PM

28
#498 - Mircea Eftimescu / @meftimes

11/07/2021 at 08:42PM

28
#499 - shahanavaz m / @shahanavazm

04/02/2022 at 10:52PM

28
#500 - coffee-addict / @ccoffee_addictt

11/29/2022 at 10:35PM

28
#501 - Jayanth Koushik / @jayanthkoushik

07/10/2024 at 12:24AM

28
#502 - Joshua Hamlet / @joshuahamlet

07/10/2024 at 08:17AM

28
#503 - Kern Handa / @kernhanda

08/21/2024 at 07:40AM

29
#504 - Grigoriy Glushko / @grinderrz

01/07/2011 at 03:08PM

29
#505 - ☣Rob Mason☠ / @necr0mancer

01/18/2011 at 12:39PM

29
#506 - Anders Janmyr / @andersjanmyr

01/24/2011 at 04:13PM

29
#507 - drooooooooooo / @droooooooooooo

08/07/2011 at 06:36AM

29
#508 - Michael Morgan / @1n1n1s3

11/28/2011 at 08:49PM

29
#509 - John / @OneOhOneOhOneOh

02/05/2012 at 02:08AM

29
#510 - Robin Deits / @r_deits

03/09/2012 at 11:29PM