📄 l3.1
字号:
#print Basic Alteration - Insert and Delete I So now you can move around nearly to your heart's content. Wouldn't itbe nice if you could change something? In the next two lessons you'll seehow to make basic changes to a file: inserting and deleting characters andlines. Inserting and deleting text are just a matter of moving to the rightplace and using the right command. We'll be looking at these six commands: i a These are the most common insertion commands. 'i' will allow you to insert text before the character the cursor is on and 'a' will append it after the current character. I A These are for inserting text at the beginning of the current line and appending it to the end of said line. x X These are the commands for deleting characters. 'x' will delete the character the cursor is on and 'X' gets rid of the character before the cursor. Type 'ready' now to learn more about inserting and deleting.#user#create Insert1 Inserting text takes four steps: 1) Move to the proper place in the file. 2) Type the correct insertion command (i, I, a, or A). This puts you into 'insert' mode. 3) Enter the new text. 4) Hit the Escape key. This brings you back out of insert mode. The insertion commands, again, are as follows: i inserts before the current character a appends (i.e. inserts after the current character) I inserts before the beginning of the current line A appends text after the end of the current line Try inserting some text now anywhere in the file. Don't touch anything pastthe dashed line, though. Deleting text is merely a matter of moving the cursor to the characters tobe deleted and hitting x once per character. They should disappear. You canalso use the X command, which deletes the character right before the currentone. This doesn't appear to get used too frequently, however. Try deleting some text now, anywhere in the file. Still don't touch things after the dashedline, though. When you're done, do the exercise below.--------------------------------------------------------------------------EXERCISE Delete the words 'blort' and 'gronk' below. Don't delete thedashes or equals signs. Then insert the word 'blather' between the equalssigns. Be sure to save your changes before you leave the editor. -blort==gronk-#create Answer -=blather=-#vi Insert1grep =- Insert1 > Attempt#cmp Attempt Answer#succeedNot bad... Not bad at all. It looks like you pick up this stuff prettyquickly.#failAccidents will happen. Give it another try. This time spend a little moretime practicing before you do the exercise. If you managed to do it butcouldn't remember how to save the file, try it again anyway. You save yourwork by using the :w command.Type 'ready' when the learn program types a percent sign.#next3.2 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -