Thursday, August 11, 2016

vi commands


vi commands


Command-line Mode:



w - Writes the current file to disk.

exit - Writes the current file to disk and then closes vi.

wq - Also writes the current file to disk and closes vi.

q - Closes vi without saving the current file.

q! - Closes vi without saving the current file, even if the file has been modified.

w! - Overwrites the current file.

e! - Forgets changes since the last write




Command Mode:



dw - Deletes the word that comes immediately after the cursor, including the space following the word.

de - Deletes the word that comes immediately after the cursor, but not the following space.

d$ - Deletes from the insertion point to the end of the line.

dd - Deletes the entire current line.

p - Inserts deleted text after the current cursor location.

u - Undoes the last action.

/term - Searches for the specified term in the file.

D - Deletes the rest of the current line from the cursor position.

yy - Copies the line in which the cursor is located to the buffer.

a - Append after cursor.

A - Append after line.

C - Change to the end of the line.

cc - Change the whole line.

ZZ - Saves the current file and ends vi.

h - Moves the cursor left one character.

j - Moves the cursor down one line.

k - Moves the cursor up one line.

l - Moves the cursor right one character.

0- Moves the cursor to the start of the current line

No comments:

Post a Comment