VI.IV(L) LOCAL COMMANDS VI.IV(L) NAME vi.iv -bi-directional full-screen text editor based on vi SYNOPSIS vi.iv [ -S ] [ -MS ] [ -LR|RL ] [ _v_i _o_p_t_i_o_n_s ] _n_a_m_e ... NOTE: This manual is fairly long, since it describes some of the concepts of bi-directional editing that _v_i._i_v is based on. If this is your first time editing time-ordered bi- directional text, it is probably worthwhile to read the DESCRIPTION section. But if you want to skip that and get more concise information about how ro run _v_i._i_v and the commands it has that _v_i (_1) does not have, you'll want to read the following sections: OPTIONS & COMMANDS, and THE TECHNION COMPUTER SCIENCE FACULTY INSTALLATION. If you are responsible for maintaining _v_i._i_v , then you may also want to read TERMCAP FIELDS. DESCRIPTION _v_i._i_v is a bi-directional full screen text editor based on _v_i(1). _v_i._i_v works just like _v_i except for being able to handle bi-directional text, for example containing English and Hebrew. _v_i._i_v is not limited to terminals supporting Hebrew, and can likewise work with all alphabets found on the terminal. Therefore, in order to not be restricted to these particular languages, we will speak in the abstract about a language LR, written from left to right, and about a language RL, written from right to left. The language LR _i_s, however, written with the Latin alphabet, the alphabet of the ASCII codes. The lanuage RL can be Arabic, Hebrew, etc., although the examples in this manual page are in Hebrew. The reader is assumed to be familiar with _v_i. _v_i._i_v has been designed to appear as _v_i when only LR text is used and is shown from left-to-right. Accordingly, the explanation given here is focused on the difference between _v_i._i_v and _v_i and explains most things in terms of the already well-known behavior of _v_i. In the examples, file contents are always shown from left to right and have a file-beginning symbol, -|, at the left end. Screen appearances are marked by vertical bars on the left and right sides serving as boundaries of an imaginary screen whose width is 30 characters. Entered text or commands are always shown from left to right with no special markings at either end; each character shown is part of the input. In a file contents or an input, represents a new-line character or a carriage return respectively, ^ represents pressing CONTROL simultaneously with the following character, represents the ESCAPE character, and [] Sun Release 4.1 Last change: February, 1990 1 VI.IV(L) LOCAL COMMANDS VI.IV(L) represents a blank when emphasis is needed. Principles There are a few simple principles which form the bases for both the design and effective use of _v_i._i_v. They guided the design and implementation. A clear understanding of them by the user allows him or her to deduce the expected behavior of the system. Coding of Characters Normally, seven bits suffices for the encoding of the Latin letters in what is called the ASCII code. Likewise, seven bits suffices for the encoding each of the Hebrew and Arabic alphabets. There exists standard encodings for each in which the letters get codes allocated to letters in ASCII. Thus the standard encodings for Hebrew and Arabic have the digits, punctuation and control characters in the same positions they have in ASCII. _v_i._i_v assumes an encoding for the characters of the alphabets such that the characters of the Latin alphabet, according to the ASCII code have the eighth bit off. It assumes that the characters of the other RL alphabet have the eighth bit on with the lower order seven bits as in the standard code. Thus if RL is Hebrew, _v_i._i_v is using the ESCII code. (See _e_s_c_i_i(7).) By storing all characters with the proper setting of the eighth bit, the file remembers the language for all characters, even the digits, punctuation, and control characters, such as tabs. In addition, most recently developed terminals, with the ability to change alphabet on a character-by-character basis, use the eighth bit to indicate in which language a particular seven bit code is to be shown on the screen. Current View The first of these is the concept of a _v_i_e_w of a document. At any time, _v_i._i_v has a window open on a portion of a document. That portion is called the _c_u_r_r_e_n_t _v_i_e_w and is what the user sees on the screen. View Direction At any time, the view that _v_i._i_v is presenting has a direction, which is either left-to-right (LR) or right-to- left (RL). In the following, X and Y are each left or right but not the same. The impact of this direction is that if it is from X to Y, then the beginning of a line is on the X side of the screen, paragraph indentation takes place on the X side of the screen, the end of a line is either at the Y end of the screen or some place to the Y of the beginning, etc. The view direction is superimposed on what ever text Sun Release 4.1 Last change: February, 1990 2 VI.IV(L) LOCAL COMMANDS VI.IV(L) is being shown at the moment. As far as _v_i._i_v is concerned, the view direction _n_o_t_h_i_n_g whatsoever to do with the language of the document; although to the human user, using an LR view for a Hebrew document or an RL view for an English document will not feel too comfortable. Some English text in an LR view is: |If I am not for myself, | | then who is for me? | |If I am only for myself, | | then what am I? | |If not now, then when? | | -Pirke Avot | The same text in an RL view does not look quite as nice: |If I am not for myself, | | then who is for me? | |If I am only for myself, | | then what am I? | |If not now, then when? | | -Pirke Avot | Actually, because English is an LR language, in an RL view, it is being written backwards in order that it appear written from left to right. Some Hebrew text in an RL view is: |`m `io `pi li, ni li? | |`m `pi lrvni, nd `pi? | |`m l` rkyie, `inzi? | | -txwi `aez | The same Hebrew text in an LR view does not look so nice: |`m `io `pi li, ni li? | |`m `pi lrvni, nd `pi? | |`m l` rkyie, `inzi? | | -txwi `aez | Similarly, because Hebrew is an RL language, in an LR view, it is being written backwards in order that it appear written from right to left. The current view direction can be changed at any time by use of a set command; :set rightleft :set rl :set nolr :set noleftright Sun Release 4.1 Last change: February, 1990 3 VI.IV(L) LOCAL COMMANDS VI.IV(L) all set the view direction as RL, and :set leftright :set lr :set norl :set norightleft all set the view direction as LR. Note then that any given window of the file being edited can be viewed from either direction, although not at the same time in a given _v_i._i_v invocation. When started up, _v_i._i_v assumes an LR view direction unless there is a contraindicating command in the .exrc (_o_r ._e_x_r_i_v) file or in the EXINIT (_o_r _E_X_I_N_I_T_I_V) variable. Time Order vs. Visual Order A given file can be kept in one of two orders: time order The characters are stored in the order in which they would be input if the text were typed from beginning to end with no backspacing. It is the order in which the characters are pronounced if the text is read aloud. Thus if one considers the file as ordered from left to right, then the letters of LR text appear to be in the right order, but the letters of RL text appears to be backwards. visual order The characters are stored in the order in which they appear on the screen. In order to clarify the difference between these two orders, suppose that the view direction is from right to left, and suppose one typed the letters yni[]uri with the intention of seeing |yni uri | on the screen. That intention implies that the view must be RL, for the first word is on the right. With time order the characters are stored in the file in the following order: -|yni[]uri With visual order the characters are stored in the file in the following order: Sun Release 4.1 Last change: February, 1990 4 VI.IV(L) LOCAL COMMANDS VI.IV(L) -| uri[]iny If, on the other hand, the view direction were LR, then the same input would appear as |yni uri | on the screen. With time order, the characters are stored in the file in the same order as for the RL view example: -|yni[]uri However, with visual order the characters are stored in the file in the following order: -|iny[]uri Note that in all of the above examples, in order for the space to end up between the two words, the space has to be entered in the language whose direction is the same as that of the view. Thus, time order is dependent only on the order of input and is independent of the viewing order. Visual order is dependent on the order of input and on the viewing order. Screen Appearance While the contents of files are kept in time order, the screen appearance of those contents are in the order in which a human being wants to see the characters. In this order, all the text on one line is read before moving on to the next, each language is read in its own natural direction, and the major flow of each line is according to the natural direction of the document's main language. Because the main language of a document is somewhat arbitrary and depends on a human choice which can be indpendent of the contents, _v_i._i_v simply considers the current view direction as defining for that moment a main language whose direction is equal to the view direction. The screen appearance of any view is a function of the current view direction and the language of the individual characters, i.e., the state of their eighth bits. While the actual editor cannot use exactly the following algorithm (because it is trying to avoid to have to redraw whole lines), the ultimate expected appearance of a view can be understood in terms of the following line-by-line algorithm: for each line in the view do if the current view direction is LR then Sun Release 4.1 Last change: February, 1990 5 VI.IV(L) LOCAL COMMANDS VI.IV(L) rotate each contiguous string of RL text about its own center axis else (the current view direction is RL) rotate the whole line about its center axis; rotate each contiguous string of LR text about its own center axis fi od As an example, consider the following three-line file contents: -|de` `nx "Hello there Uri -|and Dan. How are you -|today?" l`exi ecpi`l If the current view direction is LR, then the appearance of the view is: |de` `nx "Hello there Uri | |and Dan. How are you | |today?" l`exi ecpi`l | However, if the current view direction is RL, then the appearance of the view is: |de` `nx "Hello there Uri | |and Dan. How are you | |today?" l`exi ecpi`l | It is interesting that the formatting system used to format this manual, _d_i_t_r_o_f_f/_f_f_o_r_t_i_d, a bi-directional version of _d_i_t_r_o_f_f expects its input in time order and uses the same line-by-line algorithm to reorganize the mixed langauge text on each line so that the text in each language is printed in its own natural direction. Hence, in order to arrange that the various screen displays were printed correctly it sufficed to give to the formatter only the file contents. In order that file contents not get reversed by the formatter, the same Hebrew font was mounted in two different positions, only one of these positions was specified to be RL, and the file examples were prepared with its Hebrew in the LR position of the font. Shef Format The combination of ESCII code and time order is called _s_h_e_f _f_o_r_m_a_t. _v_i._i_v's default assumption is that the file is in shef format. The editor _v_i_h(l), however, uses the following format: (1) Visual order (going from right to left) Sun Release 4.1 Last change: February, 1990 6 VI.IV(L) LOCAL COMMANDS VI.IV(L) (2) The coding follows ASCII except: (a) The codes normally assigned to the lower case letters (& the grave accent, "`") represent the Hebrew characters (b) The lower case letters (& "`") are represented by by their normal ASCII codes with the eighth bit set _V_i._i_v can be invoked with the -S _o_p_t_i_o_n _t_o _o_p_e_r_a_t_e _u_n_d_e_r _E_S_C_I_I _w_i_t_h _v_i_s_u_a_l _o_r_d_e_r. _A_d_d_i_t_i_o_n_a_l_l_y, _i_f _a_f_t_e_r _i_n_v_o_k_i_n_g _v_i._i_v, _i_t _i_s _d_i_s_c_o_v_e_r_e_d _t_h_a_t _t_h_e _f_i_l_e _l_o_o_k_s _s_t_r_a_n_g_e, _o_n_e _c_a_n _c_a_u_s_e _v_i._i_v _t_o _o_p_e_r_a_t_e _i_n _v_i_s_u_a_l _o_r_d_e_r _b_y _u_t_t_e_r_i_n_g: :_s_e_t _n_o_s_h_e_f_o_r_m_a_t _N_o_t_e _t_h_a_t _t_h_e _o_r_d_e_r _o_f _s_t_o_r_a_g_e _o_f _t_h_e _f_i_l_e _i_s _a _p_e_r_m_a_n_e_n_t _p_r_o_p_e_r_t_y _o_f _t_h_e _f_i_l_e _a_n_d _v_i._i_v _w_i_l_l _n_o_t _c_o_n_v_e_r_t _t_h_e _f_i_l_e _f_r_o_m _o_n_e _o_r_d_e_r _t_o _a_n_o_t_h_e_r. _T_h_e_r_e _a_r_e _o_t_h_e_r _p_r_o_g_r_a_m_s, _s_u_c_h _a_s _s_h_e_f_f(_l), _f_o_r _t_h_a_t _p_u_r_p_o_s_e. _C_u_r_r_e_n_t _L_a_n_g_u_a_g_e _o_f _I_n_p_u_t The next important concept is that of the current language of input. The current language of input is either LR or RL. It governs how the keystrokes are interpreted, what character appears on the screen and what goes into the file. Once in the file, the language of a character does _n_o_t change even if the current language changes. If the current language is LR, then the standard qwerty keyboard is assumed and the generated ASCII seven-bit codes are stored with the eighth bit off. If the current language is RL, then the standard keyboard arrangement for RL is assumed, and the generated seven-bit codes are stored with the eighth bit on; in some cases, the keyboard provides the full eight-bit codes, and in some cases only seven bits comes from the keyboard and the on eighth bit must provided by the software. The termcap for each terminal describes which kind it is and describes what operations the terminal is capable of doing; there is more on termcaps later. The command for switching the current language of input is ^x. As the user indicates a desire to switch by issuing the switching command, _v_i._i_v tells the terminal to switch mode if the current termcap says that the terminal has a software-issueable command to do so. If the terminal does not have such a command, then the user is told by means of a highlighted bottom-line message to manually flip the terminal's mode; of course, if the user fails to do so, the results are weird! Sun Release 4.1 Last change: February, 1990 7 VI.IV(L) LOCAL COMMANDS VI.IV(L) There is a slight problem with the character chosen to indicate a change of input language. Many users use ^x as the line killing command by having told the shell stty kill ^x As a result giving ^x during input causes erasing of the input line rather than a change to the input language; _v_i._i_v never gets to see the ^x _s_i_n_c_e _t_h_e _t_t_y _d_r_i_v_e_r _h_a_s _s_w_a_l_l_o_w_e_d _i_t _t_o_g_e_t_h_e_r _w_i_t_h _t_h_e _w_h_o_l_e _l_i_n_e _o_f _i_n_p_u_t. _A_s _v_i _h_a_s _g_i_v_e_n _a _m_e_a_n_i_n_g _t_o _a_l_m_o_s_t _e_v_e_r_y _p_o_s_s_i_b_l_e _c_h_a_r_a_c_t_e_r _g_e_n_e_r_a_b_l_e _f_r_o_m _t_h_e _k_e_y_b_o_a_r_d, _t_h_e_r_e _w_e_r_e _n_o_t _t_o_o _m_a_n_y _c_h_o_i_c_e_s _o_f _c_h_a_r_a_c_t_e_r_s _t_o _u_s_e _a_s _t_h_e _l_a_n_g_u_a_g_e _c_h_a_n_g_e _i_n_d_i_c_a_t_i_o_n. _T_h_e _c_h_a_r_a_c_t_e_r _h_a_d _t_o _b_e _s_o_m_e_t_h_i_n_g _t_h_a_t _i_s _n_o_t _l_i_k_e_l_y _t_o _b_e _p_u_t _i_n_t_o _a _f_i_l_e; _i_f _i_t _w_e_r_e, _t_h_e_n _t_h_e _u_s_e_r _w_o_u_l_d _h_a_v_e _t_o _e_s_c_a_p_e _i_t _e_a_c_h _t_i_m_e _i_t _w_o_u_l_d _b_e _p_u_t _i_n_t_o _t_h_e _f_i_l_e _r_a_t_h_e_r _t_h_a_n _b_e _o_b_e_y_e_d. _T_h_u_s _i_t _h_a_d _t_o _b_e _s_o_m_e _C_O_N_T_R_O_L _c_h_a_r_a_c_t_e_r _t_h_a_t _d_i_d _n_o_t _h_a_v_e _a_n_o_t_h_e_r _m_e_a_n_i_n_g. _G_e_n_e_r_a_l_l_y, _a _u_s_e_r_s _u_s_e_s _e_i_t_h_e_r _o_f ^_x _o_r ^_u _a_s _a _s_i_g_n_a_l _t_o _t_h_e _t_t_y _d_r_i_v_e_r _b_u_t _n_o_t _b_o_t_h. _T_h_e _l_a_t_t_e_r _i_s _u_s_e_d _m_o_r_e _o_f_t_e_n _a_n_d _i_s _u_s_e_d _a_s _t_h_e _l_i_n_e _k_i_l_l_e_r. _T_h_e_r_e_f_o_r_e, _i_t _w_a_s _d_e_c_i_d_e_d _t_o _u_s_e _t_h_e _f_o_r_m_e_r _a_s _t_h_e _l_a_n_g_u_a_g_e _c_h_a_n_g_e _i_n_d_i_c_a_t_i_o_n _a_n_d _t_o _m_a_k_e _w_h_i_c_h _c_h_a_r_a_c_t_e_r _t_h_a_t _i_s _u_s_e_d _a_s _t_h_e _i_n_d_i_c_a_t_i_o_n _s_e_t_t_a_b_l_e _w_i_t_h: :_s_e_t _c_h_a_n_g_e_l_a_n_g=_n_e_w-_c_h_a_r_a_c_t_e_r _T_h_e _s_e_c_o_n_d _a_u_t_h_o_r _u_s_e_s ^_x _a_s _t_h_e _l_i_n_e _k_i_l_l_e_r _a_n_d _d_o_e_s :_s_e_t _c_h_a_n_g_e_l_a_n_g=^_v^_u _t_o _s_e_t _t_h_e _l_a_n_g_u_a_g_e _c_h_a_n_g_e _i_n_d_i_c_a_t_o_r _t_o ^_u. _I_n _t_h_e _s_u_b_s_e_q_u_e_n_t _d_i_s_c_u_s_s_i_o_n, ^_x _i_s _u_s_e_d _t_o _d_e_n_o_t_e _t_h_e _l_a_n_g_u_a_g_e _c_h_a_n_g_e _i_n_d_i_c_a_t_o_r _w_h_a_t_e_v_e_r _i_t _m_a_y _b_e. The following begins a discussion of the effect of the commands. For each command, its effect depends on the current constellation of view direction and current language and takes into account the exigencies and implications of preservation of time order. Modes There are three modes for which it is important to know the current language and view direction direction, namely insert mode, command mode, and pattern/substitute mode. Actually, _v_i considers there to be only two modes, insert mode and command mode, with patterns and substitutions being given in command mode. _v_i._i_v treats patterns and substitutions slightly different from other commands; hence, it is convenient to them as being in a separate mode. Sun Release 4.1 Last change: February, 1990 8 VI.IV(L) LOCAL COMMANDS VI.IV(L) Cursor Before considering the details of each mode, it is necessary to explain the rules concerning the cursor's position. In command and pattern/substitute modes, the cursor is positioned over the currently considered character, namely the one to which the next command will apply. The cursor movement commands work relative to the screen rather than relative to the file contents. For example, hitting the left arrow key causes the cursor to move to the left on the screen even across a language change boundary; the cursor does not just move backwards in the file with attendant jumps when crossing language change boundaries. It was decided that equating cursor movement with movement within the file would be too confusing to the user. It is far easier for _v_i._i_v to map from the current cursor position to the right position in the file than for the user to map from the right position in the file to the corresponding position on the screen. For occasions in which movemement withing the file is desired, there are commands for moving forward and backwards in the file. Specifically, the v command is to move the cursor to the position of the next character in the file. The command V moves the cursor to the position of the previous character in the file. These commands are useful for dispelling confusion about the order of contents of the file. One simply moves the cursor to the beginning of the line, according to the current view direction, types v, and watches where the cursor goes. In insert mode, the cursor is always at the screen position that will receive the next character. Where this is relative to the previously entered character depends on the current language and the current view direction. After ESCAPEing from the insert mode, the cursor will move to be at the character after the last inserted character relative to the current view direction. Insert Mode The current language affects what is going into the file during insert mode. As mentioned, if the current language is LR, then the input is interpreted as coming from the standard Latin qwerty keyboard and the characters go into the file with the eighth bit off. If the current language is RL, then the input is interpreted as coming from the standard RL keyboard and the characters go into the file with the eighth bit on. The current language setting is global over the insert mode sessions. That is, if one exits and then re-enters insert Sun Release 4.1 Last change: February, 1990 9 VI.IV(L) LOCAL COMMANDS VI.IV(L) mode without having issued one of the language changing commands, then the current language after re-entry is the same as before exit. In insert mode, the current direction determines where the cursor starts after each new line and in which direction it moves. If the direction is LR, then the cursor starts at the left end and moves to the right. If the current direction is RL, then the cursor starts at the right end and moves to the left. In an LR view direction, the a command moves the cursor to the right of the current position to designate the position to receive the first inserted character. The i command moves the cursor to the left of the current position to designate the position to receive the first inserted character. Thereafter, as mentioned, the cursor moves or stays to be at the position to receive the next inserted character. Thus, if the current language is LR, the cursor moves to the right, and if the current language is RL, the cursor stays in the same position; in either case the text to the right of the cursor slides to the right. The rules for an RL view may be obtained by opposing each of left and right and R and L in the above. Below are some examples of insertions. In each case, three versions of the the state of the line being edited are shown after typing each character of the insertion. The three versions are the file contents, the LR view, and the RL view. In each screen view, the position of the cursor is marked with an underscore. For each step, the three versions occupies three consecutive lines, with the file contents to the far left, the LR view in the center, and the RL view to the far right. Between the three lines for each step is the next input character centered all by itself in the line. This scheme of showing the successive states during the input of an operation is followed for all the examples shown in the remainder of this manual. The initial state of the first example is: -|He said "" to Dan. |He said "_" to Dan. | |He said ""_ to Dan. | Now, suppose that the current language for input is RL, and the input is: aylem that is, to append ylem after the opening LR quote. The states are: Sun Release 4.1 Last change: February, 1990 10 VI.IV(L) LOCAL COMMANDS VI.IV(L) a -|He said "" to Dan. |He said ""_ to Dan. | |He said "_" to Dan. | y -|He said "y" to Dan. |He said "y_" to Dan. | |He said "_y" to Dan. | l -|He said "yl" to Dan. |He said "yl_" to Dan. | |He said "_yl" to Dan. | e -|He said "yle" to Dan. |He said "yle_" to Dan. | |He said "_yle" to Dan. | m -|He said "ylem" to Dan. |He said "ylem_" to Dan. | |He said "_ylem" to Dan. | -|He said "ylem" to Dan. |He said "y_lem" to Dan. | |He said "ylem_" to Dan. | Note that when the view direction runs counter to the normal direction of most of the text, the results are somewhat surprising. The RL views of the English sentence above were strange, especially after the Hebrew letters were introduced. The initial state of the second example is: -|de` `nx "" l`exi |de` `nx ""_ l`exi | |de` `nx "_" l`exi | The typed input is aHello The subsequent states are: a -|de` `nx "" l`exi |de` `nx "_" l`exi | |de` `nx ""_ l`exi | Sun Release 4.1 Last change: February, 1990 11 VI.IV(L) LOCAL COMMANDS VI.IV(L) H -|de` `nx "H" l`exi |de` `nx "_H" l`exi | |de` `nx "H_" l`exi | e -|de` `nx "He" l`exi |de` `nx "_He" l`exi | |de` `nx "He_" l`exi | l -|de` `nx "Hel" l`exi |de` `nx "_Hel" l`exi | |de` `nx "Hel_" l`exi | l -|de` `nx "Hell" l`exi |de` `nx "_Hell" l`exi | |de` `nx "Hell_" l`exi o -|de` `nx "Hello" l`exi |de` `nx "_Hello" l`exi | |de` `nx "Hello_" l`exi | -|de` `nx "Hello" l`exi |de` `nx "Hello_" l`exi | |de` `nx "H_ello" l`exi | In the case of an overwriting session of insert mode, from the issuance of an R command, the cursor moves in the current language's direction and stays over the next character to be changed. Giving a ^x during insert mode is equivalent to ESCAPEing to end the current insertion or overwriting, issuing ^x during command mode, and entering an append insertion in the other language at the point at which the cursor came to rest upon the ESCAPE. Note that if you were in an overwriting insert mode before the language change, you are no longer in an overwriting insert mode after the change. The reason for this is that with the direction change that happens with a language change, you would be overwriting what you had just entered as an overwrite. Bi-lingual Characters There are a number of characters that are in both languages. These are the digits, the punctuation symbols, and the space and tab characters. These characters exist in both the lower Sun Release 4.1 Last change: February, 1990 12 VI.IV(L) LOCAL COMMANDS VI.IV(L) and upper halves of the full eight-bit character set. The two codes for any such character have exactly the same lower order seven bits, and thus differ by exactly 128. When they are typed, they will go into the file with the eighth bit setting consistent with the current language direction. While the two codes for one of these characters are printed the same way on the screen, they cause different behavior under the rendering algorithm. As a result, the user that cannot remember under which language one of these characters is entered (It may not even have been entered by the same user!) may be surprised by the screen appearance after modifications and may not be able to predict the effects of modifications. For example, exchanging the order of inputting a space and changing langauge direction causes different screen appearances. Suppose the view direction is R-L. Suppose one has entered in time order an LR _t_r_o_f_f command with an RL argument. The time-ordered file contents are: -|.su_zwvix If the space between the u _a_n_d _t_h_e _z is in LR, then the screen appearance of the line is: |.su_zwvix | If, however, the space is in RL, then the screen appearance is: |.su_zwvix | As another example, again in an R-L view, the time-ordered file contents -|dgaxd Jones & Sons appears as |dgaxd Jones & Sons | if the & _a_n_d _t_h_e _s_p_a_c_e_s _s_u_r_r_o_u_n_d_i_n_g _i_t _a_r_e _i_n _L_R, _b_u_t _a_p_p_e_a_r_s _a_s |_d_g_a_x_d _J_o_n_e_s & _S_o_n_s | _i_f _t_h_e & and the spaces are in RL. In order to help the user not to get lost in these circumstances, it was decided to have an option under which _v_i._i_v would highlight the characters of the language whose direction opposes that of the current view. This Sun Release 4.1 Last change: February, 1990 13 VI.IV(L) LOCAL COMMANDS VI.IV(L) highlighting can be requested either from the invoking command line by adding the -MS _o_p_t_i_o_n _o_r _f_r_o_m _w_i_t_h_i_n _v_i._i_v _b_y _u_t_t_e_r_i_n_g _o_n_e _o_f: :_s_e_t _m_a_r_k_s_e_c_o_n_d_l_a_n_g :_s_e_t _m_a_r_k_s_l _T_h_i_s _h_i_g_h_l_i_g_h_t_i_n_g _i_s _d_o_n_e _b_y _w_h_a_t _e_v_e_r _m_e_t_h_o_d _o_f _h_i_g_h_l_i_g_h_t_i_n_g _i_s _o_f_f_e_r_e_d _b_y _t_h_e _c_u_r_r_e_n_t _t_e_r_m_i_n_a_l _a_s _i_n_d_i_c_a_t_e_d _b_y _t_h_e _c_u_r_r_e_n_t _t_e_r_m_c_a_p. _W_i_t_h _a_n _u_n_d_e_r_l_i_n_i_n_g _h_i_g_h_l_i_g_h_t_i_n_g _t_h_e _f_o_u_r _R-_L _v_i_e_w _e_x_a_m_p_l_e_s _a_b_o_v_e _w_o_u_l_d _a_p_p_e_a_r, _r_e_s_p_e_c_t_i_v_e_l_y, _a_s: |.__s__u___z_w_v_i_x | |.__s__u_ _z_w_v_i_x | |_d_g_a_x_d _J__o__n__e__s__&___S__o__n__s_ | |_d_g_a_x_d _J__o__n__e__s_ & _S__o__n__s_ | This feature should help the user keep track of numerals. If one wants a numeral to appear in the normal order, it must be entered either in L-R order as LR characters or in R-L order as RL characters. The presence or lack of underlining should remind the user which way the numerals were entered. These bi-lingual characters cause a problem to users when constructing search patterns. It is impossible, merely by looking at a printed copy of text or by listening to someone or one's mind pronounce some text, to know for sure under which language one of these characters was entered into the edited file. Therefore, it was decided to let any of these characters match itself in either language. Because the codes of the two languages' versions of one of these characters differ only in the eighth bit, it was easy to implement this modification to the search algorithm. Apart from the eighth bit cleaning, this change was the only one made to the editing command processor not directly for the purpose of implementing a new feature. Numerals In some right-to-left languages, e.g., Hebrew, numerals are written with the most significant digit on the left, i.e., from left to right. For these RL languages, entering numerals is problematic. If in RL language insertion mode, if the digits are entered in the order pronounced, i.e., most significant first, they will appear backwards on the screen. One way to insure that the numerals appear in the Sun Release 4.1 Last change: February, 1990 14 VI.IV(L) LOCAL COMMANDS VI.IV(L) normal order on the screen is to always switch language direction, with ^x, just before and just after entering the numeral, so that the numeral goes in as LR text. This way, the time ordering of the digits is from most to least significant. Another way, which is actually what Hebrew typists do with Hebrew, right-to-left typewriters, is to stay in the RL insertion mode and just enter the digits backwards. This way, however, the time ordering of the digits in the file is from least to most significant. Since many Hebrew typewriters provide upper case Latin letters with the shifted keys, the method of backwards entry is also used by many Hebrew typist for entering short sequences of upper case Latin letters (as opposed to changing typing element and typing direction). Entering numerals and upper case Latin letters occurs often enoough in entering Hebrew text, that it was decided to provided a special treatment for them as an option obtained by saying one of :set rlnumberuppercase :set rlnu Under this option, whenever in RL insertion mode, each time that a digit or an upper case character _C is entered, is is as though ^x _w_e_r_e _e_n_t_e_r_e_d _j_u_s_t _b_e_f_o_r_e _t_h_e _C _t_o _b_r_i_n_g _v_i._i_v _i_n_t_o _R_L _i_n_s_e_r_t_i_o_n _m_o_d_e. _v_i._i_v _s_t_a_y_s _i_n _t_h_e _R_L _i_n_s_e_r_t_i_o_n _m_o_d_e _u_n_t_i_l _t_h_e _f_i_r_s_t _s_u_b_s_e_q_u_e_n_t _s_p_a_c_e, _t_a_b, _o_r ^_x _i_s _e_n_t_e_r_e_d. _A_t _t_h_a_t _p_o_i_n_t, _v_i._i_v _r_e_t_u_r_n_s _t_o _R_L _e_n_t_r_y _m_o_d_e _a_n_d _a_c_c_e_p_t_s _t_h_e _s_p_a_c_e _o_r _t_a_b _a_s _h_a_v_i_n_g _b_e_e_n _e_n_t_e_r_e_d _a_s _a_n _R_L _l_a_n_g_u_a_g_e _c_h_a_r_a_c_t_e_r. Note that all characters entered under this automatically entered LR insertio mode go into the file in time order, as do _a_l_l characters, go into the file with the eighth bit off, and are displayed on the screen from left to right. Note also that one is not restricted to entering just digits or upper case Latin letters; once the LR insertion mode is entered, all characters in what would be considered one word are going in as LR characters. Thus, one can enter, for example, full arithmetic expressions, words of upper and lower case Latin letters beginning with an upper case letter, etc. It was simpler to implement the mode in this manner than to restrict it to model the usage of a Hebrew typewriter! Command Mode Commands are always given with an LR view and start off in the LR language, regardless of what is the current situation for the insert mode. This is because commands always begin with Latin letters. The language switching commands can be Sun Release 4.1 Last change: February, 1990 15 VI.IV(L) LOCAL COMMANDS VI.IV(L) issued during a command. The effect of such a change is strictly local to the command or pattern/substitute. The implication of always being in the LR language when starting a command is that if one exits a session of insert mode that was under the RL language and then desires to issue a command, one does not have to issue a language change to get _v_i._i_v to believe that the input is in the LR language; In command mode, in which one must be after an escape from input mode, _v_i._i_v automatically puts the terminal in LR mode if it can. If the terminal must be manually flipped to change language, _v_i._i_v does not ask for the manual flip; it simply translates the incoming character codes so that pressing the correct key for a latin letter is interpreted as that letter regardless of the actual code emitted by the key. (This is the only place where the fact that the terminal is a Hebrew as opposed to an Arabic terminal is critical; the translation is language dependent.) In either case, the user has nothing to do to get the command accepted in the LR language, and in the latter case he or she does not have the bother of manually flipping the terminal for only one character. After the command is done, the current direction and language reverts to what it was before entering the command, so that the behavior with respect to the surrounding sessions of insert mode is as if one had not even given a command. The above is slightly different if the first character of the command is in fact / _o_r ?. Then, in _v_i._i_v, one enters what is called pattern/substitute mode. Pattern/Substitute Mode Pattern and substitutes are always given with an LR view, since they are really special cases of commands, which are always given with an LR view. However, the current language of a pattern is the language corresponding the view direction of the last session of input mode. That is, if the view direction of the last session of input mode was RL, then the pattern starts off in the RL language. This choice is consistent with the observation that if the view direction of the last input is say, RL, then most characters that are input are going to be in the RL language and the most likely pattern that one is going to search for is also going to be in the RL language. In any case, the language of a pattern can be changed at any time during input of the pattern by issuing a ^x. After the pattern matching and substitution is done, the current direction and language reverts to what it was before entering the pattern/substitute, so that, again, the behavior with respect to the surrounding sessions of insert mode is as if one had not even given a command. Sun Release 4.1 Last change: February, 1990 16 VI.IV(L) LOCAL COMMANDS VI.IV(L) Metacharacters and Escapes In the pattern matching and substition subsystem, there are a number of characters that have special meaning either within patterns or within replacing text. For example, . in a search pattern matches any single character, and & in a replacement string causes interpolation of the string being replaced. In order to obtain the non-special meanings of these special characters, one may precede them with the _v_i escape character, the backslash, \. Thus, \. in a search pattern matches only ., and \& in a replacement string causes interpolation of &. To get the backslash character itself in a non-escaping use one simple doubles the character, a` la \\). The problem with this simple escaping scheme is that for some inexplicable reason, most Hebrew terminals simply do not have the backslash key! Moreover, in many of the switchable Latin-Hebrew terminals, when it is Hebrew mode, the backslash key does not work. Thus, in Hebrew mode, another character must be used. _v_i has assigned a meaning to every non-alphanumeric character. Therefore, there is no really convenient single character suited for this function, which might not be used heavily for other reasons, it was decided to make the so-called RL escape character settable with any of the following commands: :set backslashRL=_c :set bslRL=_c For example, to get ^ to be the RL escape character, one can say :set backslashRL=^ The default RL backslash character is !. _D_e_t_a_i_l_s _o_f _S_o_m_e _C_o_m_m_a_n_d_s _P_a_t_t_e_r_n _M_a_t_c_h_i_n_g A pattern, entered in time order, is matched against the contents of the file, stored in time order. This behavior, while simple to explain, easy to implement, and easy to apply, can produce surprising results. Suppose a line of the file (shown left to right) is: -|`ababcdefghicde Were it on the screen, its LR and RL view appearances would be: |`ababcdefghicde | |`ababcdefghicde | Sun Release 4.1 Last change: February, 1990 17 VI.IV(L) LOCAL COMMANDS VI.IV(L) The pattern /`ababc/ matches the first six characters of the line. However, those six consecutive characters are not adjacent on the screen. In any case the cursor ends up position at the first character `. _F_o_r _t_h_e _a_i_d _o_f _t_h_e _r_e_a_d_e_r _o_f _t_h_i_s _m_a_n_u_a_l, _t_h_e _m_a_t_c_h_e_d _c_h_a_r_a_c_t_e_r_s _a_r_e _m_a_r_k_e_d _w_i_t_h _a _h_y_p_h_e_n_s _u_n_d_e_r_n_e_a_t_h, _b_u_t _t_h_e_s_e _h_y_p_h_e_n_s _d_o _n_o_t _a_p_p_e_a_r _o_n _t_h_e _s_c_r_e_e_n. |`__a_b_a_b_c_d_e_f_g_h_i_c_d_e | 8 ------ 9 |`__a_b_a_b_c_d_e_f_g_h_i_c_d_e | 8 --- --- 9 _S_u_b_s_t_i_t_u_t_i_o_n The real impact of this behavior shows up when one does a substitution. The substitution follows the _v_i rules working on the pattern, the substititution, and the file contents _a_l_l _i_n _t_i_m_e _o_r_d_e_r. Under the same view direction and file contents as above, :s/`ababc/fghjkl/ causes the following changes: -|fghjkldefghicde |fghjkldefghicde | |fghjkldefghicde | The underlined characters got changed. On the other hand, :s/`ababc/jklfgh/ causes the changes: -|jklfghdefghicde |jklfghdefghicde | |jklfghdefghicde | While the pattern matching and substitution according to the time-ordered characters in the file may be easy to describe and, in fact, easy to implement, it may seem counter- intuitive especially when the matched and changed portions are not adjacent to each other on the screen. However, to pattern match and thus substitute according to what appears on the screen is fraught with a number of problems. Sun Release 4.1 Last change: February, 1990 18 VI.IV(L) LOCAL COMMANDS VI.IV(L) 1. Most of the time that one searches for a pattern it is to find something that is _n_o_t currently visible on the screen. In that case, searching according to appearance is inappropriate and searching according to time- ordered characters is really the only way that works. Suppose that in a previous editing session the line, de` `nx "Hello there Uri and Dan. How are you today?" l`exi ecpi`l were entered into the file. Under a RL view direction, assuming a screen width sufficiently large, it happens appear as |de` `nx "Hello there Uri and Dan. How are you today?" l`exi ecpi`l | on the screen, with today? _a_d_j_a_c_e_n_t _t_o `_n_x ". Now suppose that in this current session, it is desired to bring this sentence into the window. Is not the user more likely to remember that he or she typed something beginning with de` `nx "Hello and thus the pattern should be typed /de` `nx "Hello/ than that after it was typed it looked like |de` `nx "Hello there Uri and Dan. How are you today?" l`exi ecpi`l | and thus the pattern should be something like /de` `nx "today?/ ? 2. Searching by appearance contradicts the time-order orientation of the entire rest of _v_i._i_v. Adopting searching by appearance would just make the command language of _v_i._i_v not self-consistent and thus more complicated. 3. The search algorithm would have to construct the screen appearance of each line in the file before it could search in the line. This, of course, slows the search down considerably and moreover requires significant changes to the basic functional part of _v_i. Every change to the functional part of _v_i increases the danger that downward compatibility from _v_i._i_v to _v_i will be lost. Sun Release 4.1 Last change: February, 1990 19 VI.IV(L) LOCAL COMMANDS VI.IV(L) Thus searching according to time order is adopted. Indeed, in all of the commands, some of the effects of adherence to time order seem a bit surprising. However, in each case, a similar argument for adopting pure time-order semantics can be given. Deletion and Change Commands The apparent behavior of deletion is affected also. Suppose the three versions of line of the file are -|`ab cde abc def ghi fgh |`ab c_de abc def ghi fgh | |`ab c_de abc def ghi fgh | and the cursor is positioned under the c. Now, suppose that the command d2w is given with the intention of deleting two words. Then the result is: -|`ab def ghi fgh |`ab def ghi fgh | |`ab def ghi fgh | Back up now to the situation before the deletion. Suppose that the command c2wijkl jklm is given. Then the portion that was deleted above is actually changed. What is interesting is that this change is happening in real time and progresses through the file in time order. Below in four-line groups, are shown the file state and screen appearance after each successive character is typed replacing the two words by ijkl jklm. c2w -|`ab cde abc def ghi fgh |`ab c_de ab$ def ghi fgh | |`ab c_de ab$ def ghi fgh | i -|`ab ide abc def ghi fgh |`ab id_e ab$ def ghi fgh | |`ab id_e ab$ def ghi fgh | j -|`ab ije abc def ghi fgh |`ab ije_ ab$ def ghi fgh | |`ab ije_ ab$ def ghi fgh | k -|`ab ijk abc def ghi fgh Sun Release 4.1 Last change: February, 1990 20 VI.IV(L) LOCAL COMMANDS VI.IV(L) |`ab ijk_ab$ def ghi fgh | |`ab ijk_ab$ def ghi fgh | l -|`ab ijklabc def ghi fgh |`ab ijkla_b$ def ghi fgh | |`ab ijkla_b$ def ghi fgh | [] -|`ab ijkl bc def ghi fgh |`ab ijkl b_$ def ghi fgh | |`ab ijkl b_$ def ghi fgh | j -|`ab ijkl jc def ghi fgh |`ab ijkl j$_ def ghi fgh | |`ab ijkl j$_ def ghi fgh | k -|`ab ijkl jk def ghi fgh |`ab ijkl jk_def ghi fgh | |`ab ijkl jk_def ghi fgh | l -|`ab ijkl jkl def ghi fgh |`ab ijkl jkl_def ghi fgh | |`ab ijkl jkl_def ghi fgh | m -|`ab ijkl jklm def ghi fgh |`ab ijkl jklm_def ghi fgh | |`ab ijkl jklm_def ghi fgh | -|`ab ijkl jklm def ghi fgh |`ab ijkl jklm_ def ghi fgh | |`ab ijkl jklm_ def ghi fgh | Space limitations prevent a more complete set of examples. However, armed with the concepts of view direction, current language, and time order, and the rules about cursor position and the various modes, the reader should be able to deduce the expected behavior of any _v_i._i_v command. OPTIONS & COMMANDS Set Commands The following is a complete list of the :set commands available in _v_i._i_v that are not available in _v_i. Note that for every command Sun Release 4.1 Last change: February, 1990 21 VI.IV(L) LOCAL COMMANDS VI.IV(L) :set _X _o_f _t_y_p_e _t_o_g_g_l_e, _X _b_e_i_n_g _e_i_t_h_e_r _t_h_e _f_u_l_l _s_p_e_l_l_i_n_g _o_r _a_n _a_b_b_r_e_v_i_a_t_i_o_n _n_o_t _b_e_g_i_n_n_i_n_g _w_i_t_h _n_o, _t_h_e_r_e _i_s _a _c_o_m_m_a_n_d :_s_e_t _n_o_X _t_o _s_e_t _t_h_e _t_o_g_g_l_e _t_h_e _o_t_h_e_r _w_a_y. _O_p_t_i_o_n _A_b_b_r_e_v. _T_y_p_e _D_e_f_a_u_l_t_M_e_a_n_i_n_g _________________________________________________________________ 9 _r_i_g_h_t_l_e_f_t _r_l _t_o_g_g_l_e _n_o_r_l_c_h_a_n_g_e_s _t_h_e _v_i_e_w _o_f _t_h_e _e_d_i_t_i_n_g _s_e_s_s_i_o_n _t_o _R_L; _b_e_s_i_d_e_s _r_i_g_h_t _j_u_s_t_i_f_y_i_n_g _a_l_l _l_i_n_e_s _a_n_d _c_h_a_n_g_i_n_g _t_h_e _d_i_r_e_c_t_i_o_n _o_f _c_u_r_s_o_r _m_o_v_e_m_e_n_t, _i_t _i_s _a_r_r_a_n_g_e_d _t_h_a_t _t_h_e _n_e_x_t _i_n_s_e_r_t _m_o_d_e _w_i_l_l _b_e _R_L; _i_f _t_h_e _t_e_r_m_i_n_a_l _a_s _d_e_s_c_r_i_b_e_d _b_y _t_h_e _t_e_r_m_c_a_p _d_o_e_s _n_o_t _h_a_v_e _h_a_r_d_w_a_r_e _s_u_p_p_o_r_t _f_o_r _R_L _v_i_e_w_s, _p_r_o_c_e_s_s_i_n_g _i_s _s_l_o_w_e_d _d_o_w_n _a_s _r_i_g_h_t-_t_o-_l_e_f_t _o_p_e_r_a_t_i_o_n _i_s _s_i_m_u_l_a_t_e_d _b_y _b_r_u_t_e _f_o_r_c_e _s_c_r_e_e_n _r_e_d_r_a_w_i_n_g _l_e_f_t_r_i_g_h_t _l_r _t_o_g_g_l_e _l_r_r_l _m_e_a_n_s _n_o_l_r, _a_n_d _l_r _m_e_a_n_s _n_o_r_l _s_h_e_f_o_r_m_a_t _s_f _t_o_g_g_l_e _s_f_u_s_e_d _t_o _i_n_d_i_c_a_t_e _t_h_e _f_o_r_m_a_t _o_f _t_h_e _f_i_l_e _b_e_i_n_g _e_d_i_t_e_d; _t_h_e _c_h_a_r_a_c_t_e_r_s _o_f _a_n _s_f _f_i_l_e _a_r_e _s_t_o_r_e_d _i_n _t_i_m_e _o_r_d_e_r; _t_h_e _c_h_a_r_a_c_t_e_r_s _o_f _a _n_o_s_f _f_i_l_e _a_r_e _s_t_o_r_e_d _i_n _v_i_s_u_a_l _o_r_d_e_r; _n_o_s_f _f_i_l_e_s _a_r_e _g_e_n_e_r_a_l_l_y _t_h_o_s_e _t_h_a_t _w_e_r_e _c_r_e_a_t_e_d _o_r_i_g_i_n_a_l_l_y _w_i_t_h _v_i_h(_1) _c_h_a_n_g_e_l_a_n_g _s_t_r_i_n_g ^_x_u_s_e_d _t_o _s_e_t _t_h_e _c_h_a_r_a_c_t_e_r _t_h_a_t _i_n_d_i_c_a_t_e_s _a _c_h_a_n_g_e _i_n _t_h_e _l_a_n_g_u_a_g_e _a_n_d _d_i_r_e_c_t_i_o_n _o_f _i_n_s_e_r_t _m_o_d_e_s _b_a_c_k_s_l_a_s_h_R_L _b_s_R_L _s_t_r_i_n_g !_u_s_e_d _t_o _s_e_t _t_h_e _c_h_a_r_a_c_t_e_r _t_h_a_t _s_e_r_v_e_s _a_s Sun Release 4.1 Last change: February, 1990 22 9 VI.IV(L) LOCAL COMMANDS VI.IV(L) _t_h_e _e_s_c_a_p_e _m_e_t_a_c_h_a_r_a_c_t_e_r _i_n _p_a_t_t_e_r_n_s _a_n_d _s_u_b_s_t_i_t_u_t_i_o_n_s _r_l_n_u_m_b_e_r_u_p_p_e_r_c_a_s_e _r_l_n_u _t_o_g_g_l_e _n_o_r_l_n_u_i_n_d_i_c_a_t_e_s _t_h_a_t _d_u_r_i_n_g _R_L _i_n_s_e_r_t _m_o_d_e, _e_n_t_r_y _o_f _a _d_i_g_i_t _o_r _u_p_p_e_r _c_a_s_e _L_a_t_i_n _l_e_t_t_e_r _a_n_d _a_l_l _c_h_a_r_a_c_t_e_r_s _u_p _t_o _b_u_t _n_o_t _i_n_c_l_u_d_i_n_g _t_h_e _n_e_x_t _b_l_a_n_k _o_r _t_a_b _i_s _d_o_n_e _i_n _L_R _i_n_s_e_r_t _m_o_d_e; _t_h_i_s _a_u_t_o_m_a_t_i_c _L_R _i_n_s_e_r_t _m_o_d_e _i_s _a_l_s_o _e_x_i_t_e_d _b_y _e_n_t_r_y _o_f _w_h_e_t_e_v_e_r _i_s _t_h_e _l_a_n_g_u_a_g_e _c_h_a_n_g_e _c_h_a_r_a_c_t_e_r, _e._g., ^_x _m_a_r_k_s_e_c_o_n_d_l_a_n_g _m_a_r_k_s_l _t_o_g_g_l_e _n_o_m_a_r_k_s_l_i_n_d_i_c_a_t_e_s _t_h_a_t _a_l_l _t_e_x_t _i_n _t_h_e _c_u_r_r_e_n_t _s_e_c_o_n_d_a_r_y _l_a_n_g_u_a_g_e _s_h_o_u_l_d _b_e _m_a_r_k_e_d _b_y _w_h_a_t_e_v_e_r _h_i_g_h_l_i_g_h_t_i_n_g _i_s _a_v_a_i_l_a_b_l_e _a_c_c_o_r_d_i_n_g _t_o _t_h_e _t_e_r_m_c_a_p; _t_h_e _s_e_c_o_n_d_a_r_y _l_a_n_g_u_a_g_e _i_s _t_h_a_t _w_h_o_s_e _d_i_r_e_c_t_i_o_n _i_s _o_p_p_o_s_i_t_e _t_h_a_t _o_f _t_h_e _c_u_r_r_e_n_t _v_i_e_w _T_h_e_s_e :_s_e_t _c_o_m_m_a_n_d_s _c_a_n _b_e _g_i_v_e_n _a_l_s_o _i_n _t_h_e ._e_x_r_c (_o_r ._e_x_r_c_i_v) _f_i_l_e _o_r _i_n _t_h_e _v_a_l_u_e _o_f _t_h_e _E_X_I_N_I_T (_o_r _E_X_I_N_I_T_I_V) _s_h_e_l_l _v_a_r_i_a_b_l_e, _b_u_t _w_i_t_h_o_u_t _t_h_e _p_r_e_c_e_d_i_n_g _c_o_l_o_n, _t_o _c_a_u_s_e _t_h_e_i_r _b_e_i_n_g _e_x_e_c_u_t_e_d _a_s _v_i._i_v _i_s _s_t_a_r_t_i_n_g _u_p. _O_t_h_e_r _C_o_m_m_a_n_d_s ^x _t_o_g_g_l_e_s _t_h_e _i_n_s_e_r_t_i_o_n _m_o_d_e _b_e_t_w_e_e_n _L_R & _R_L. _Y_o_u _c_a_n _s_p_e_c_i_f_y _a_n_o_t_h_e_r _c_h_a_r_a_c_t_e_r _t_o _d_o _t_h_i_s _v_i_a _t_h_e :_s_e_t _c_h_a_n_g_e_l_a_n_g command. v goes to the next character based on the order stored in the file (as opposed to the order it is displayed on the screen). V goes to the previous character. Command Line Options The _v_i._i_v command line options alluded to in the synopsis are as follows. Sun Release 4.1 Last change: February, 1990 23 VI.IV(L) LOCAL COMMANDS VI.IV(L) OptionMeaning _________________________________________________________________ 9 -S _t_e_l_l_s _v_i._i_v _t_o _t_r_e_a_t _t_h_e _e_d_i_t_e_d _f_i_l_e _a_s _b_e_i_n_g _s_t_o_r_e_d _i_n _v_i_s_u_a_l _o_r_d_e_r _i_n_s_t_e_a_d _o_f _t_i_m_e _o_r_d_e_r, _e._g., _a_s _h_a_v_i_n_g _b_e_e_n _c_r_e_a_t_e_d _b_y _v_i_h(_1); _n_o_t_e _t_h_a_t _o_n_c_e _a _f_i_l_e _i_s _i_n _a_n_y _p_a_r_t_i_c_u_l_a_r _o_r_d_e_r, _v_i._i_v _c_a_n_n_o_t _b_e _u_s_e_d _t_o _p_u_t _i_t _i_n _t_h_e _o_t_h_e_r _o_r_d_e_r -_M_S _t_e_l_l_s _v_i._i_v _t_o _d_o :_s_e_t _m_a_r_k_s_l _a_s _i_t _s_t_a_r_t_s _u_p -_L_R _t_e_l_l_s _v_i._i_v _t_o _d_o :_s_e_t _l_r _a_s _i_t _s_t_a_r_t_s _u_p -_R_L _t_e_l_l_s _v_i._i_v _t_o _d_o :_s_e_t _r_l _a_s _i_t _s_t_a_r_t_s _u_p _C_l_e_a_r_l_y, -_L_R _a_n_d -_R_L _a_r_e _m_u_t_u_a_l_l_y _e_x_c_l_u_s_i_v_e, _a_n_d _t_h_e _l_a_s_t _o_f _t_h_e_s_e _t_h_a_t _a_p_p_e_a_r_s _i_n _t_h_e _c_o_m_m_a_n_d _l_i_n_e _i_s _t_h_e _o_n_e _w_h_o_s_e _e_f_f_e_c_t _i_s _f_i_n_a_l_l_y _f_e_l_t _a_s _t_h_e _e_d_i_t_i_n_g _s_e_s_s_i_o_n _b_e_g_i_n_s. THE TECHNION COMPUTER SCIENCE FACULTY INSTALLATION This section deals with information specific to the installation of _v_i._i_v at the Computer Science Faculty of the Technion. Environment Currently, this installation of _v_i._i_v uses its own private _t_e_r_m_c_a_p(5) file (see the FILES section below). Thus, it does not matter what the TERMCAP environment variable is set to, or even if it is set at all. This might change in future versions. _V_i._i_v uses the TERMIV environment variable to determine which entry to use; current possible values (as of 24/04/90) are: _v_t_1_0_0_i_v DEC vt100-compatible terminal _v_i_1_0_0_i_v Visual terminal _s_u_n_i_v Sun terminal (via _v_t_h_t_o_o_l(l) or _h_v_t_1_0_0(l)) You should check the _t_e_r_m_c_a_p(5) file that _v_i._i_v uses for the most up-to-date list of terminal types (see the FILES section for which _t_e_r_m_c_a_p(5) file is used). If TERMIV is not set, _v_i._i_v will attempt to set it based on the current value of TERM. However, this will not work on a Sun screen, as explained below. This automatic setting of TERMIV might change or be deleted in future versions. Running vi.iv on a Sun Terminal 9 Sun Release 4.1 Last change: February, 1990 24 VI.IV(L) LOCAL COMMANDS VI.IV(L) First, you start up a windowing system (e.g., _S_u_n_V_i_e_w or _X). Then, you must run a terminal emulator that can display both Hebrew (or whichever right-to-light language that you want) & English. Under _S_u_n_V_i_e_w, you can run _v_t_h_t_o_o_l(l); under _X, you can run _h_v_t_1_0_0(l). See the manuals for these commands for more information. When you run _v_i._i_v via _v_t_h_t_o_o_l(l), the mouse-driven arrow keys will work, but the keyboard arrow keys will not. You can, however, make the keyboard arrow keys work with the following map commands: map [A k map [B j map [D h map [C l You enter the escape character () by typing ^V, then . It will be echoed as ^[. Startup Commands _V_i._i_v uses the file ._e_x_r_c and the environment variable EXINIT in the same way & the same precedence as _v_i(1), except: (1) If there is a file named ._e_x_r_c_i_v, it will take precedence over ._e_x_r_c. (2) If there is an environment variable named EXINITIV, it will take precedence over EXINIT. This scheme allows one to have separate startup commands for _s_h_e_f(5) files if desired, or to use the same startup commands for both pure _a_s_c_i_i(5) and _s_h_e_f(5) files. Printing This Manual To print this manual, first copy the file /_u_s_r/_m_a_n/_m_a_n_l/_v_i._i_v._l to your directory, then type the command ditroff -FOF -P_p_r_i_n_t_e_r vi.iv.l However, please do so sparingly. This is a long manual (more than 17 pages!). Also, please remember to delete your local copy of the manual when done in order to save disk space. TERMCAP FIELDS In addition to the standard _t_e_r_m_c_a_p(5) fields used by _v_i(1), _v_i._i_v uses new termcap fields for its Hebrew capabilities. These are listed below. They all represent strings that are Sun Release 4.1 Last change: February, 1990 25 VI.IV(L) LOCAL COMMANDS VI.IV(L) sent to the terminal to control actions. Field Description 8 _____ ___________________________________________________ _e_g Change to left-to-right cursor motion _h_e Change to right-to-left cursor motion _h_n Hebrew character set on _h_f Hebrew character set off (i.e., English characters) Note that some of these field names are used by _v_i_h(l) for different functions, so that you cannot use the same termcap entry for both editors. FILES /usr/local/lib/vi.iv/termcap private terminal capabilities database SEE ALSO _e_x(1), _v_i(1), _e_d_i_t(1), Vi Quick Reference card, An Introduction to Display Editing with Vi by William Joy. _v_i._i_v, a Bi-directional Version of the _v_i Full-Screen Editor, by Uri Habusha and Daniel M. Berry. _e_s_c_i_i(7), _s_h_e_f(5), _s_h_e_f_f(l), _v_t_h_t_o_o_l(l), _h_v_t_1_0_0(l), _t_e_r_m_c_a_p(5). AUTHOR William Joy wrote _v_i Mark Horton added macros to _v_i's _v_i_s_u_a_l _m_o_d_e. _U_r_i _H_a_b_u_s_h_a _m_a_d_e _v_i bi-directional to become _v_i._i_v. Yael Dubinsky & Haim Roman installed _v_i._i_v on the Computer Science Department's Sun-4. BUGS The following are bugs of _v_i._i_v: The 'c' & 's' commands reverse the order of secondary language strings (e.g., if you are viewing in RL mode, it reverses the LR strings). Worse, you might not see this effect until you type ^L. It is suggested that first you delete, then insert (or append). When you replace a line by the cc command, _v_i._i_v inserts another line from somewhere else in the file after the cursor. This extra text remains even after you type ^L. _T_h_e _w_a_y _a_r_o_u_n_d _t_h_i_s _i_s _t_o _g_o _t_o _t_h_e _f_i_r_s_t _c_h_a_r_a_c_t_e_r _i_n _t_h_e _l_i_n_e _a_n_d _d_o _c$. When you enter an RL string to search for, _v_i._i_v acts as if _r_l_n_u is set, whether or not it really is. When you type :quit when you haven't saved your edits, _v_i._i_v re-displays the screen contents. When in LR view, this is OK. But when in RL view, it displays the contents in LR Sun Release 4.1 Last change: February, 1990 26 9 VI.IV(L) LOCAL COMMANDS VI.IV(L) view, without erasing the current display, resulting in a mess. However, ^L _t_a_k_e_s _c_a_r_e _o_f _t_h_i_s. When doing the I _v_i_s_u_a_l-_m_o_d_e _c_o_m_m_a_n_d, _m_a_k_e _s_u_r_e _t_h_a_t _t_h_e _i_n_s_e_r_t _m_o_d_e _i_s _t_h_e _s_a_m_e _a_s _t_h_e _v_i_e_w. _I_f _n_o_t, _t_h_e _i_n_s_e_r_t _m_a_y _s_t_a_r_t _a_t _t_h_e _s_e_c_o_n_d column of the line. Tabs at the beginning of the line are not always properly handled during insert, especially if you delete them or type ^D. However, typing or ^L will restore the correct display. You cannot use the same termcap entry for both _v_i_h(l) and _v_i._i_v. When you switch to line-mode (Q command), the : prompt does not appear. The text in the command line at the bottom of the screen sometimes rolls up into the main text area of the screen. ^L removes it. The delete to beginning of line command in insert mode (^U) only deletes as far as where the text changes language (if it does in the current line). The following bugs are all inherited from _v_i and are kept because they have become features already: 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 don't make use of insert and delete character operations in the terminal. The _w_r_a_p_m_a_r_g_i_n option can be fooled since 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 won't be broken. Insert/delete within a line can be slow if tabs are present on intelligent 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 more than one Sun Release 4.1 Last change: February, 1990 27 VI.IV(L) LOCAL COMMANDS VI.IV(L) line of input to a : escape. To use these on a :global you must Q to _e_x _c_o_m_m_a_n_d _m_o_d_e, _e_x_e_c_u_t_e _t_h_e_m, _a_n_d _t_h_e_n _r_e_e_n_t_e_r _t_h_e _s_c_r_e_e_n _e_d_i_t_o_r _w_i_t_h _v_i or _o_p_e_n. Sun Release 4.1 Last change: February, 1990 28