vim.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-vim" role="wrap">
  8. <?dbhtml filename="vim.html"?>
  9. <sect1info condition="script">
  10. <productname>vim</productname>
  11. <productnumber>&vim-version;</productnumber>
  12. <address>&vim-url;<otheraddr>&vim-lang-url;</otheraddr></address>
  13. </sect1info>
  14. <title>Vim-&vim-version;</title>
  15. <indexterm zone="ch-system-vim">
  16. <primary sortas="a-Vim">Vim</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>The Vim package contains a powerful text editor.</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&vim-ch6-sbu;</seg>
  26. <seg>&vim-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. <tip>
  30. <title>Alternatives to Vim</title>
  31. <para>If you prefer another editor&mdash;such as Emacs, Joe, or
  32. Nano&mdash;please refer to <ulink
  33. url="&blfs-root;view/svn/postlfs/editors.html"/> for suggested
  34. installation instructions.</para>
  35. </tip>
  36. </sect2>
  37. <sect2 role="installation">
  38. <title>Installation of Vim</title>
  39. <para>First, unpack both
  40. <filename>vim-&vim-version;.tar.bz2</filename> and (optionally)
  41. <filename>vim-&vim-version;-lang.tar.gz</filename> archives into the
  42. same directory.</para>
  43. <para>Apply a patch which fixes various issues already found and fixed by
  44. the upstream maintainers since the inital release of Vim-&vim-version;:
  45. </para>
  46. <screen><userinput remap="pre">patch -Np1 -i ../&vim-fixes-patch;</userinput></screen>
  47. <!--
  48. <para>This version of Vim installs translated man pages and places
  49. them into directories that will not be searched by Man-DB. Patch Vim
  50. so that it installs its man pages into searchable directories and
  51. ultimately allows Man-DB to transcode the page into the desired format
  52. at run-time:</para>
  53. <screen><userinput remap="pre">patch -Np1 -i ../&vim-mandir-patch;</userinput></screen>
  54. -->
  55. <para>Change the default location of the
  56. <filename>vimrc</filename> configuration file to <filename
  57. class="directory">/etc</filename>:</para>
  58. <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h</userinput></screen>
  59. <para>Now prepare Vim for compilation:</para>
  60. <screen><userinput remap="configure">./configure --prefix=/usr --enable-multibyte</userinput></screen>
  61. <variablelist>
  62. <title>The meaning of the configure options:</title>
  63. <varlistentry>
  64. <term><parameter>--enable-multibyte</parameter></term>
  65. <listitem>
  66. <para>This switch enables support for editing files in multibyte
  67. character encodings. This is needed if using a locale with a
  68. multibyte character set. This switch is also helpful to be able
  69. to edit text files initially created in Linux distributions like
  70. Fedora Core that use UTF-8 as a default character set.</para>
  71. </listitem>
  72. </varlistentry>
  73. </variablelist>
  74. <para>Compile the package:</para>
  75. <screen><userinput remap="make">make</userinput></screen>
  76. <para>To test the results, issue:</para>
  77. <screen><userinput remap="test">make test</userinput></screen>
  78. <para>However, this test suite outputs a lot of binary data to the screen,
  79. which can cause issues with the settings of the current terminal. This can
  80. be resolved by redirecting the output to a log file.</para>
  81. <para>Install the package:</para>
  82. <screen><userinput remap="install">make install</userinput></screen>
  83. <para>Many users are used to using <command>vi</command> instead of
  84. <command>vim</command>. To allow execution of <command>vim</command>
  85. when users habitually enter <command>vi</command>, create a
  86. symlink for both the binary and the man page in the provided
  87. languages:</para>
  88. <screen><userinput remap="install">ln -sv vim /usr/bin/vi
  89. for L in /usr/share/man/{,*/}man1/vim.1; do
  90. ln -sv vim.1 $(dirname $L)/vi.1
  91. done</userinput></screen>
  92. <para>By default, Vim's documentation is installed in <filename
  93. class="directory">/usr/share/vim</filename>. The following symlink
  94. allows the documentation to be accessed via <filename
  95. class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
  96. it consistent with the location of documentation for other packages:</para>
  97. <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
  98. <para>If an X Window System is going to be installed on the LFS
  99. system, it may be necessary to recompile Vim after installing X. Vim
  100. comes with a GUI version of the editor that requires X and some
  101. additional libraries to be installed. For more information on this
  102. process, refer to the Vim documentation and the Vim installation page
  103. in the BLFS book at <ulink
  104. url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</para>
  105. </sect2>
  106. <sect2 id="conf-vim" role="configuration">
  107. <title>Configuring Vim</title>
  108. <indexterm zone="conf-vim">
  109. <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
  110. </indexterm>
  111. <para>By default, <command>vim</command> runs in vi-incompatible mode.
  112. This may be new to users who have used other editors in the past. The
  113. <quote>nocompatible</quote> setting is included below to highlight the
  114. fact that a new behavior is being used. It also reminds those who would
  115. change to <quote>compatible</quote> mode that it should be the first
  116. setting in the configuration file. This is necessary because it changes
  117. other settings, and overrides must come after this setting. Create a default
  118. <command>vim</command> configuration file by running the following:</para>
  119. <screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"
  120. <literal>" Begin /etc/vimrc
  121. set nocompatible
  122. set backspace=2
  123. syntax on
  124. if (&amp;term == "iterm") || (&amp;term == "putty")
  125. set background=dark
  126. endif
  127. " End /etc/vimrc</literal>
  128. EOF</userinput></screen>
  129. <para>The <parameter>set nocompatible</parameter> setting makes
  130. <command>vim</command> behave in a more useful way (the default) than
  131. the vi-compatible manner. Remove the <quote>no</quote> to keep the
  132. old <command>vi</command> behavior. The <parameter>set
  133. backspace=2</parameter> setting allows backspacing over line breaks,
  134. autoindents, and the start of insert. The <parameter>syntax
  135. on</parameter> parameter enables vim's syntax highlighting. Finally,
  136. the <emphasis>if</emphasis> statement with the <parameter>set
  137. background=dark</parameter> setting corrects <command>vim</command>'s
  138. guess about the background color of some terminal emulators. This
  139. gives the highlighting a better color scheme for use on the black
  140. background of these programs.</para>
  141. <para>Documentation for other available options can be obtained by
  142. running the following command:</para>
  143. <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
  144. <note>
  145. <para>By default, Vim only installs spell files for the English language.
  146. To install spell files for your preferred language, download the
  147. <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
  148. files for your language and character encoding from <ulink
  149. url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
  150. <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
  151. <para>To use these spell files, some configuration in
  152. <filename>/etc/vimrc</filename> is needed, e.g.:</para>
  153. <screen><literal>set spelllang=en,ru
  154. set spell</literal></screen>
  155. <para>For more information, see the appropriate README file located
  156. at the URL above.</para>
  157. </note>
  158. </sect2>
  159. <sect2 id="contents-vim" role="content">
  160. <title>Contents of Vim</title>
  161. <segmentedlist>
  162. <segtitle>Installed programs</segtitle>
  163. <seglistitem>
  164. <seg>ex (link to vim), rview (link to vim), rvim (link to vim),
  165. vi (link to vim), view (link to vim), vim,
  166. vimdiff (link to vim), vimtutor, and xxd</seg>
  167. </seglistitem>
  168. </segmentedlist>
  169. <variablelist>
  170. <bridgehead renderas="sect3">Short Descriptions</bridgehead>
  171. <?dbfo list-presentation="list"?>
  172. <?dbhtml list-presentation="table"?>
  173. <varlistentry id="ex">
  174. <term><command>ex</command></term>
  175. <listitem>
  176. <para>Starts <command>vim</command> in ex mode</para>
  177. <indexterm zone="ch-system-vim ex">
  178. <primary sortas="b-ex">ex</primary>
  179. </indexterm>
  180. </listitem>
  181. </varlistentry>
  182. <varlistentry id="rview">
  183. <term><command>rview</command></term>
  184. <listitem>
  185. <para>Is a restricted version of <command>view</command>; no shell
  186. commands can be started and <command>view</command> cannot be
  187. suspended</para>
  188. <indexterm zone="ch-system-vim rview">
  189. <primary sortas="b-rview">rview</primary>
  190. </indexterm>
  191. </listitem>
  192. </varlistentry>
  193. <varlistentry id="rvim">
  194. <term><command>rvim</command></term>
  195. <listitem>
  196. <para>Is a restricted version of <command>vim</command>; no shell
  197. commands can be started and <command>vim</command> cannot be
  198. suspended</para>
  199. <indexterm zone="ch-system-vim rvim">
  200. <primary sortas="b-rvim">rvim</primary>
  201. </indexterm>
  202. </listitem>
  203. </varlistentry>
  204. <varlistentry id="vi">
  205. <term><command>vi</command></term>
  206. <listitem>
  207. <para>Link to <command>vim</command></para>
  208. <indexterm zone="ch-system-vim vi">
  209. <primary sortas="b-vi">vi</primary>
  210. </indexterm>
  211. </listitem>
  212. </varlistentry>
  213. <varlistentry id="view">
  214. <term><command>view</command></term>
  215. <listitem>
  216. <para>Starts <command>vim</command> in read-only mode</para>
  217. <indexterm zone="ch-system-vim view">
  218. <primary sortas="b-view">view</primary>
  219. </indexterm>
  220. </listitem>
  221. </varlistentry>
  222. <varlistentry id="vim">
  223. <term><command>vim</command></term>
  224. <listitem>
  225. <para>Is the editor</para>
  226. <indexterm zone="ch-system-vim vim">
  227. <primary sortas="b-vim">vim</primary>
  228. </indexterm>
  229. </listitem>
  230. </varlistentry>
  231. <varlistentry id="vimdiff">
  232. <term><command>vimdiff</command></term>
  233. <listitem>
  234. <para>Edits two or three versions of a file with <command>vim</command>
  235. and show differences</para>
  236. <indexterm zone="ch-system-vim vimdiff">
  237. <primary sortas="b-vimdiff">vimdiff</primary>
  238. </indexterm>
  239. </listitem>
  240. </varlistentry>
  241. <varlistentry id="vimtutor">
  242. <term><command>vimtutor</command></term>
  243. <listitem>
  244. <para>Teaches the basic keys and commands of
  245. <command>vim</command></para>
  246. <indexterm zone="ch-system-vim vimtutor">
  247. <primary sortas="b-vimtutor">vimtutor</primary>
  248. </indexterm>
  249. </listitem>
  250. </varlistentry>
  251. <varlistentry id="xxd">
  252. <term><command>xxd</command></term>
  253. <listitem>
  254. <para>Creates a hex dump of the given file; it can
  255. also do the reverse, so it can be used for binary patching</para>
  256. <indexterm zone="ch-system-vim xxd">
  257. <primary sortas="b-xxd">xxd</primary>
  258. </indexterm>
  259. </listitem>
  260. </varlistentry>
  261. </variablelist>
  262. </sect2>
  263. </sect1>