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):
17
#181 - Sergii Pidgornyi / @spodgorn

02/13/2025 at 12:06AM

18
#182 - echarp / @charpmanu

11/10/2011 at 01:41AM

18
#183 - You-Siang Lin / @yslinnctu

11/24/2011 at 08:54AM

18
#184 - John Anderson / @opejn

12/30/2011 at 06:39AM

18
#185 - フルメキ / @hurumeki

04/07/2012 at 12:43AM

18
#186 - rayx / @ray-x

12/05/2023 at 11:19AM

19
#187 - Terje Larsen / @terlars

04/08/2011 at 01:29AM

19
#188 - kjrn / @kjrnleto

05/22/2011 at 05:57PM

19
#189 - Dragan Cvetinovic / @kawkafi

05/23/2011 at 09:43PM

19
#190 - Justin Hale / @jxl

05/27/2011 at 09:27AM

19
#191 - Emile Swarts / @EmileSwarts

05/29/2011 at 12:23PM

19
#192 - Justin Love / @wondible

06/05/2011 at 07:47PM

19
#193 - dtennant / @dtennant

06/06/2011 at 07:57PM

19
#194 - Rolf Bjaanes / @rolfb

06/15/2011 at 10:08PM

19
#195 - not so punk :] / @notsopunk

06/19/2011 at 08:05AM

19
#196 - Junfeng / @junfeng

07/14/2011 at 08:53AM

19
#197 - Sammasati / @sammasati0

07/15/2011 at 03:49PM

19
#198 - Glenn / @glennular

07/17/2011 at 11:16PM

19
#199 - Ed Gibbs / @edward_gibbs

08/02/2011 at 04:13AM

19
#200 - Neil / @spameldoon

08/21/2011 at 03:14PM

19
#201 - Daniel Stoza / @dstoza

08/26/2011 at 12:40AM

19
#202 - Tim Tsu / @vimgolfpunk

08/29/2011 at 12:34PM

19
#203 - Ben Sherman / @bensherman

09/27/2011 at 06:02AM

19
#204 - p0ckets / @p0ckets

10/07/2011 at 12:35AM

19
#205 - André Kvist Aronsen / @andrearonsen

10/24/2011 at 12:41PM

19
#206 - Al / @96258

12/12/2011 at 02:41PM

19
#207 - Peter Anselmo / @peter_anselmo

03/08/2012 at 08:11PM

19
#208 - Chris Penkett / @chrispenkett

04/03/2012 at 07:13PM

19
#209 - learninghang / @learninghang

04/14/2012 at 02:49PM

19
#210 - skarrok / @skarrok

06/17/2012 at 10:37AM