Variants of the VIsual iMproved Editor —vim

The vim editor, by Bram Moolenaar, is a text editor that is compatible with the original Berkeley Software Distribution vi editor by Bill Joy. An X11 version is called gvim and sports multiple scrolling windows and menus.Figure 14.1

The XEmacs editor features split windows, built-in help, a tutori­al, and other tools to help you be more pro­ductive.

Split Window


Tutorial Mode

Button Toolbar

Current Time


Command Line       Current Day

Calendar Display Mode

Modeline Scrollbars

Although the vim :version command shows that the systemwide vimrc and gvimrc resource files are located under the /usr/share/vim directory, this is not true: these files aren't installed with the vim package. However, you can create your own resource file after making changes to vim while running the editor and then using the :mkvimrc command. A resource file called .vimrc (which you can copy to .gvimrc) is created in your home directory and contains your changes. You can then edit and add your own commands, configurations, and menus to these files.

Several files and symbolic links to the vim editor are created on your system when you install the vim package from your CD-ROM:

• /usr/bin/vi -> /bin/vi

• /bin/vi -> /bin/vim

• /bin/view -> /bin/vim

• /usr/bin/view -> /bin/vim

• /bin/vim

• /usr/X11R6/bin/gvimThe vim editor, shown in Figure 14.2, is used as a replacement for the ex, vi, and view editors and is a visual editor supporting features such as cursor movement.

Figure 14.2

The vim editor features split windows and built-in help.



ij   File     Options Help

E"iM_help.t::tH   For Vih "ersion 4.5.    Last modification: lK>b Sep 3" VIH help file

"III stands for "1 Illpro^ed.   Host of VIH was Made by Er ah lloolenaar.

Ilo^e around:   Use the cursor l-eys. or "h" to io left.                       h 1

"j"    tO   -O  dOMn.    "1"    tO   -O  Up.    "1"   to   -O  ri-ht. j

Close this Mindoii; Use

Jump to a subject:   Position the cursor on the t ir. between 1 bar si and hit CTRL-].   Use CTRL-T to go back. Nith the Mouse:    ":set Mouse=a" t:- enable the Mouse 'in   terM '.

Hit "■" and clicl   left Mouse button on ta. between Ibarsl. Hit "g" and click ri-ht Mouse button to ?o back.

C-et t in; help on a

specific subject:    It is possible to io directly to whatever you '-'ant help

on. by ii"ii-ii an ariUMent to the ":help" coMMand, l:helpl. It is possible to further specify the conte t: uhat                             prepend      e aMp1e 1 lor Mai Mode coMMands        < nothini < :help Visual Mode coMMands             v_           :help v_u Insert Mode coMMands             i_           :help i_<Esc> c:mm and-11ne c:mm ands                          :he1p :qu11




The vim editor features a number of improvements over the traditional vi editor, and has 23 different command-line options. In vim you can find built-in help, split-screen win­dows, block moves, command-line editing, horizontal scrolling, and word wrapping for word processing.

The gvim version of vim, used under the X Window System, has custom colors, window sizes, scrollbars, and menus. You can create your own set of menus containing specific vim commands and generate different versions of vim by saving your features in different gvim resource files. You can then use the -u command-line option to load a custom ver­sion.

Creating new menus for gvim is easy. You can, for example, group related macros or cus­tom commands you create in a separate menu. For details about building custom menus, read the files vim_menu.txt and vim_gui.txt under the /usr/share/vim directory.

Most of the documentation for vim is contained in its built-in help, and 21 text files in the /usr/share/vim directory contain extensive instructions.