vim.xml 11 KB

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