home *** CD-ROM | disk | FTP | other *** search
File List | 1992-07-28 | 24.1 KB | 661 lines |
-
-
-
-
-
-
-
-
-
- Summary of Differences between Vi and Xvi
-
-
- Chris Downey
- John Downey
-
-
-
- Xvi (pronounced _e_c_k_s-_v_e_e-_e_y_e) is a free, portable,
- multi-window implementation of the popular UNIX|- editor
- vi.
-
- This document summarises the differences between the
- ``real'' vi and xvi. These differences are divided
- into three groups: _u_n_i_m_p_l_e_m_e_n_t_e_d _f_e_a_t_u_r_e_s, _d_i_f_f_e_r_e_n_c_e_s
- and _e_n_h_a_n_c_e_m_e_n_t_s, and each of these is described in the
- following sections.
-
-
-
- _1. _U_n_i_m_p_l_e_m_e_n_t_e_d _F_e_a_t_u_r_e_s
-
- _1._1. _E_x _M_o_d_e
-
- The main area in which xvi is lacking is vi's _e_x mode, which is
- not implemented at all (and neither are edit, e, and open modes).
- However, many of the ex commands are available in xvi as colon
- commands; the colon commands that have not been implemented are
- mostly those which offer the same functionality as other commands
- in vi mode.
-
- Specifically, the following ex commands are not implemented, and
- probably never will be within xvi:
-
- _i_n_s_e_r_t _u_n_d_o _e_x
- _c_h_a_n_g_e _o_p_e_n |
- _a_p_p_e_n_d _z
-
- while these ex commands, although not currently implemented, may
- be added as colon commands at some time in the future:
-
- _a_b_b_r_e_v_i_a_t_e _r_e_c_o_v_e_r _w_r_i_t_e>>
- _u_n_a_b_b_r_e_v_i_a_t_e _j_o_i_n
-
-
-
-
-
-
- _________________________
- |- UNIX is a trademark of Bell Laboratories.
-
-
-
- _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _1
-
-
-
-
-
- _2 _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i
-
-
- _1._2. _V_i _c_o_m_m_a_n_d_s
-
- The following vi mode commands are not implemented, although
- there is no real reason why they shouldn't be:
-
- _U =
-
- while this one is inappropriate in the context of xvi, since
- there is no _e_x mode:
-
- _Q
-
-
- _1._3. _P_a_r_a_m_e_t_e_r_s
-
- The following parameters have not been implemented, and probably
- won't be:
-
- _a_d_a _l_i_s_p _r_e_d_r_a_w
- _a_d_a_p_a_t_h _m_e_s_g _s_l_o_w_o_p_e_n
- _a_u_t_o_p_r_i_n_t _m_o_d_e_l_i_n_e _t_e_r_m
- _b_e_a_u_t_i_f_y _o_p_e_n _t_e_r_s_e
- _d_i_r_e_c_t_o_r_y _o_p_t_i_m_i_z_e _t_t_y_t_y_p_e
- _e_d_c_o_m_p_a_t_i_b_l_e _p_r_o_m_p_t _w_i_n_d_o_w
- _h_a_r_d_t_a_b_s
-
- while these parameters may well be implemented at some point:
-
- _a_u_t_o_w_r_i_t_e _s_c_r_o_l_l _w_a_r_n
- _e_r_r_o_r_b_e_l_l_s _s_o_u_r_c_e_a_n_y _w_r_i_t_e_a_n_y
-
-
- _1._4. _M_i_s_c_e_l_l_a_n_e_o_u_s
-
- Some features of certain commands do not work as they should.
- Specifically:
-
- o+ Repeat counts before insertions don't work.
-
- o+ Appending to named buffers is not yet implemented.
-
- o+ Typing ^Q in input mode does not mean the same as ^V; it
- just inserts a `^Q', assuming it gets as far as the editor
- at all.
-
- o+ Typing ^W in insert mode does not back up one word as in vi.
-
- o+ It is not possible to interrupt the editor while it is
- performing certain operations. If you start off a big
- global command, you have to wait for it to finish.
-
- o+ Flags and counts after colon commands are not supported.
-
-
-
-
-
- _P_a_g_e _2 _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
-
-
-
-
-
- _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i _3
-
-
-
- o+ It is not possible to read the output of a system command
- using
-
- :r !_c_o_m_m_a_n_d
-
- or to write into a command using
-
- :w !_c_o_m_m_a_n_d
-
-
- o+ The :substitute command does not support splitting of lines.
-
- o+ Regular expressions, although implemented (see later for
- more details), do not support the ~ character; also, the \u
- and \l escape sequences are not supported on the right-hand
- side of a substitute replacement pattern.
-
- o+ The :global command only supports the commands [lps&~d].
-
- o+ Undo does not work properly when applied to macros (either @
- or :map); it should undo all the changes made by the macro,
- but in fact only the last command within the macro is
- undone.
-
- _2. _E_n_h_a_n_c_e_m_e_n_t_s
-
- The following extensions are available in xvi.
-
- _2._1. _P_a_r_a_m_e_t_e_r _H_a_n_d_l_i_n_g
-
- Xvi supports 5 types of parameter: as well as vi's _n_u_m_e_r_i_c,
- _s_t_r_i_n_g and _b_o_o_l_e_a_n, it also has _e_n_u_m_e_r_a_t_e_d and _l_i_s_t types. The
- former is used for e.g. format and regextype, while the latter is
- currently only used for tags. The advantage of the _e_n_u_m_e_r_a_t_e_d
- type is that if you try to set an illegal value, the set of
- correct values will be displayed, which is very useful if you
- have forgotten what the values may be. (Try :set preserve to see
- an example of this.)
-
- _2._2. _W_i_n_d_o_w_s
-
- Xvi supports multiple _b_u_f_f_e_r_s and _w_i_n_d_o_w_s. A _b_u_f_f_e_r is the
- object which holds a file in memory, while a _w_i_n_d_o_w is an area of
- the screen which shows part of a buffer. Note that every window
- references a buffer, even if no file is being edited.
-
- The following commands are available for operating on buffers and
- windows:
-
- :buffer create a new buffer in a new window; can be followed by
- a filename, which will be edited in the new buffer.
-
- :split create a new window onto the current buffer by
- splitting the current window in half. The two
-
-
- _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _3
-
-
-
-
-
- _4 _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i
-
-
- resulting windows are similar to _v_i_e_w_p_o_r_t_s on to a
- single editing buffer, in that changes made in one
- window are reflected in the other one.
-
- :close close the current window; will also close the buffer if
- this is the last window onto it.
-
- :x / ZZ close only the current window. If the window is the
- only one onto the buffer, the buffer will be closed as
- well, writing it first if it is modified. Hence, for a
- single window, this command does the same as in vi.
-
- g move to the next window. This is normally the window
- directly below the current one on the screen, or the
- top window on the screen if the current window is the
- bottom one.
-
- ^W increase the size of the current window (may be given a
- numeric prefix, default is one line).
-
- ^T decrease the size of the current window (may be given a
- numeric prefix, default is one line).
-
- ^O make the current window as large as possible.
-
- ^] as for vi, but creates a new buffer window if
- appropriate (and if autosplit allows).
-
- Note that the :quit command quits out of the editor, not out of a
- window. The :close command is thus the equivalent of :quit for
- windows. There is no equivalent of :x or ZZ for the whole
- editor; these have been hijacked for operations on windows.
-
- Also the numeric autosplit parameter specifies the maximum number
- of buffer windows that will be created automatically whenever you
- either edit more than one file, or use tags to edit a different
- file.
-
- Undo works per buffer, as do marks; yank/put and redo (the .
- command) work over all buffers, i.e. you can delete from one
- buffer and put the text into a different buffer.
-
- The minrows parameter specifies the minimum number of rows to
- which a window may be shrunk, including the status line. The
- default value is 2; 0 and 1 may also be useful.
-
- _2._3. _N_a_m_e_d _B_u_f_f_e_r_s
-
- As well as the normal named (conjugate) buffers, and the default
- one named @, several extra buffers named :, /, ? and ! contain
- the last command lines entered for each of the command types. So
- for instance, @: will re-execute the last colon command, or you
- can insert it into your buffer, edit it and then re-execute it
- (e.g. with _d_d@@).
-
-
-
- _P_a_g_e _4 _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
-
-
-
-
-
- _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i _5
-
-
-
- _2._4. _F_i_l_e _F_o_r_m_a_t_s
-
- Xvi will handle different file formats, via the format parameter,
- which may be set to e.g. "unix", "msdos", etc. This means you
- can edit MS-DOS files under UNIX, etc.
-
- _2._5. _R_e_g_u_l_a_r _E_x_p_r_e_s_s_i_o_n_s
-
- Vi's magic parameter is replaced by the regextype parameter,
- which can take the following values:
-
- tags only ^ and $ are significant (used for tags).
-
- grep like _g_r_e_p(1), but with _\< and _\> added.
-
- egrep like _e_g_r_e_p(1), but with _\< and _\> added.
-
- The default is _g_r_e_p.
-
- The sections and paragraphs parameters define _e_g_r_e_p-style
- patterns to search for, rather than _v_i's simplistic (and _t_r_o_f_f-
- dependent) character pairs.
-
- The sentences parameter is also implemented in this fashion, but
- this is not completely satisfactory at the moment.
-
- Note that it is possible to set or unset the magic parameter as
- in vi; this will simply result in the regextype parameter being
- set as appropriate.
-
- _2._6. _C_o_l_o_u_r
-
- Xvi has a minimal amount of support for colours. Basically,
- there are considered to be four settable colours, each with a
- numeric parameter to say what its value is:
-
- colour colour used for text
-
- statuscolour colour used for status lines
-
- roscolour as statuscolour, but for readonly files
-
- systemcolour colour used for system mode (i.e. subshells and
- after termination).
-
- The actual values of these parameters are system-dependent; on PC
- versions, they are hardware-dependent video attributes, while on
- UNIX they are indexes into the entries ``c0'' to ``c9'' in the
- _t_e_r_m_c_a_p(5) database, which are assumed to be colour-setting
- escape sequences if they are present. If they are not present,
- "so" (begin standout mode) and "se" (end standout mode) are used
- instead. Values of 0 and 1 give normal text, 2 to 9 give
- standout mode.
-
-
-
- _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _5
-
-
-
-
-
- _6 _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i
-
-
- The default colour for the roscolour parameter will usually
- involve red if colours are available; this is intended to provide
- a warning to the user that writing the file may not be possible.
-
- The colour values may be entered in decimal, octal or hexadecimal
- form. This may be convenient for PC versions where the numbers
- actually represent colour bitmaps; for example, on MS-DOS,
-
- :_s_e_t _c_o=_0_x_1_f
-
- gives bright white text on a blue background.
-
- _2._7. _R_e_p_l_a_c_e _M_o_d_e
-
- Xvi's _r_e_p_l_a_c_e mode (entered by the R command) acts more
- intelligently when you press the return key - it leaves the rest
- of the current line alone, and just starts replacing text on the
- next line, starting at the screen column where you first typed R.
-
- _2._8. _P_r_e_s_e_r_v_e
-
- Rather than use vi's UNIX-specific method for preservation, xvi
- does periodic preservation of all files currently being edited
- into a temporary file in the same directory. Xvi tries to do
- this when you are not typing, so that you won't notice the short
- delay when the temporary file is written out. Obviously, only
- changed files are preserved in this way, and the temporary file
- is normally removed once the real file has been successfully
- written. As an additional safety measure, when a file is
- explicitly saved and it appears not to have been preserved
- recently, it is normally preserved first. This ensures that,
- even if the operating system crashes while the real file is being
- created, there should always be at least one recent copy of it in
- the filesystem. The :preserve command is available as in vi to
- preserve a specific buffer manually.
-
- The level of safety provided by the preservation facility may be
- configured by changing the values of the _p_r_e_s_e_r_v_e and
- _p_r_e_s_e_r_v_e_t_i_m_e parameters. The following values are available for
- _p_r_e_s_e_r_v_e:
-
- unsafe Never preserve any buffer before an explicit save.
- This can be useful on old, slow, floppy-only systems,
- but is not generally recommended.
-
- standard The default value. Only preserve a buffer before an
- explicit save if it appears not to have been preserved
- recently.
-
- safe Always preserve buffers before they are written.
-
- paranoid As for safe, but the preserve file is never removed,
- even after the file has been successfully written.
-
- In all cases, all modified buffers are preserved automatically
-
-
- _P_a_g_e _6 _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
-
-
-
-
-
- _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i _7
-
-
- after no user events have been received for _p_r_e_s_e_r_v_e_t_i_m_e seconds,
- if a minimum number of events (currently 60) have been received
- since the last automatic preservation. This behaviour can be
- more or less disabled by setting _p_r_e_s_e_r_v_e_t_i_m_e to a very high
- value. (For example, one of the authors sets it to 600 on the
- machine he uses at home, which is an 8088-based PC with no hard
- disk; by way of contrast, on the SparcStation IPX which he uses
- at work, he sets it to 2.)
-
- The names given to preserve files are system-dependent, but are
- generally of the form "_f_i_l_e_n_a_m_e.tmp", or "_f_i_l_e_n_a_m_e.001" to
- "_f_i_l_e_n_a_m_e.999". If a preserve file already exists, it will not
- be overwritten; instead, a new filename will be generated.
-
- The -r command line option is not supported.
-
- _2._9. _H_e_l_p
-
- A primitive help facility is available; the command :help, also
- mapped to the HELP or F1 keys on many systems, simply creates a
- new buffer window onto a standard help file. The name of the
- file which is edited is given by the helpfile string parameter;
- the default on Unix versions is "/usr/lib/xvi.help".
-
- _2._1_0. _S_c_r_o_l_l_i_n_g
-
- The _j_u_m_p_s_c_r_o_l_l enumerated parameter controls the editor's
- behaviour when the cursor moves beyond the limits of the current
- window. If its value is _o_f_f, and the new position is still
- reasonably close to the current window, the window will be
- scrolled so that the new cursor position is at the top or bottom
- of it. Typically, the window will be scrolled one line at a time
- as the cursor is moved up or down. This behaviour may not always
- be desirable; for example, terminals without real scrolling
- regions may force the editor to do a lot of screen updating,
- possibly over a slow telephone line or overloaded network. Also,
- on LCD screens or other displays with a long image persistence,
- it may make the text more difficult to read. If _j_u_m_p_s_c_r_o_l_l is
- set to _o_n, scrolling behaviour is modified so that, whenever the
- cursor moves beyond the limits of the current window, the window
- is redrawn so as to place the cursor as centrally as possible in
- it; thus, the window appears to _j_u_m_p to the new position. The
- default value for _j_u_m_p_s_c_r_o_l_l is auto, which causes the editor to
- jump instead of scrolling only if it can't scroll the affected
- window efficiently.
-
- In all cases, if the distance from the top or bottom of the
- window to the new position is more than half the window size, the
- editor will jump instead of scrolling.
-
- Explicit scroll commands (e.g. ^D) are not affected by the
- jumpscroll parameter.
-
-
-
-
-
- _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _7
-
-
-
-
-
- _8 _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i
-
-
-
- _2._1_1. _8-_b_i_t _C_h_a_r_a_c_t_e_r_s
-
- Characters with the top bit set may be displayed, although it is
- not yet possible to have null ('\0') bytes in a file buffer. How
- the characters are displayed varies between systems; on UNIX,
- they will be shown as an octal escape sequence, while on MS-DOS,
- OS/2 and QNX they will be shown as the actual character in the PC
- character set. This can be controlled by setting the cchars and
- mchars variables; if these parameters are set, control- and
- meta-characters (respectively) are shown directly, otherwise they
- are shown as some sequence of printable characters.
-
- You can use the ^_ (control-underscore) command to flip the top
- bit of the character the cursor is on. This may be useful on
- systems where it is otherwise impossible to enter 8-bit
- characters.
-
- Tabs are normally displayed as a series of spaces of the
- appropriate length (according to the tabstops parameter); setting
- list mode will cause them to be displayed as a control character,
- as will unsetting the tabs parameter. How the tab character is
- displayed is then under the control of the cchars parameter.
-
- _2._1_2. _M_o_u_s_e _S_u_p_p_o_r_t
-
- Some mouse support is available for micro-based systems and
- workstations. Clicking the mouse button on:
-
- any line outside current window
- changes current window to the one indicated by the mouse
- (can be used instead of g).
-
- top line of any window
- scrolls window downwards (same as ^Y).
-
- bottom line of any window
- scrolls window upwards (same as ^E).
-
- status line of any window
- shows current file and lines (same as ^G).
-
- any text line of any window
- moves text cursor as near as possible to mouse cursor.
-
- Also, windows can be resized by "dragging" the appropriate status
- line up or down with the mouse.
-
- _2._1_3. _M_i_s_c_e_l_l_a_n_e_o_u_s
-
- o+ The :wn (write file and edit next) command is provided, as
- per PC-vi.
-
- o+ There is no limit to the number or size of maps which may be
- defined, nor is there any fixed limit to the number of lines
-
-
- _P_a_g_e _8 _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
-
-
-
-
-
- _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i _9
-
-
- in a buffer.
-
- o+ The edit parameter controls whether a buffer can be
- modified. This may be used, together with the _r_e_a_d_o_n_l_y
- parameter, to implement a nicer version of _v_i_e_w(1) than vi's
- version, since it won't fool you into thinking that editing
- the buffer is in any way safe. Be warned: once having set
- noedit, it is not possible to do a :set edit. It's a one-
- way street.
-
- o+ The timeout parameter is implemented as a numeric value,
- specifying the number of milliseconds after which to assume
- that no further input is available to continue with the
- parsing of a map sequence. This replaces vi's boolean
- parameter of the same name.
-
- o+ The vbell parameter may be used to specify use of a visual,
- rather than audible, bell, if this is available.
-
- o+ The :echo command is available; it simply echoes its
- arguments, after expansion of % and # characters.
-
- o+ In insert and replace modes, ^_A has the same meaning as ^@
- in vi, except that it works at any time, not just for the
- first character. Also, typing ^B_x, where _x is the name of a
- conjugate buffer, inserts the contents of that buffer into
- the input stream at that point. The buffer named < always
- contains the last thing inserted, so that ^_B< is the same as
- ^_A.
-
- _3. _D_i_f_f_e_r_e_n_c_e_s
-
- o+ Argument handling is somewhat different; for instance, -_R is
- not supported, but "-s parameter=value" is, which is much
- more useful anyway.
-
- o+ The _X_V_I_N_I_T environment variable is read instead of _E_X_I_N_I_T.
- Whilst no files are sourced automatically, users who wish to
- have a startup file can arrange it very easily. _s_h(1) or
- _k_s_h(1) users should add this line to their $_H_O_M_E/._p_r_o_f_i_l_e:
-
- _X_V_I_N_I_T='_s_o_u_r_c_e _x_v_i-_s_t_a_r_t_u_p-_f_i_l_e'; _e_x_p_o_r_t _X_V_I_N_I_T
-
- _c_s_h(1) users should add this to their $_H_O_M_E/._l_o_g_i_n:
-
- _s_e_t_e_n_v _X_V_I_N_I_T '_s_o_u_r_c_e _x_v_i-_s_t_a_r_t_u_p-_f_i_l_e'
-
- and MS-DOS users should add this to their _a_u_t_o_e_x_e_c._b_a_t:
-
- _s_e_t _X_V_I_N_I_T=_s_o_u_r_c_e _x_v_i-_s_t_a_r_t_u_p-_f_i_l_e
-
-
- o+ The tags parameter can be used to specify multiple tags
- files; these can be separated by either "\ " (backslash
- space) or "," (comma).
-
-
- _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2 _P_a_g_e _9
-
-
-
-
-
- _1_0 _S_u_m_m_a_r_y _o_f _D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _V_i _a_n_d _X_v_i
-
-
- o+ Alternate files are handled slightly differently, owing to
- the presence of buffer and window handling. Essentially,
- when you close a buffer, its filename is remembered as the
- alternate file; when you invoke the ^^ or :e # commands,
- this filename is re-edited. Note that ^^ edits the
- alternate file in a new buffer window.
-
- o+ Hitting the escape key while in the command line does not
- terminate input; instead, it cancels input, returning the
- prompt to the beginning of the line. This applies to input
- for :, /, ? and !.
-
- o+ Character-based yanks (or deletes) which span line
- boundaries are handled correctly (vi gets this wrong).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- _P_a_g_e _1_0 _2_5_t_h _S_e_p_t_e_m_b_e_r _1_9_9_2
-
-
-