Inserting and Replacing text in Vi Editor
To edit the file, we need to be in the insert mode. There are many ways to enter insert mode from the command mode.
Command | Description |
---|---|
i | Inserts text before current cursor location |
a | Insert text after current cursor location |
A | Insert text at the end of current line |
o | Creates a new line for text entry below cursor location and switches to insert mode. |
O | Creates a new line for text entry above cursor location and switches to insert mode. |
s | Replaces single character under the cursor with any number of characters and switches to insert mode. |
R | Overwrites text from the cursor to the right, without switching to insert mode. |
vi Editor in Linux
The default editor that comes with the Linux/UNIX operating system is called vi (visual editor). Using vi editor, we can edit an existing file or create a new file from scratch. we can also use this editor to just read a text file. The advanced version of the vi editor is the vim editor.
Table of Content
- How to Open VI Editor
- Modes of Operation in the vi editor
- Linux vi Commands and Examples
- Moving within a File (Navigation) in Vi Editor
- Control Command (Scrolling) in vi Editor
- Inserting and Replacing text in Vi Editor
- Deleting Characters and Lines in Vi Editor
- Copy and Paste in Vi editor in Linux
- Save and Exit in Vi Editor in Linux
- Searching and replacing in (ex-Mode) in Vi Editor (Linux)
- Block delete commands in (x mode) in Vi Editor
- Block copy command in (x mode) in Vi Editor
- Block moving commands in (x mode) in Vi Editor