Saving in vi
You'll want to save changes to your documents frequently, especially as you're learning to use vi (Figure 4.12). Until you're accustomed to switching between command and input mode, you may accidentally type in commands when you think you're typing text, with unpredictable results. To save files, just follow these steps.
Figure 4.12. Save early, save often. That's the safe rule for vi.
To Save Text in vi: