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.
[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.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!