How to Use VI Editor
VI (pronounced as two separate letters vee-eye) is short for Visual Editor is a command line based text editor for the Unix system, an operating system that many persons may not have heard about or be familiar with; Unix is an operating system that was developed by AT&T in the late 1960′s and though very old, it has led to many different variants including the somewhat more popularly spoken of Linux operating systems.
Linux itself now has many different distributions available including Ubuntu, OpenSUSE, Fedora and a host of other; regardless of the different variants, spin-offs or Unix-like operating systems available today many of the core functions and applications still remain the same. In the event that a situation arises where you need to use this text editor and you are not sure of how it works, here are a few tips to get you more comfortable with the application.
- The VI editor works by opening a window in the file being edited that shows 24 lines of text; VI is a text editor and lets you add, change, and delete text, but your options for editing the text in any other way, such as indenting or centering the text, are very limited.
- VI has two modes that you can use to input data command mode and insert mode. The difference between the two is that in command mode, all the letters on the keyboard serve editing functions such as deleting text, or moving around in the file; in insert mode the letters work more as they should and form words and sentences.
- To get the VI editor running, locate your command prompt and type the command VI and press Enter on your keyboard to open it; once running you may open an existing file by typing ‘vi’ and the filename; if you want to create a new file, type ‘vi’ and the name you wish to give the file. If you need to open a new file, type in ‘vi’ and the name of the new file to open it.
- Once you have a file open, to begin entering text select insert mode by pressing the letter ‘I’; you won’t see any visible changes to the file but you will see the text being entered when you begin typing. VI does not have a text wrapping feature to make the text automatically go to the next line when you get to the end of a line so you will have to hit the Enter button each time you get to the end of a line in order to move to the next line. If you wish to move the cursor when you have finished inserting text, you will have to switch to command mode by simply pressing the Esc key.
TIPS AND WARNINGS
When opening an existing file, if you type ‘vi’ and the filename and the file does not open, you may have to type in the full pathname of the file before it will open.
About the author
Edmond is BE final year student and he loves to write technology content and currently he is learning VI Editor.