vim.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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>Change the default location of the
  44. <filename>vimrc</filename> configuration file to <filename
  45. class="directory">/etc</filename>:</para>
  46. <screen><userinput remap="pre">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h</userinput></screen>
  47. <para>Now prepare Vim for compilation:</para>
  48. <screen><userinput remap="configure">./configure --prefix=/usr --enable-multibyte</userinput></screen>
  49. <variablelist>
  50. <title>The meaning of the configure options:</title>
  51. <varlistentry>
  52. <term><parameter>--enable-multibyte</parameter></term>
  53. <listitem>
  54. <para>This switch enables support for editing files in multibyte
  55. character encodings. This is needed if using a locale with a
  56. multibyte character set. This switch is also helpful to be able
  57. to edit text files initially created in Linux distributions like
  58. Fedora that use UTF-8 as a default character set.</para>
  59. </listitem>
  60. </varlistentry>
  61. </variablelist>
  62. <para>Compile the package:</para>
  63. <screen><userinput remap="make">make</userinput></screen>
  64. <para>To test the results, issue:</para>
  65. <screen><userinput remap="test">make test</userinput></screen>
  66. <para>However, this test suite outputs a lot of binary data to the screen,
  67. which can cause issues with the settings of the current terminal. This can
  68. be resolved by redirecting the output to a log file.</para>
  69. <para>Install the package:</para>
  70. <screen><userinput remap="install">make install</userinput></screen>
  71. <para>Many users are used to using <command>vi</command> instead of
  72. <command>vim</command>. To allow execution of <command>vim</command>
  73. when users habitually enter <command>vi</command>, create a
  74. symlink for both the binary and the man page in the provided
  75. languages:</para>
  76. <screen><userinput remap="install">ln -sv vim /usr/bin/vi
  77. for L in /usr/share/man/{,*/}man1/vim.1; do
  78. ln -sv vim.1 $(dirname $L)/vi.1
  79. done</userinput></screen>
  80. <para>By default, Vim's documentation is installed in <filename
  81. class="directory">/usr/share/vim</filename>. The following symlink
  82. allows the documentation to be accessed via <filename
  83. class="directory">/usr/share/doc/vim-&vim-version;</filename>, making
  84. it consistent with the location of documentation for other packages:</para>
  85. <screen><userinput remap="install">ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version;</userinput></screen>
  86. <para>If an X Window System is going to be installed on the LFS
  87. system, it may be necessary to recompile Vim after installing X. Vim
  88. comes with a GUI version of the editor that requires X and some
  89. additional libraries to be installed. For more information on this
  90. process, refer to the Vim documentation and the Vim installation page
  91. in the BLFS book at <ulink
  92. url="&blfs-root;view/svn/postlfs/editors.html#postlfs-editors-vim"/>.</para>
  93. </sect2>
  94. <sect2 id="conf-vim" role="configuration">
  95. <title>Configuring Vim</title>
  96. <indexterm zone="conf-vim">
  97. <primary sortas="e-/etc/vimrc">/etc/vimrc</primary>
  98. </indexterm>
  99. <para>By default, <command>vim</command> runs in vi-incompatible mode.
  100. This may be new to users who have used other editors in the past. The
  101. <quote>nocompatible</quote> setting is included below to highlight the
  102. fact that a new behavior is being used. It also reminds those who would
  103. change to <quote>compatible</quote> mode that it should be the first
  104. setting in the configuration file. This is necessary because it changes
  105. other settings, and overrides must come after this setting. Create a default
  106. <command>vim</command> configuration file by running the following:</para>
  107. <screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"
  108. <literal>" Begin /etc/vimrc
  109. set nocompatible
  110. set backspace=2
  111. syntax on
  112. if (&amp;term == "iterm") || (&amp;term == "putty")
  113. set background=dark
  114. endif
  115. " End /etc/vimrc</literal>
  116. EOF</userinput></screen>
  117. <para>The <parameter>set nocompatible</parameter> setting makes
  118. <command>vim</command> behave in a more useful way (the default) than
  119. the vi-compatible manner. Remove the <quote>no</quote> to keep the
  120. old <command>vi</command> behavior. The <parameter>set
  121. backspace=2</parameter> setting allows backspacing over line breaks,
  122. autoindents, and the start of insert. The <parameter>syntax
  123. on</parameter> parameter enables vim's syntax highlighting. Finally,
  124. the <emphasis>if</emphasis> statement with the <parameter>set
  125. background=dark</parameter> setting corrects <command>vim</command>'s
  126. guess about the background color of some terminal emulators. This
  127. gives the highlighting a better color scheme for use on the black
  128. background of these programs.</para>
  129. <para>Documentation for other available options can be obtained by
  130. running the following command:</para>
  131. <screen role="nodump"><userinput>vim -c ':options'</userinput></screen>
  132. <note>
  133. <para>By default, Vim only installs spell files for the English language.
  134. To install spell files for your preferred language, download the
  135. <filename>*.spl</filename> and optionally, the <filename>*.sug</filename>
  136. files for your language and character encoding from <ulink
  137. url="ftp://ftp.vim.org/pub/vim/runtime/spell/"/> and save them to
  138. <filename class='directory'>/usr/share/&vim-docdir;/spell/</filename>.</para>
  139. <para>To use these spell files, some configuration in
  140. <filename>/etc/vimrc</filename> is needed, e.g.:</para>
  141. <screen><literal>set spelllang=en,ru
  142. set spell</literal></screen>
  143. <para>For more information, see the appropriate README file located
  144. at the URL above.</para>
  145. </note>
  146. </sect2>
  147. <sect2 id="contents-vim" role="content">
  148. <title>Contents of Vim</title>
  149. <segmentedlist>
  150. <segtitle>Installed programs</segtitle>
  151. <seglistitem>
  152. <seg>ex (link to vim), rview (link to vim), rvim (link to vim),
  153. vi (link to vim), view (link to vim), vim,
  154. vimdiff (link to vim), vimtutor, and xxd</seg>
  155. </seglistitem>
  156. </segmentedlist>
  157. <variablelist>
  158. <bridgehead renderas="sect3">Short Descriptions</bridgehead>
  159. <?dbfo list-presentation="list"?>
  160. <?dbhtml list-presentation="table"?>
  161. <varlistentry id="ex">
  162. <term><command>ex</command></term>
  163. <listitem>
  164. <para>Starts <command>vim</command> in ex mode</para>
  165. <indexterm zone="ch-system-vim ex">
  166. <primary sortas="b-ex">ex</primary>
  167. </indexterm>
  168. </listitem>
  169. </varlistentry>
  170. <varlistentry id="rview">
  171. <term><command>rview</command></term>
  172. <listitem>
  173. <para>Is a restricted version of <command>view</command>; no shell
  174. commands can be started and <command>view</command> cannot be
  175. suspended</para>
  176. <indexterm zone="ch-system-vim rview">
  177. <primary sortas="b-rview">rview</primary>
  178. </indexterm>
  179. </listitem>
  180. </varlistentry>
  181. <varlistentry id="rvim">
  182. <term><command>rvim</command></term>
  183. <listitem>
  184. <para>Is a restricted version of <command>vim</command>; no shell
  185. commands can be started and <command>vim</command> cannot be
  186. suspended</para>
  187. <indexterm zone="ch-system-vim rvim">
  188. <primary sortas="b-rvim">rvim</primary>
  189. </indexterm>
  190. </listitem>
  191. </varlistentry>
  192. <varlistentry id="vi">
  193. <term><command>vi</command></term>
  194. <listitem>
  195. <para>Link to <command>vim</command></para>
  196. <indexterm zone="ch-system-vim vi">
  197. <primary sortas="b-vi">vi</primary>
  198. </indexterm>
  199. </listitem>
  200. </varlistentry>
  201. <varlistentry id="view">
  202. <term><command>view</command></term>
  203. <listitem>
  204. <para>Starts <command>vim</command> in read-only mode</para>
  205. <indexterm zone="ch-system-vim view">
  206. <primary sortas="b-view">view</primary>
  207. </indexterm>
  208. </listitem>
  209. </varlistentry>
  210. <varlistentry id="vim">
  211. <term><command>vim</command></term>
  212. <listitem>
  213. <para>Is the editor</para>
  214. <indexterm zone="ch-system-vim vim">
  215. <primary sortas="b-vim">vim</primary>
  216. </indexterm>
  217. </listitem>
  218. </varlistentry>
  219. <varlistentry id="vimdiff">
  220. <term><command>vimdiff</command></term>
  221. <listitem>
  222. <para>Edits two or three versions of a file with <command>vim</command>
  223. and show differences</para>
  224. <indexterm zone="ch-system-vim vimdiff">
  225. <primary sortas="b-vimdiff">vimdiff</primary>
  226. </indexterm>
  227. </listitem>
  228. </varlistentry>
  229. <varlistentry id="vimtutor">
  230. <term><command>vimtutor</command></term>
  231. <listitem>
  232. <para>Teaches the basic keys and commands of
  233. <command>vim</command></para>
  234. <indexterm zone="ch-system-vim vimtutor">
  235. <primary sortas="b-vimtutor">vimtutor</primary>
  236. </indexterm>
  237. </listitem>
  238. </varlistentry>
  239. <varlistentry id="xxd">
  240. <term><command>xxd</command></term>
  241. <listitem>
  242. <para>Creates a hex dump of the given file; it can
  243. also do the reverse, so it can be used for binary patching</para>
  244. <indexterm zone="ch-system-vim xxd">
  245. <primary sortas="b-xxd">xxd</primary>
  246. </indexterm>
  247. </listitem>
  248. </varlistentry>
  249. </variablelist>
  250. </sect2>
  251. </sect1>