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 815 remaining solutions by signing in and submitting your own entry
#816 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

816 active golfers, 3795 entries

Leaderboard (lowest score wins):
41
#751 - Leonard Chin / @lchin

12/29/2010 at 10:01AM

41
#752 - José / @antigravedadtw

11/07/2011 at 08:02PM

41
#753 - sathish316 / @sathish316

11/18/2012 at 05:16PM

41
#754 - Rckrd / @Rckrd

04/09/2013 at 06:48PM

41
#755 - Jonah Hlastala / @JonahHlastala

01/27/2020 at 08:23PM

41
#756 - Olivia Firth / @OliviaFirth4

01/29/2020 at 08:32PM

41
#757 - Colton Weeding / @Doc_Glen_Townie

01/30/2020 at 09:37PM

42
#758 - Jes / @vim_jes

01/15/2011 at 03:54PM

42
#759 - Fred / @fredlee

05/27/2011 at 02:06PM

42
#760 - Jurica / @Jurica34581259

11/16/2018 at 01:09PM

42
#761 - 5S-BENDEGUZ-HORVATH / @5S-BENDEGUZ-HORVATH

01/12/2024 at 08:45AM

43
#762 - marklu / @marklu

12/29/2010 at 10:04AM

43
#763 - Jason P Bengtson / @bengtson_p

01/30/2020 at 10:35PM

43
#764 - Alonso Darias / @alonso_darias

01/31/2020 at 07:43AM

43
#765 - Sheep Island Productions / @island_sheep

02/01/2020 at 01:40AM

43
#766 - Chao Sang / @menglong2234

07/05/2022 at 09:00AM

43
#767 - Benjamin / @BenjaminBashar

11/27/2022 at 01:13PM

43
#768 - dennis / @nagolove

04/26/2024 at 09:16PM

44
#769 - Mike Waldner / @mawaldne

12/31/2010 at 08:02PM

44
#770 - 伺か / @ojiry

08/30/2018 at 10:54AM

44
#771 - Buatvimgolf / @buatvimgolf

07/28/2022 at 06:10AM

44
#772 - khankann / @khankann

05/18/2025 at 04:28PM

44
#773 - markbailey0356 / @markbailey0356

07/03/2025 at 03:02PM

45
#774 - Корнев Руслан / @woto7

01/03/2011 at 08:23PM

45
#775 - Robert Xu / @RobertX97592288

11/29/2018 at 01:47AM

46
#776 - Michael Lustfield / @Profarius

12/29/2010 at 07:02AM

46
#777 - Shunichi Kanade / @shunkana

11/04/2018 at 01:35AM

46
#778 - NotShanks / @NotShanks

05/31/2025 at 05:23AM

47
#779 - drio / @drio

12/29/2010 at 12:22PM

47
#780 - Algor / @algor_1

10/06/2012 at 12:41PM