$ set nocompatible
$ set backspace=2
You need to change to the "insert" mode by moving the cursor with
i
.
There are other ways to delete characters directly.
You can download a powerpoint that I use when teaching a class on VI here.It sounds like you are in the "Command" mode. To move your cursor:
H
= Left, J
= Up, K
= Down, L
= RightOnce you have your cursor positioned you can delete text as follows:
x
Deletes the character under the cursorX
Deletes the character before the cursordw
Deletes from the cursor to the next worddd
Deletes the line the cursor is on.To enter text, you can use one of the text entry modes.
a
Adds text to the right of the cursorA
Adds text to the end of the current linei
Adds text to the left of the cursorI
Adds test to the beginin of the current lineo
Opens a new line below the current line and places you in text entry modeO
Opens a new line Above the current line and places you in text entry modeTo exit Text entry mode, and return to the Command mode, use
Esc
.To Undo changes: (A student favorite)
u
Undo the last command enteredU
Undo all changes to the ** current line**To Save/Quit:
:w
Writes (Saves) the file and remains open:wq
Writes (Saves) the file and exits VI:q
Quits (Exits) if you've made no changes:q!
Quits (Exits) without saving changesZZ
Writes (Saves) the file and exits VI (same as :wq
)
댓글 없음:
댓글 쓰기