This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In


    Saving Files in Vim

    Mike HartingtonMike Hartington

    We've learned how to add text in Vim using insert mode, now what about saving that file? We'll go over how to use Vim's write command.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson


    00:00 In our last video, we learned how we could add text to a file using Vim's insert mode. Let's start Vim again, enter insert mode, and start adding some text.

    00:16 Now that we have text in our buffer, we want to be able to save it to disk. This can be done using Vim's write command. Let's exit out of insert mode and head to command mode. For this file, let's try to call the write command.

    00:32 You'll notice an error message appears in the bottom left. If you try to write a new file in Vim but don't supply a file name, you'll receive this error.

    00:41 Let's run the write command again but supply a name and an extension. Now, if we quit Vim, we can open the file again by running Vim and then the file name. The write command can also be run with the shortcut :W.