vi(1) Name vi - screen editor Syntax vi [ -t _t_a_g ] [ +_c_o_m_m_a_n_d ] [ -l ] [ -r ] [ -w_n ] [ -x ] _n_a_m_e... Description The _v_i (visual) editor is a display-oriented text editor based on _e_x(1). The _e_x command and the _v_i command run the same code. You can access the command mode of _e_x from within _v_i. The following is a list of some of the _v_i commands. See the _v_i _B_e_g_i_n_n_e_r'_s _R_e_f_e_r_e_n_c_e _C_a_r_d and "An Introduction to Display Editing with vi" in the _S_u_p_p_l_e_m_e_n_t_a_r_y _D_o_c_u_m_e_n_t_s, _V_o_l_u_m_e _1: _G_e_n_e_r_a_l _U_s_e_r for more details on using _v_i. Screen Control Commands Reprints current screen. Exposes one more line at top of screen. Exposes one more line at bottom of screen. Paging Commands Pages forward one screen. Pages back one screen. Pages down half screen. Pages up half screen. Cursor Positioning Commands j Moves cursor down one line, same column. k Moves cursor up one line, same column. h Moves cursor back one character. l Moves cursor forward one character. Moves cursor to beginning of next line. 0 Moves cursor to beginning of current line. $ Moves cursor to end of current line. Moves cursor forward one character. _nG Moves cursor to beginning of line _n. Default is last 1 vi(1) line of file. /_p_a_t_t_e_r_n Moves cursor forward to next occurrence of _p_a_t_t_e_r_n. ?_p_a_t_t_e_r_n Moves cursor backward to next occurrence of _p_a_t_t_e_r_n. n Repeats last / or ? pattern search. Text Insertion Commands a Appends text after cursor. Terminated by . A Appends text at the end of the line. Terminated by . i Inserts text before cursor. Terminated by . I Inserts text at the beginning of the line. Terminated by . o Opens new line below the current line for text inser- tion. Terminated by . O Opens new line above the current line for text inser- tion. Terminated by . Overwrites last character during text insertion. Stops text insertion. Text Deletion Commands dw Deletes current word. x Deletes current character. dd Deletes current line. D, d$ Deletes from cursor to end of line. P Puts back text from the previous delete. Text Change Commands cw Changes characters of current word until stopped with escape key. c$ Changes text up to the end of the line. C, c$ Changes remaining text on current line until stopped by pressing the escape key. ~ Changes case of current character. 2 vi(1) xp Transposes current and following characters. J Joins current line with next line. r_x Replaces current character with _x. Buffer Usage Commands [_a-_z]_n _y_y Yanks _n lines to the [_a-_z] buffer. Default is current line. [_a-_z]_n _p Puts _n yanked text lines from the _a-_z buffer, after the cursor. Exiting vi ZZ Exits _v_i and saves changes :wq Writes changes to current file and quits edit session. :q Quits edit session (no changes made). The _v_i_e_w command uses all of the same edit or commands as _v_i. However, _v_i_e_w does not allow you to write the file. See _v_i_e_w(1). Options -t _t_a_g Specifies a list of _t_a_g files. The _t_a_g files are preceded by a backslash (\) and are separated by spaces. The _t_a_g option should always be the first entry. +_c_o_m_m_a_n_d Tells the editor to begin by executing the specified _c_o_m_m_a_n_d. A useful example would be +/_p_a_t_t_e_r_n to search for a _p_a_t_t_e_r_n. -l Sets the showmatch and lisp options for editing LISP code. -r _n_a_m_e Retrieves the last saved version of the _n_a_m_e'd file in the event of an editor or system crash. If no file is specified, a list of saved files is produced. -w_n Sets the default window size to _n. This option is useful for starting in a small window on dialups. _N_o_t_e The -x option is available only if the Encryption layered pro- duct is installed. -x Causes _v_i to prompt for a _k_e_y. The _k_e_y is used to encrypt and decrypt the contents of the file. If the file contents have been encrypted with one _k_e_y, you must use the same _k_e_y to decrypt the file. 3 vi(1) Restrictions Software tabs using ^T work only immediately after the _a_u_t_o_i_n_d_e_n_t. Left and right shifts on intelligent terminals do not make use of insert and delete character operations in the terminal. The _w_r_a_p_m_a_r_g_i_n option sometimes works incorrectly because it looks at output columns when blanks are typed. If a long word passes through the margin and onto the next line without a break, then the line is not bro- ken. Insert/delete within a line can be slow if tabs are present on intelli- gent terminals, since the terminals need help in doing this correctly. Saving text on deletes in the named buffers is somewhat inefficient. The _s_o_u_r_c_e command does not work when executed as :source; there is no way to use the :append, :change, and :insert commands, since it is not possible to give on a :global you must Q to _e_x command mode, execute them, and then reenter the screen editor with _v_i or _o_p_e_n. See Also ed(1), ex(1), view(1) _T_h_e _L_i_t_t_l_e _G_r_a_y _B_o_o_k: _A_n _U_L_T_R_I_X _P_r_i_m_e_r _T_h_e _B_i_g _G_r_a_y _B_o_o_k: _T_h_e _N_e_x_t _S_t_e_p _w_i_t_h _U_L_T_R_I_X "An Introduction to Display Editing with Vi", _S_u_p_p_l_e_m_e_n_t_a_r_y _D_o_c_u_m_e_n_t_s, _V_o_l_u_m_e _1: _G_e_n_e_r_a_l _U_s_e_r 4