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):
19
#211 - ineb / @ineb0

08/18/2012 at 10:07AM

19
#212 - a24f0600 / @a24f0600

12/13/2012 at 06:52PM

19
#213 - Sebastian Heil / @sebokopter

03/16/2013 at 04:31AM

19
#214 - no name / @vimgol

01/27/2015 at 06:36PM

19
#215 - Kevin Keefe / @KevinKeefe5

05/27/2020 at 05:13PM

19
#216 - 5S-LIVIUSZ-SZALMA / @5S-LIVIUSZ-SZALMA

01/12/2024 at 03:42PM

19
#217 - Ryo3110 / @r-3110

03/22/2025 at 01:25AM

20
#218 - fred6 / @_fred6

12/19/2011 at 03:08AM

20
#219 - murky-satyr / @m_satyr

12/29/2011 at 04:30PM

20
#220 - tmr / @tmr314

09/07/2012 at 09:07AM

20
#221 - Marcin Szamotulski / @me_coot

10/10/2013 at 09:50PM

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

07/03/2018 at 05:27AM

20
#223 - AMG / @anmigneer

12/14/2021 at 08:30AM

20
#224 - july9793 / @july9793_

01/06/2022 at 01:19PM

20
#225 - Qishuai Liu / @LiuQishuai

01/06/2023 at 02:52PM

20
#226 - Mihael Protsko / @eastaveracruz

02/18/2024 at 09:29AM

20
#227 - e.cousinet / @ecousinet

02/14/2025 at 05:08PM

21
#228 - Emeric Dupont / @stucule

08/23/2011 at 06:47AM

21
#229 - quintin / @quintinjeannoel

08/29/2011 at 08:52AM

21
#230 - sol / @dichotomizer

12/19/2011 at 02:25AM

21
#231 - Nicolas Terray / @nterray

12/27/2011 at 09:34PM

21
#232 - David / @ebonhand09

06/11/2012 at 01:54PM

21
#233 - Tom Sisk / @TomSisk

07/05/2012 at 07:40PM

21
#234 - Darcy Parker / @DarcyParker

10/15/2012 at 11:24PM

21
#235 - Domon / @Domon

02/22/2013 at 07:26AM

21
#236 - Kuldeep Bora / @kuldeep_bora

04/17/2013 at 12:06PM

21
#237 - US Dollar Price / @USDollarPrice

11/04/2013 at 05:26AM

21
#238 - Aleksander Gajewski / @adgajewski

04/20/2014 at 03:55PM

21
#239 - eBrnd / @eBrnd

11/02/2014 at 07:47PM

21
#240 - Matt / @mcr05

01/14/2015 at 08:29PM