vi command exercises

vi editor has two operating modes: command mode and a text entry mode
characters entered in command mode is interpreted as a command;
entered in the text input mode to edit content.
In edit mode, press Esc to switch to the command mode.

1. Save and Exit commands like

command Explanation
:wq Save and exit Vi, ":! Wq" force quit without saving
:q Do not save and exit vi, ": q!" Force Quit
:w Save without exiting vi; ":! W" Force Save;
": w filename", save changes to the filename in the Save as equivalent

2. Move the cursor commands like

command Explanation
h or Backspace Left one character
L Right one character
j or Ctrl+n Down one line
k or Ctrl +p Move a row
Enter Wrap

3. Insert and delete text command like

command Explanation
i Insert text before the cursor
a Text insertion cursor
o (lowercase) The new open line below the current line
O (uppercase) The new open line above current line
r Alternatively character cursor, enter the command r, an input needs to be replaced in a new character on the keyboard to complete the replacement
x Delete the character under the cursor
dd Delete cursor line
yy Copy the cursor line to the clipboard, the "yy" before adding numbers, you can copy multiple lines
p (lowercase) Copy the contents of the clipboard to the cursor
P (uppercase) Copy the contents to the clipboard before the cursor
is Copy the word under the cursor to the clipboard

4. The search and replace commands classes (to be exercise)

The screen type roll command (to be exercise)

Guess you like

Origin www.cnblogs.com/tamkery/p/11682039.html