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):
21
#241 - TweetDreams / @TweetMusicians

10/11/2016 at 03:40AM

21
#242 - Scott Atkins / @scottrick49

06/16/2021 at 01:13PM

21
#243 - 语冰者 / @darcysail

08/19/2022 at 05:47AM

21
#244 - Adigan / @Addigan

05/13/2023 at 11:15AM

21
#245 - Данил / @fergon4ik1

09/19/2023 at 10:38AM

21
#246 - Michael / @openemitter

12/27/2023 at 12:10AM

21
#247 - wihinenh / @wihinenh

04/07/2024 at 06:40PM

21
#248 - Christensen, Scott (S.C.) / @MCHRI120_ford

11/03/2024 at 09:35PM

21
#249 - Anton Savelyev / @PoiXP

01/02/2025 at 10:59PM

21
#250 - kevincking1986 / @kevincking1986

03/25/2025 at 01:44AM

22
#251 - Danny Dulai / @dannydulai

12/31/2010 at 07:26AM

22
#252 - fukamikaze / @fukamikaze

01/01/2011 at 04:22AM

22
#253 - Vincent Isambart / @vincentisambart

01/01/2011 at 07:35AM

22
#254 - h_east (トロッコ6個) / @h_east

01/01/2011 at 03:52PM

22
#255 - Jordi Romero / @jordiromero

01/01/2011 at 06:34PM

22
#256 - wyl rof / @wylrof

01/02/2011 at 02:28PM

22
#257 - Tom Burger / @thomasburger

01/04/2011 at 03:31PM

22
#258 - Mark Smith-Guerrero / @msmithgu

01/04/2011 at 06:17PM

22
#259 - Tim Dean / @Tmdean

01/04/2011 at 09:06PM

22
#260 - derp derp / @derp__

01/05/2011 at 07:07AM

22
#261 - Wei Dai / @clvv42

01/07/2011 at 03:52AM

22
#262 - Tim Chase / @gumnos

01/08/2011 at 12:42PM

22
#263 - Balkoth / @_Balkoth_

01/08/2011 at 04:46PM

22
#264 - Saša / @jendvatri

01/09/2011 at 03:13AM

22
#265 - Rörd Hinrichsen / @roerdhh

01/09/2011 at 10:29PM

22
#266 - Luke Sheridan / @lukesheridan

01/10/2011 at 05:11AM

22
#267 - alexscott / @4l3xsc0tt

01/10/2011 at 05:47PM

22
#268 - Pete Johns / @johnsyweb

01/14/2011 at 10:50PM

22
#269 - Oleg Roshupkin / @jjjahson

01/17/2011 at 08:59AM

22
#270 - Andrey Ivanov / @Bytamine

01/19/2011 at 11:52AM