📄 0217-0220.html
字号:
<HTML>
<HEAD>
<TITLE>Sams Teach Yourself Linux in 24 Hours:Text Processing:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311623 //-->
<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->
<!-- AUTHOR=Bill Ball//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=14 //-->
<!-- PAGES=0211-0228 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0211-0216.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0221-0223.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-217"><P>Page 217</P></A>
<H4><A NAME="ch14_ 6">
Variants of the Visual Editor Improved—vim
</A></H4>
<P>The vim editor, by Bram Moolenaar, is a text editor 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.
</P>
<TABLE BGCOLOR=#FFFF99><TR><TD>TIME SAVER</TD></TR><TR><TD>
<BLOCKQUOTE>
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; you won't find these files 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.
</BLOCKQUOTE></TD></TR></TABLE>
<P>Several symbolic links are created on your system when you install the vim package
from your CD-ROM:
</P>
<UL>
<LI> /bin/ex -> /bin/vim
<LI> /usr/bin/ex -> /bin/vim
<LI> /usr/bin/vi -> /bin/vim
<LI> /bin/vi -> /bin/vim
<LI> /bin/view -> /bin/vim
<LI> /usr/X11R6/bin/vimx ->/usr/X11R6/bin/gvim
</UL>
<P>The vim editor is used as a replacement for the ex, vi, and view editors (see Figure
14.2). Although vim is a visual editor, supporting features such as cursor movement,
when invoked as ex, the vim editor emulates the ex script editor.
</P>
<P>The vim editor features a number of improvements over the traditional vi editor, and
has 23 different command-line options. In vim you'll find built-in help, split-screen
windows, block moves, command-line editing, horizontal scrolling, and word wrap for
word processing.
</P>
<P>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 version.
</P>
<P>Creating new menus for gvim is easy. You can, for example, group related macros
or custom commands you've created into a separate menu. For details about building
custom</P>
<A NAME="PAGENUM-218"><P>Page 218</P></A>
<P>Figure 14.2.<BR>
The X11 version of the <BR>
vim editor, gvim,<BR>
features split scrollable <BR>
windows, along with<BR>
menus you can<BR>
customize.</P>
<P><a href="javascript:displayWindow('images/ch14fg02.jpg', 288, 216)"><img src="images/tn_ch14fg02.jpg"></a><BR>
</P>
<P>menus, read the files vim_menu.txt and
vim_gui.txt under the /usr/share/vim directory.
</P>
<P>Most of the documentation for vim is contained in its built-in help, and there are 21
text files containing extensive instructions in the
/usr/share/vim directory.
</P>
<H4><A NAME="ch14_ 7">
Features of Pine's pico Editor
</A></H4>
<P>The pico editor, included with the University of Washington's pine electronic
mail program, is a compact, efficient, and easy-to-use editor usually used to compose or
reply to e-mail messages. This editor is a nifty replacement for all your editing needs, and
is especially handy if you need a reliable text editor, but don't have a lot of hard drive
space (for example, on a laptop).
</P>
<P>Despite its relatively small size, the pico editor has most of the features you'd expect in
a word processor, including
</P>
<UL>
<LI> Word wrap
<LI> Built-in help
<LI> Word search
<LI> Paragraph justification
<LI> Text block move, copy, and delete
<LI> Mouse support
<LI> Spell checking
</UL>
<P>The pico editor has 16 different command-line options and rudimentary crash
protection
</P>
<A NAME="PAGENUM-219"><P>Page 219</P></A>
<P>Figure 14.3.<BR>
The pico editor, part of<BR>
the pine electronic mail<BR>
program distribution, is<BR>
a compact and easy-<BR>
to-use editor with<BR>
nearly all of the basic<BR>
features of a text<BR>
editor.
</P>
<P><a href="javascript:displayWindow('images/ch14fg03.jpg', 288, 216)"><img src="images/tn_ch14fg03.jpg"></a><BR>
</P>
<P>(see Figure 14.3). It attempts to save any work in progress before exiting, saving your
file with a name ending in .save, or if unsaved, in a file
named pico.save.
</P>
<P>This editor is an excellent choice for your $EDITOR
environment variable, as it is much friendlier and easier to learn than the default
$EDITOR variable, which points to the vi command. As the root operator, set the
$EDITOR variable for all users by editing the
/etc/profile file, and inserting the following line:
</P>
<!-- CODE SNIP //-->
<PRE>
EDITOR=/usr/bin/pico
</PRE>
<!-- END CODE SNIP //-->
<P>Also, make sure that the following line contains the word
EDITOR:
</P>
<!-- CODE SNIP //-->
<PRE>
export USERNAME ENV PATH EDITOR
</PRE>
<!-- END CODE SNIP //-->
<P>Save the file, and then enter the following to use the new
$EDITOR variable:
</P>
<!-- CODE SNIP //-->
<PRE>
# source /etc/profile
</PRE>
<!-- END CODE SNIP //-->
<P>After you do this, any Linux command requiring a default system editor will use pico.
Also use these changes in the .bash_profile file in your home directory.
</P>
<P>You'll find documentation for pico in its manual page, or you can use the lynx Web
browser to read the pine and pico technical documentation with the following:
</P>
<!-- CODE SNIP //-->
<PRE>
# lynx /usr/doc/pine-3.96/tech-notes/index.html
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="ch14_ 8">
Five Editors in One—joe
</A></H4>
<P>The joe editor, by Joseph H. Allen, comes in five different versions: jmacs, joe, jpico,
jstar,</P>
<A NAME="PAGENUM-220"><P>Page 220</P></A>
<P>and rjoe (see Figure 14.4). The jmacs version emulates the emacs editor. The jpico
version emulates the pine mailer's pico text editor. The jstar version uses
WordStar-compatible keyboard commands, while the rjoe program is a restricted editor.
<P>joe's configuration files are found under the
/usr/lib/joe directory. Copy the file called joerc
to your home directory, save it with the .joerc filename, and then edit this file to change
joe's
</P>
<P>Figure 14.4.<BR>
The joe editor comes<BR>
in five versions, and <br>
can emulate the <br>
keyboard commands <br>
of several different <br>
editors, such as pico <br>
and emacs.</P>
<a href="javascript:displayWindow('images/ch14fg04.jpg', 183, 129)"><img src="images/tn_ch14fg04.jpg"></a><BR>
<BR>
<P>help menus, display, and keyboard commands.
</P>
<P>You'll find documentation for the joe editor in its manual page (which needs to be
spell checked), and by using its built-in help.
</P>
<P>There is a bug in the version of joe on your CD-ROM that involves proper resizing of
the editor in consoles or X11 windows greater than 80 characters by 25 lines in size.
Upgrade to the newer version by obtaining and installing the
joe-2.8-10.i386.rpm file. You can get this file from Red Hat Software by browsing to the following site:
</P>
<!-- CODE SNIP //-->
<PRE>
ftp://ftp.redhat.com/pub/redhat/updates/5.0/i386/
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="ch14_ 9">
Configuring the jed Editor
</A></H4>
<P>The jed editor, by John E. Davis, comes in two versions: one for the console, and the
other tailored for the X Window System (see Figure 14.5).
</P>
<P>jed's main configuration files may be found under the
/usr/lib/jed/lib directory, and you may customize how jed runs by placing preferences in a
.jedrc file in your home directory. Copy the file
jed.rc from the /usr/lib/jed/lib directory to your home directory as
.jedrc, and then edit to your taste.
</P>
<P>The jed editor has built-in help, but you'll find information about jed under the
/usr/doc directory, in its manual page, and in info files under the
/usr/lib/jed/info directory.
</P>
<P><CENTER>
<a href="0211-0216.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0221-0223.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -