
Note: Many of these commands change the vi editor into the input mode. Inserts text from another file into the current file Inserts text at the beginning of the line The table describes the commands to insert and append text to a new or existing file by using the vi editor. To the first non-white space character on the line The table shows the key sequences that move the cursor. Enter the :q command to exit the file, exit the vi editor, and return to the shell prompt. Entering the colon (:) character places the cursor at the bottom line of the screen.
To access the last line mode, enter a colon (:) while in the command mode. Last line mode – You can use advanced editing commands in the last line mode.
A – Appends text at the end of the lineģ. O – Opens a new blank line above the cursor. I – Inserts text at the beginning of the line. You can also invoke the input mode to insert text into a file by pressing one of the following uppercase keys: o – Opens a new blank line below the cursor. To invoke input mode, press one of the following lowercase keys: The vi editor interprets everything you type in the input mode as text. Input mode – You can insert text into a file in the input mode. You can also position the cursor, search for text strings, and exit the vi editor.Ģ. In this mode, you can run commands to delete, change, copy, and move text. Command mode – The command mode is the default mode for the vi editor. The vi editor provides three modes of operation: 1. The file opens in read-only mode to prevent accidental overwriting of the contents of the file.