Join David D. Levine for an in-depth discussion in this video Managing files, part of Learning vi.
…Here's how you manage files from within vi.…These are all colon commands, which means you type the colon,…you'll see the prompt at the bottom of the screen.…Then you'll type a letter or letters and hit Return to execute the command.…:w writes the current file from memory to the disk but…leaves you still in vi so you can edit it some more.…You can do a :q to quit vi without writing.…And you would probably do this if you had not made any changes to the file.…If you have made changes to the file and…you type :q, you'll get a warning indicating that there are unsaved changes.…
In this case, you have to repeat the command :q with an exclamation point to…force vi to quit, abandoning the changes.…While you're in command mode,…you can type :vi and then another file name in order to edit a different file.…This closes the file that you were editing.…So, if there were any changes, it'll warn you about it.…You can either write the file or use :vi!,…and another file name, to edit a different file.…You can also specify multiple file names on the vi command line.…
AuthorDavid D. Levine
- Entering and leaving vi
- Understanding the Command, Insert, and Colon modes
- Moving around in files
- Editing text
- Moving content with delete, yank, and put
- Searching with regular expressions
- Customizing vi
- Filtering text through shell commands
Skill Level Beginner
1. Exploring vi
What is vi?2m 26s
2. Getting Started with vi
3. Moving Around within a File
4. Basic Text Editing
5. Undo, Repeat, Yank, and Put
6. Search and Replace
7. Advanced Editing Features
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.