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