


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,  <NEWL> represents a new-line
     character or a carriage return  respectively,  ^  represents
     pressing   CONTROL   simultaneously   with   the   following
     character, <ESC> 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<ESC>

     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.        |

                                <ESC>
     -|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<ESC>

     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              |

                                <ESC>
     -|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<NEWL>

     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<NEWL>
                    |fghjkldefghicde               |
     |fghjkldefghicde               |

     The underlined characters got changed. On the other hand,

          :s/`ababc/jklfgh/

     causes the changes:

     -|jklfghdefghicde<NEWL>
                    |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<NEWL>
                    |`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<NEWL>
                    |`ab def ghi fgh               |
     |`ab def ghi fgh               |

     Back up now to the situation before  the  deletion.  Suppose
     that the command

          c2wijkl jklm<ESC>

     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<NEWL>
                    |`ab c_de ab$ def ghi fgh       |
     |`ab c_de ab$ def ghi fgh       |

                                  i
     -|`ab ide abc def ghi fgh<NEWL>
                    |`ab id_e ab$ def ghi fgh       |
     |`ab id_e ab$ def ghi fgh       |

                                  j
     -|`ab ije abc def ghi fgh<NEWL>
                    |`ab ije_ ab$ def ghi fgh       |
     |`ab ije_ ab$ def ghi fgh       |

                                  k
     -|`ab ijk abc def ghi fgh<NEWL>



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<NEWL>
                    |`ab ijkla_b$ def ghi fgh       |
     |`ab ijkla_b$ def ghi fgh       |

                                  []
     -|`ab ijkl bc def ghi fgh<NEWL>
                    |`ab ijkl b_$ def ghi fgh       |
     |`ab ijkl b_$ def ghi fgh       |

                                  j
     -|`ab ijkl jc def ghi fgh<NEWL>
                    |`ab ijkl j$_ def ghi fgh       |
     |`ab ijkl j$_ def ghi fgh       |

                                  k
     -|`ab ijkl jk def ghi fgh<NEWL>
                    |`ab ijkl jk_def ghi fgh       |
     |`ab ijkl jk_def ghi fgh       |

                                  l
     -|`ab ijkl jkl def ghi fgh<NEWL>
                    |`ab ijkl jkl_def ghi fgh      |
     |`ab ijkl jkl_def ghi fgh      |

                                  m
     -|`ab ijkl jklm def ghi fgh<NEWL>
                    |`ab ijkl jklm_def ghi fgh     |
     |`ab ijkl jklm_def ghi fgh     |

                                <ESC>
     -|`ab ijkl jklm def ghi fgh<NEWL>
                    |`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 <ESC>[A k
                            map <ESC>[B j
                            map <ESC>[D h
                            map <ESC>[C l

     You enter the escape character (<ESC>) by  typing  ^V,  then
     <ESC>.  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 <ESC> 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


