Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
This chapter is from the book

Saving in vi

You’ll want to save changes to your documents frequently, especially as you’re learning to use vi red_a.jpg. Until you’re accustomed to switching between insert and normal mode, you may accidentally type in commands when you think you’re typing text, with unpredictable results. To save files, just follow these steps.

083fig01.jpg

Click to view larger image

red_a.jpg Save early, save often. That’s the safe rule for vi.

To save text in vi:

esc.jpg:w limerick

Press esc.jpg to get out of input mode and into command mode, then type :w (for “write,” as in write to the disk) followed by a space and then the filename (limerick, in this example) you want to use for the file, then press enter.jpg. If you’ve already saved the file once, just press esc.jpg and type :w, then press enter.jpg.

  • + Share This
  • 🔖 Save To Your Account