Tuesday, May 24

VI Editor






a
Insert text after the cursor.


i
Insert text before the cursor.


o
Open a new line below the line your cursor is currently on.


A
Insert text at the end of the line.


I
Insert text at the beginning of the line.


O
Open a new line above the line your cursor is currently on.


x
Delete the character beneath the cursor.


h
Move your cursor to the left by one character.


l
Move your cursor to the right by one character.


j
Move your cursor up by one line.


k
Move your cursor down by one line.


$
Move to the end of the line.


0
Move to the beginning of the line.


w
Move forward one word and place the cursor on the first character of that word.


b
Move backward one word and place the cursor on the first character of that word.


G
Go to the end of the file.


1G
Go to line 1 of the file.


CTRL+g
Report on the current line number that the cursor if on as well as the number of total lines in the file.


dd
Delete the current line.


cw
Change word. That is, change the characters from where your cursor is to the next space or punctuation.


cl
Change letter. Change the character that your cursor is on.


yy
Copy the line that the cursor if currently on.


p
Place the contents of either a deleted line or a copied line on the line immediately following the one your cursor is currently on.


u
Undo the last change.


:w filename
Save changes. The filename is optional and is only used to specify the name of the file that you would like to save your work as.


:wq filename
Save changes and quit. Again, the filename is optional.


ZZ
Save changes and quit.


:q!
Quit without saving changes.


/string
Search for next occurrence of string in the file.


n
Repeat the last search


.
Repeat the last insert function.






2 comments: