Vi text editor tutorial
Based on work by nix and frontalot.
Originally by frontalot.
OpenLink’s vi is actually the busybox vi clone. Experienced vi users will recognize that the busybox vi lacks quite a number of vi commands and that the command interpreter does not understand all command syntax variants. The most “dangerous” issue is the absence of vi’s crash recovery feature. Neverthless the busybox vi is functional and suitable for the Linkstation.
vi is a command-oriented text editor. There are two modes in vi, COMMAND mode and INSERT mode.
COMMAND mode allows you move around inside your file quickly. When you first start vi, you are in command mode; otherwise, press ‹Esc› to get back to command mode. INSERT mode allows you to create and modify text in your file. Press i, a, or o (see below) to get to insert mode. Press ‹Esc› to get back to command mode.
Here are a few basic vi commands you can use while in command mode:
h - move to left l - move to right k - move up j - move down x - erase a character dd - delete a line i - enter insert mode (insert before cursor) a - enter insert mode (append after cursor) o - enter insert mode (open line below) J - join next line to current U - undo changes to line
To EXIT the vi editor change into command mode (by typing <Esc> if necessary), then type : (colon). The colon will appear at the bottom of your screen; to save and quit, type in wq and press ‹Enter›; to quit without saving type q! and press ‹Enter›.
The following tutorials all assume you have a proper version of vi installed. If things don’t work as described in a tutorial, it might be because of limitations with the busybox version of vi.
Learning the vi Editor WikiMedia Wikibook
Mastering the vi Editor University of Hawaii at Manoa College of Engineering
An Introduction to Display Editing with Vi From the father of vi, William “Bill” Joy. Partly very dated.