|
@@ -23,7 +23,7 @@
|
|
|
<sect2 role="package">
|
|
|
<title/>
|
|
|
|
|
|
- <para>The Vim package contains a powerful text editor.</para>
|
|
|
+ <para>Vim 软件包包含强大的文本编辑器。</para>
|
|
|
|
|
|
<segmentedlist>
|
|
|
<segtitle>&buildtime;</segtitle>
|
|
@@ -36,25 +36,24 @@
|
|
|
</segmentedlist>
|
|
|
|
|
|
<tip>
|
|
|
- <title>Alternatives to Vim</title>
|
|
|
+ <title>Vim 的替代品</title>
|
|
|
|
|
|
- <para>If you prefer another editor—such as Emacs, Joe, or
|
|
|
- Nano—please refer to <ulink
|
|
|
- url="&blfs-book;postlfs/editors.html"/> for suggested
|
|
|
- installation instructions.</para>
|
|
|
+ <para>如果您喜爱其他编辑器 —— 例如 Emacs、Joe、或者
|
|
|
+ Nano —— 参考 <ulink
|
|
|
+ url="&blfs-book;postlfs/editors.html"/> 中建议的安装说明。</para>
|
|
|
</tip>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 role="installation">
|
|
|
- <title>安装Vim</title>
|
|
|
+ <title>安装 Vim</title>
|
|
|
|
|
|
- <para>First, change the default location of the <filename>vimrc</filename>
|
|
|
- configuration file to <filename class="directory">/etc</filename>:</para>
|
|
|
+ <para>首先,修改 <filename>vimrc</filename> 配置文件的默认位置为
|
|
|
+ <filename class="directory">/etc</filename>:</para>
|
|
|
|
|
|
<screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</userinput></screen>
|
|
|
|
|
|
- <para>Disable a test that fails:</para>
|
|
|
+ <para>禁用一个失败的测试:</para>
|
|
|
|
|
|
<screen><userinput remap="pre">sed -i '/call/{s/split/xsplit/;s/303/492/}' src/testdir/test_recover.vim</userinput></screen>
|
|
|
|
|
@@ -70,60 +69,79 @@
|
|
|
|
|
|
<screen><userinput remap="test">make -j1 test &> vim-test.log</userinput></screen>
|
|
|
|
|
|
- <para>The test suite outputs a lot of binary data to the screen. This can
|
|
|
+ <!--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>
|
|
|
+ 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
|
|
|
+ <!--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>
|
|
|
+ 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>By default, Vim's documentation is installed in <filename
|
|
|
- class="directory">/usr/share/vim</filename>. The following symlink
|
|
|
- allows the documentation to be accessed via <filename
|
|
|
- class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
|
|
|
- it consistent with the location of documentation for other packages:</para>
|
|
|
+ <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
|
|
|
+ <!--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>
|
|
|
+ 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>Configuring Vim</title>
|
|
|
+ <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.
|
|
|
+ <!--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>
|
|
|
+ <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 > /etc/vimrc << "EOF"
|
|
|
<literal>" Begin /etc/vimrc
|
|
@@ -143,31 +161,29 @@ endif
|
|
|
" End /etc/vimrc</literal>
|
|
|
EOF</userinput></screen>
|
|
|
|
|
|
- <para>The <parameter>set nocompatible</parameter> setting makes
|
|
|
- <command>vim</command> behave in a more useful way (the default) than the
|
|
|
- vi-compatible manner. Remove the <quote>no</quote> to keep the old
|
|
|
- <command>vi</command> behavior. The <parameter>set backspace=2</parameter>
|
|
|
- setting allows backspacing over line breaks, autoindents, and the start of
|
|
|
- insert. The <parameter>syntax on</parameter> parameter enables vim's syntax
|
|
|
- highlighting. The <parameter>set mouse=</parameter> setting enables
|
|
|
- proper pasting of text with the mouse when working in chroot or over a
|
|
|
- remote connection. Finally, the <emphasis>if</emphasis> statement with the
|
|
|
- <parameter>set background=dark</parameter> setting corrects
|
|
|
- <command>vim</command>'s guess about the background color of some terminal
|
|
|
- emulators. This gives the highlighting a better color scheme for use on the
|
|
|
- black background of these programs.</para>
|
|
|
+ <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>Documentation for other available options can be obtained by
|
|
|
- running the following command:</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.
|
|
|
+ <!--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
|
|
@@ -175,13 +191,21 @@ EOF</userinput></screen>
|
|
|
<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>
|
|
|
+ <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>For more information, see the appropriate README file located
|
|
|
- at the URL above.</para>
|
|
|
+ <para>关于更多信息,参考以上 URL 位置中合适的 README 文件。</para>
|
|
|
</note>
|
|
|
|
|
|
</sect2>
|
|
@@ -194,9 +218,9 @@ set spell</literal></screen>
|
|
|
<segtitle>安装的目录</segtitle>
|
|
|
|
|
|
<seglistitem>
|
|
|
- <seg> ex (link to vim), rview (link to vim), rvim (link to vim), vi
|
|
|
- (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor,
|
|
|
- and xxd</seg>
|
|
|
+ <seg> ex (到 vim 的链接), rview (到 vim 的链接), rvim (到 vim 的链接), vi
|
|
|
+ (到 vim 的链接), view (到 vim 的链接), vim, vimdiff (到 vim 的链接), vimtutor,
|
|
|
+ 以及 xxd</seg>
|
|
|
<seg>/usr/share/vim</seg>
|
|
|
</seglistitem>
|
|
|
</segmentedlist>
|
|
@@ -209,7 +233,7 @@ set spell</literal></screen>
|
|
|
<varlistentry id="ex">
|
|
|
<term><command>ex</command></term>
|
|
|
<listitem>
|
|
|
- <para>Starts <command>vim</command> in ex mode</para>
|
|
|
+ <para>以 ex 模式启动 <command>vim</command></para>
|
|
|
<indexterm zone="ch-system-vim ex">
|
|
|
<primary sortas="b-ex">ex</primary>
|
|
|
</indexterm>
|
|
@@ -219,9 +243,8 @@ set spell</literal></screen>
|
|
|
<varlistentry id="rview">
|
|
|
<term><command>rview</command></term>
|
|
|
<listitem>
|
|
|
- <para>Is a restricted version of <command>view</command>; no shell
|
|
|
- commands can be started and <command>view</command> cannot be
|
|
|
- suspended</para>
|
|
|
+ <para>是 <command>view</command> 的受限模式;
|
|
|
+ 不能启动 shell 命令,且不能挂起 <command>view</command></para>
|
|
|
<indexterm zone="ch-system-vim rview">
|
|
|
<primary sortas="b-rview">rview</primary>
|
|
|
</indexterm>
|
|
@@ -231,9 +254,8 @@ set spell</literal></screen>
|
|
|
<varlistentry id="rvim">
|
|
|
<term><command>rvim</command></term>
|
|
|
<listitem>
|
|
|
- <para>Is a restricted version of <command>vim</command>; no shell
|
|
|
- commands can be started and <command>vim</command> cannot be
|
|
|
- suspended</para>
|
|
|
+ <para>是 <command>vim</command> 的受限模式;
|
|
|
+ 不能启动 shell 命令,且不能挂起 <command>vim</command></para>
|
|
|
<indexterm zone="ch-system-vim rvim">
|
|
|
<primary sortas="b-rvim">rvim</primary>
|
|
|
</indexterm>
|
|
@@ -243,7 +265,7 @@ set spell</literal></screen>
|
|
|
<varlistentry id="vi">
|
|
|
<term><command>vi</command></term>
|
|
|
<listitem>
|
|
|
- <para>Link to <command>vim</command></para>
|
|
|
+ <para>到 <command>vim</command> 的链接</para>
|
|
|
<indexterm zone="ch-system-vim vi">
|
|
|
<primary sortas="b-vi">vi</primary>
|
|
|
</indexterm>
|
|
@@ -253,7 +275,7 @@ set spell</literal></screen>
|
|
|
<varlistentry id="view">
|
|
|
<term><command>view</command></term>
|
|
|
<listitem>
|
|
|
- <para>Starts <command>vim</command> in read-only mode</para>
|
|
|
+ <para>以只读模式启动 <command>vim</command></para>
|
|
|
<indexterm zone="ch-system-vim view">
|
|
|
<primary sortas="b-view">view</primary>
|
|
|
</indexterm>
|
|
@@ -263,7 +285,7 @@ set spell</literal></screen>
|
|
|
<varlistentry id="vim">
|
|
|
<term><command>vim</command></term>
|
|
|
<listitem>
|
|
|
- <para>Is the editor</para>
|
|
|
+ <para>文本编辑器</para>
|
|
|
<indexterm zone="ch-system-vim vim">
|
|
|
<primary sortas="b-vim">vim</primary>
|
|
|
</indexterm>
|
|
@@ -273,8 +295,8 @@ set spell</literal></screen>
|
|
|
<varlistentry id="vimdiff">
|
|
|
<term><command>vimdiff</command></term>
|
|
|
<listitem>
|
|
|
- <para>Edits two or three versions of a file with <command>vim</command>
|
|
|
- and shows differences</para>
|
|
|
+ <para>用 <command>vim</command> 编辑两个或三个文件版本,
|
|
|
+ 并显示差异</para>
|
|
|
<indexterm zone="ch-system-vim vimdiff">
|
|
|
<primary sortas="b-vimdiff">vimdiff</primary>
|
|
|
</indexterm>
|
|
@@ -284,8 +306,8 @@ set spell</literal></screen>
|
|
|
<varlistentry id="vimtutor">
|
|
|
<term><command>vimtutor</command></term>
|
|
|
<listitem>
|
|
|
- <para>Teaches the basic keys and commands of
|
|
|
- <command>vim</command></para>
|
|
|
+ <para>教会用户使用
|
|
|
+ <command>vim</command> 的基本快捷键和命令</para>
|
|
|
<indexterm zone="ch-system-vim vimtutor">
|
|
|
<primary sortas="b-vimtutor">vimtutor</primary>
|
|
|
</indexterm>
|
|
@@ -295,8 +317,8 @@ set spell</literal></screen>
|
|
|
<varlistentry id="xxd">
|
|
|
<term><command>xxd</command></term>
|
|
|
<listitem>
|
|
|
- <para>Creates a hex dump of the given file; it can
|
|
|
- also do the reverse, so it can be used for binary patching</para>
|
|
|
+ <para>创建文件的十六进制转储;它也可以从十六进制转储创建文件,
|
|
|
+ 因此可用于二进制补丁</para>
|
|
|
<indexterm zone="ch-system-vim xxd">
|
|
|
<primary sortas="b-xxd">xxd</primary>
|
|
|
</indexterm>
|