Level 1 Linux Exercises
Linux Exercise #1.6 – Getting Started with vim
Background Information
There are several powerful text editors that are worthwhile learning. If you find yourself having difficulty with navigation and/or modification of a source file, spend time with vim. The power available through this editor can greatly speed up development time! All students in CS163 and CS202 will be expected to become proficient programming with these commands.
- The following are common modes used with vim:
- Command mode: This is the initial mode that you are in when opening up the editor. In this mode you can ask to insert, append, delete, and perform other navigation related commands. Navigation allows you to move around within the file. In command mode, it is not possible to start typing in text. Everything that is typed is taken as a command. This is why it is called command mode!
- Insert mode: This is the mode that we enter when you ask to insert or append. Once in insert mode, anything that is typed is entered into the document (although not saved until that request is executed). To end insert mode, you must use the escape key!
- Last Line mode: From command mode, you can execute certain commands while still examining your document by using the colon key. After selecting the colon, a line appears below the editor window (called the “last line” that allows you to perform operators to save, quit, search and replace. To save and quit we would type
:wq
A useful last line mode command is to get help concerning the commands available. Follow the
:help
with the command you would like more information::help command
- Visual mode: Visual mode is available with vim to extend normal use and add the ability to highlight text.