Files
LFS_Book/chapter06/vim.xml
Anton Maisak bf5afb1f42 Revision: 11620
Author: bdubbs
Date: 17 июня 2019 г. 0:13:07
Message:
Remove duplicate line
----
Modified : /trunk/BOOK/chapter06/vim.xml
2020-09-14 11:54:11 +03:00

296 lines
14 KiB
XML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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>Чтобы подготовить тесты к выполнению, убедитесь что пользователь <systemitem class="username">nobody</systemitem> может выполнять запись в дерево исходных текстов пакета:</para>
<screen><userinput remap="test">chown -Rv nobody .</userinput></screen>
<para>Теперь запустите тесты от пользователя<systemitem
class="username">nobody</systemitem>:</para>
<screen><userinput remap="test">su nobody -s /bin/bash -c "LANG=en_US.UTF-8 make -j1 test" &amp;> vim-test.log</userinput></screen>
<para>Набор тестов выводит на экран множество двоичных данных. Это может
     вызвать проблемы с настройками текущего терминала. Проблема может быть
     решена путем перенаправления вывода в файл журнала, как показано выше.
     успешный тест приведет к словам ALL DONE в файле журнала
     по окончании процесса тестирования.</para>
<para>Установите пакет:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Многие пользователи используют команду <command>vi</command> вместо <command>vim</command>. Чтобы сохранить такую возможность, необходимо создать символическую ссылку для бинарного файла и для справочных руководств для предоставляемых языков:</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>По умолчанию, документация к пакету устанавливается в каталог <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>Если в дальнейшем планируется установка X Window System (конная система, обеспечивающая стандартные инструменты и протоколы для построения графического интерфейса пользователя. Используется в UNIX-подобных ОС) в системе LFS, то пакет потребуется повторно перекомпилировать, после установки X Window System. Vim
     поставляется с графическим интерфейсом который зависит от системы X и некоторых дополнительных библиотек. Для более полного ознакомления с процессом установки, изучите информацию в книге BLFS по следующей ссылке: <ulink
url="&blfs-book;postlfs/vim.html"/>.</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>По умолчанию, <command>vim</command> выполняется в vi-несовместимом режиме. Это может быть новым для пользователей, которые использовали другие редакторы ранее. Настройка<quote>nocompatible</quote> добавлена ниже, чтобы подчеркнуть тот факт, что будет использоваться новое поведение. Он также напоминает тем, кто хотел бы перейти в <quote>совместимый</quote> режим, что он должен быть первым параметром в файле конфигурации. Это необходимо, поскольку он изменяет другие параметры и переопределения должны быть указаны только после этого параметра. Создайте файл конфигурации vim по умолчанию, выполнив следующие действия:</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>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>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 следующую команду:</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>
<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>
</note>
</sect2>
<sect2 id="contents-vim" role="content">
<title>Содержимое пакета Vim</title>
<segmentedlist>
<segtitle>Установленные программы</segtitle>
<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>/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>Starts <command>vim</command> in ex mode</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>Is a restricted version of <command>view</command>; no shell
commands can be started and <command>view</command> cannot be
suspended</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>Is a restricted version of <command>vim</command>; no shell
commands can be started and <command>vim</command> cannot be
suspended</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>Link to <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>Starts <command>vim</command> in read-only mode</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>Is the editor</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>Edits two or three versions of a file with <command>vim</command>
and shows differences</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>Teaches the basic keys and commands of
<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>Creates a hex dump of the given file; it can
also do the reverse, so it can be used for binary patching</para>
<indexterm zone="ch-system-vim xxd">
<primary sortas="b-xxd">xxd</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>