cmd

Vi: emptying a file in one shot

:1,$d

This vi command blanks out the file being edited.

Updated: javisantana suggested another way to emptying a file. Type:

ggdG

in command mode.

2 Comments

  • On 05.18.09 javisantana said:

    (ESC)ggdG works too.

  • On 05.18.09 rafacas said:

    Thanks javisantana. That works too, I’ll update the post with it :)

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*Required Fields