📄 l1.2
字号:
#print So far, you've learned how to force vi to listen to you (the Escapekey), to redraw the screen (the ^L or ^R command), how to get out of vi(the :q command), and how to quit even when vi thinks you shouldn't(the :q! command). Suppose that vi is right, however, when it preventsyou from quitting. Suppose that you really do want to save the changesyou've made to the file. For this vi uses the :w command. 'w' stands forwrite, meaning that vi is going to write out its private copy of the file,thereby saving your work. You use the :w command in the same way as you use :q. That is, you type a colon, the cursor moves to the bottom of the screen, you type 'w' and hitreturn, and vi saves the file. If you wanted vi to save the file under adifferent name, you could type ':w <filename>', where <filename> stands forthe new name. Very frequently, you want to both write out the file and thenquit. You could use the :w command followed by the :q command. Vi alsoprovides a shorthand version, :wq, which will both save the file and then quit. Now you are ready to try out the :w command, but this time I want you toget into the editor yourself. When you see the percent sign, type vi WriteTextand when you've quit the editor type 'ready' to go to the next lesson.#create WriteText Use the :w command to save this file under the name SaveTest and thenuse the :wq command to save it also under its old name. If you don't remember how to do this, just type :q and you'll get tosee the lesson again. When you see the percent sign, don't forget to type 'ready' togo on to the next lesson.#user#cmp WriteText SaveTest#succeedVery good. Now that you can save anything you do, let's go on.#failTry again. To save a file in a new place, type :w <filename>using the new name instead of '<filename>'. For example, to save it underthe name 'blort', you'd type :w blortTo save it under its old name and then quit, just type :wqWhen 'learn' types a percent sign, type 'vi WriteText' to try it again.#next2.1 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -