Browse Source

Add LANG to vim test instructions

I missed a paragraph in r11443.  This paragraph should be removed now so
I won't fix the commit histroy.
Xi Ruoyao 7 years ago
parent
commit
6b1f7b078e
3 changed files with 336 additions and 1 deletions
  1. 3 0
      chapter01/changelog.xml
  2. 1 1
      chapter06/vim.xml
  3. 332 0
      chapter06/vim.xml.orig

+ 3 - 0
chapter01/changelog.xml

@@ -44,6 +44,9 @@
     <listitem>
       <para>2018-08-12</para>
       <itemizedlist>
+        <listitem>
+          <para>[bdubbs] - 在 vim 测试命令中增加 LANG 环境变量。</para>
+        </listitem>
         <listitem>
           <para>[bdubbs] - 确保 grep 测试完整运行。</para>
         </listitem>

+ 1 - 1
chapter06/vim.xml

@@ -67,7 +67,7 @@
 
     <para>运行以下命令以测试编译结果:</para>
 
-<screen><userinput remap="test">make -j1 test &amp;&gt; vim-test.log</userinput></screen>
+<screen><userinput remap="test">LANG=en_US.UTF-8 make -j1 test &amp;&gt; vim-test.log</userinput></screen>
 
     <!--para>The test suite outputs a lot of binary data to the screen.  This can
     cause issues with the settings of the current terminal.  The problem can be

+ 332 - 0
chapter06/vim.xml.orig

@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+
+<sect1 id="ch-system-vim" role="wrap">
+  <?dbhtml filename="vim.html"?>
+
+  <sect1info condition="script">
+    <productname>vim</productname>
+    <productnumber>&vim-version;</productnumber>
+    <address>&vim-url;</address>
+  </sect1info>
+
+  <title>Vim-&vim-version;</title>
+
+  <indexterm zone="ch-system-vim">
+    <primary sortas="a-Vim">Vim</primary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>Vim 软件包包含强大的文本编辑器。</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&vim-ch6-sbu;</seg>
+        <seg>&vim-ch6-du;</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <tip>
+      <title>Vim 的替代品</title>
+
+      <para>如果您喜爱其他编辑器 —— 例如 Emacs、Joe、或者
+      Nano —— 参考 <ulink
+      url="&blfs-book;postlfs/editors.html"/> 中建议的安装说明。</para>
+    </tip>
+
+  </sect2>
+
+  <sect2 role="installation">
+    <title>安装 Vim</title>
+
+    <para>首先,修改 <filename>vimrc</filename> 配置文件的默认位置为
+    <filename class="directory">/etc</filename>:</para>
+
+<screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h</userinput></screen>
+
+<!--    <para>Disable a test that fails:</para>
+
+<screen><userinput remap="pre">sed -i '/call/{s/split/xsplit/;s/303/492/}' src/testdir/test_recover.vim</userinput></screen>
+-->
+    <para>准备编译 Vim:</para>
+
+<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
+
+    <para>编译该软件包:</para>
+
+<screen><userinput remap="make">make</userinput></screen>
+
+    <para>运行以下命令以测试编译结果:</para>
+
+<screen><userinput remap="test">make -j1 test &amp;&gt; vim-test.log</userinput></screen>
+
+    <!--para>The test suite outputs a lot of binary data to the screen.  This can
+    cause issues with the settings of the current terminal.  The problem can be
+    avoided by redirecting the output to a log file as shown above.  A
+    successful test will result in the words "ALL DONE" in the log file
+    at completion.</para-->
+    <para>测试套件会将大量二进制数据输出到屏幕,这可能扰乱当前终端设置。
+		为了避免这个问题,像上面的命令一样,将输出重定向到日志文件。
+		测试成功完成后,日志文件末尾会包含 <quote>ALL DONE</quote>。</para>
+
+    <para>安装该软件包:</para>
+
+<screen><userinput remap="install">make install</userinput></screen>
+
+    <!--para>Many users are used to using <command>vi</command> instead of
+    <command>vim</command>. To allow execution of <command>vim</command>
+    when users habitually enter <command>vi</command>, create a
+    symlink for both the binary and the man page in the provided
+    languages:</para-->
+    <para>许多用户习惯于使用命令 <command>vi</command>,而不是
+		<command>vim</command>。为了在用户习惯性地输入
+		<command>vi</command> 时能够执行 <command>vim</command>,
+		为二进制程序和各种语言的 man 页面创建符号链接:</para>
+
+<screen><userinput remap="install">ln -sv vim /usr/bin/vi
+for L in  /usr/share/man/{,*/}man1/vim.1; do
+    ln -sv vim.1 $(dirname $L)/vi.1
+done</userinput></screen>
+
+    <para>默认情况下,Vim 的文档安装在 <filename
+    class="directory">/usr/share/vim</filename>。下面创建的符号链接允许通过
+    <filename class="directory">/usr/share/doc/vim-&vim-version;</filename>
+    访问符号链接,这个路径与其他软件包的文档位置格式一致:</para>
+
+<screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
+
+    <!--para>If an X Window System is going to be installed on the LFS
+    system, it may be necessary to recompile Vim after installing X. Vim
+    comes with a GUI version of the editor that requires X and some
+    additional libraries to be installed. For more information on this
+    process, refer to the Vim documentation and the Vim installation page
+    in the BLFS book at <ulink
+    url="&blfs-book;postlfs/vim.html"/>.</para-->
+	<para>如果在安装 LFS 系统后安装了 X 窗口系统,可能需要在安装 X
+		后重新编译 Vim 。
+		Vim 提供的 GUI 版本编辑器需要 X 和一些额外的软件包才能安装。
+		关于这一安装过程的更多信息,参考 Vim 文档和 BLFS 手册中位于
+		<ulink url="&blfs-book;postlfs/vim.html"/> 的 Vim 安装页面。</para>
+
+  </sect2>
+
+  <sect2 id="conf-vim" role="configuration">
+    <title>配置 Vim</title>
+
+    <indexterm zone="conf-vim">
+      <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
+    </indexterm>
+
+	<!--para>By default, <command>vim</command> runs in vi-incompatible mode.
+    This may be new to users who have used other editors in the past. The
+    <quote>nocompatible</quote> setting is included below to highlight the
+    fact that a new behavior is being used. It also reminds those who would
+    change to <quote>compatible</quote> mode that it should be the first
+    setting in the configuration file. This is necessary because it changes
+    other settings, and overrides must come after this setting. Create a default
+    <command>vim</command> configuration file by running the following:</para-->
+    <para>默认情况下,<command>vim</command> 在不兼容 vi 的模式下运行,
+		这对于过去使用其他编辑器的用户来说可能显得陌生。
+		以下配置包含的 <quote>nocompatible</quote>
+		设定是为了强调编辑器使用了新的行为这一事实。
+		它也提醒那些想要使用 <quote>compatible</quote> 模式的用户,
+		必须在配置文件的一开始改变模式,因为它会修改其他设置,
+		因此对这些设置的覆盖必须在设定模式后进行。
+		执行以下命令创建默认 <command>vim</command> 配置文件:</para>
+
+<screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"
+<literal>" Begin /etc/vimrc
+
+" Ensure defaults are set before customizing settings, not after
+source $VIMRUNTIME/defaults.vim
+let skip_defaults_vim=1 
+
+set nocompatible
+set backspace=2
+set mouse=
+syntax on
+if (&amp;term == "xterm") || (&amp;term == "putty")
+  set background=dark
+endif
+
+" End /etc/vimrc</literal>
+EOF</userinput></screen>
+
+    <para><parameter>set nocompatible</parameter> 设定使得
+		<command>vim</command> 以一种更有用的方式(也是默认方式)行动,
+		而不是兼容于 vi 的旧模式。如果需要保留旧的 <command>vi</command>
+		行为,删除其中的 <quote>no</quote>。
+		<parameter>set backspace=2</parameter> 设定允许退格越过换行、
+		自动缩进和插入模式的起始位置。参数 <parameter>syntax on</parameter>
+		启用 vim 符号高亮功能。参数 <parameter>set mouse=</parameter>
+		允许在 chroot 中或通过远程连接工作时使用鼠标正确地粘贴文本。
+		最后,包含设定 <parameter>set background=dark</parameter> 的
+		<emphasis>if</emphasis> 语句纠正 <command>vim</command>
+		对于某些终端模拟器背景色的猜测,
+		这能够提供更适合这些程序黑色背景的配色方案。</para>
+<!--
+    <para>Creating an empty <filename>~/.vimrc</filename> prevents vim from
+    overriding settings in <filename>/etc/vimrc</filename> by using
+    <filename>/usr/share/vim/vim80/defaults.vim</filename>.</para>
+-->
+    <para>关于其他可用选项的文档可以通过执行以下命令获得:</para>
+
+<screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
+
+    <note>
+      <!--para>By default, Vim only installs spell files for the English language.
+      To install spell files for your preferred language, download the
+      <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
+      files for your language and character encoding from <ulink
+      url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
+      <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
+
+      <para>To use these spell files, some configuration in
+      <filename>/etc/vimrc</filename> is needed, e.g.:</para-->
+      <para>默认情况下 Vim 只安装英语拼写检查文件。
+		  如果希望安装您使用的语言的拼写检查文件,从
+		  <ulink url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/>
+		  为您的语言和字符编码下载 <filename>*.spl</filename> 和可选的
+		  <filename>*.sug</filename> 文件,并将它们保存到
+<filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>。
+      </para>
+	  <para>为了使用这些拼写检查文件,需要在 <filename>/etc/vimrc</filename>
+		  中进行配置,例如:</para>
+
+<screen><literal>set spelllang=en,ru
+set spell</literal></screen>
+
+      <para>关于更多信息,参考以上 URL 位置中合适的 README 文件。</para>
+    </note>
+
+  </sect2>
+
+  <sect2 id="contents-vim" role="content">
+    <title>Vim 的内容</title>
+
+    <segmentedlist>
+      <segtitle>安装的程序</segtitle>
+      <segtitle>安装的目录</segtitle>
+
+      <seglistitem>
+       <seg> ex (到 vim 的链接), rview (到 vim 的链接), rvim (到 vim 的链接), vi
+       (到 vim 的链接), view (到 vim 的链接), vim, vimdiff (到 vim 的链接), vimtutor,
+       以及 xxd</seg>
+        <seg>/usr/share/vim</seg>
+      </seglistitem>
+    </segmentedlist>
+
+    <variablelist>
+      <bridgehead renderas="sect3">简要描述</bridgehead>
+      <?dbfo list-presentation="list"?>
+      <?dbhtml list-presentation="table"?>
+
+      <varlistentry id="ex">
+        <term><command>ex</command></term>
+        <listitem>
+          <para>以 ex 模式启动 <command>vim</command></para>
+          <indexterm zone="ch-system-vim ex">
+            <primary sortas="b-ex">ex</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="rview">
+        <term><command>rview</command></term>
+        <listitem>
+          <para>是 <command>view</command> 的受限模式;
+          不能启动 shell 命令,且不能挂起 <command>view</command></para>
+          <indexterm zone="ch-system-vim rview">
+            <primary sortas="b-rview">rview</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="rvim">
+        <term><command>rvim</command></term>
+        <listitem>
+          <para>是 <command>vim</command> 的受限模式;
+			  不能启动 shell 命令,且不能挂起 <command>vim</command></para>
+          <indexterm zone="ch-system-vim rvim">
+            <primary sortas="b-rvim">rvim</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="vi">
+        <term><command>vi</command></term>
+        <listitem>
+          <para>到 <command>vim</command> 的链接</para>
+          <indexterm zone="ch-system-vim vi">
+            <primary sortas="b-vi">vi</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="view">
+        <term><command>view</command></term>
+        <listitem>
+          <para>以只读模式启动 <command>vim</command></para>
+          <indexterm zone="ch-system-vim view">
+            <primary sortas="b-view">view</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="vim">
+        <term><command>vim</command></term>
+        <listitem>
+          <para>文本编辑器</para>
+          <indexterm zone="ch-system-vim vim">
+            <primary sortas="b-vim">vim</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="vimdiff">
+        <term><command>vimdiff</command></term>
+        <listitem>
+          <para>用 <command>vim</command> 编辑两个或三个文件版本,
+          并显示差异</para>
+          <indexterm zone="ch-system-vim vimdiff">
+            <primary sortas="b-vimdiff">vimdiff</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="vimtutor">
+        <term><command>vimtutor</command></term>
+        <listitem>
+          <para>教会用户使用
+          <command>vim</command> 的基本快捷键和命令</para>
+          <indexterm zone="ch-system-vim vimtutor">
+            <primary sortas="b-vimtutor">vimtutor</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry id="xxd">
+        <term><command>xxd</command></term>
+        <listitem>
+          <para>创建文件的十六进制转储;它也可以从十六进制转储创建文件,
+          因此可用于二进制补丁</para>
+          <indexterm zone="ch-system-vim xxd">
+            <primary sortas="b-xxd">xxd</primary>
+          </indexterm>
+        </listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </sect2>
+
+</sect1>