vim.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  3. <!ENTITY % general-entities SYSTEM "../general.ent">
  4. %general-entities;
  5. ]>
  6. <sect1 id="ch-system-vim" xreflabel="Vim" role="wrap">
  7. <title>Vim-&vim-version;</title>
  8. <?dbhtml filename="vim.html"?>
  9. <indexterm zone="ch-system-vim"><primary sortas="a-Vim">Vim</primary></indexterm>
  10. <sect2 role="package"><title/>
  11. <para>The Vim package contains a powerful text editor.</para>
  12. <segmentedlist>
  13. <segtitle>&buildtime;</segtitle>
  14. <segtitle>&diskspace;</segtitle>
  15. <seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem>
  16. </segmentedlist>
  17. <segmentedlist>
  18. <segtitle>Vim installation depends on</segtitle>
  19. <seglistitem><seg>Bash, Binutils, Coreutils, Diffutils,
  20. GCC, Glibc, Grep, Make, Ncurses, Sed</seg></seglistitem>
  21. </segmentedlist>
  22. <tip>
  23. <title>Alternatives to Vim</title>
  24. <para>If you prefer another editor -- like Emacs, Joe, or Nano -- to Vim,
  25. have a look at <ulink url="&blfs-root;view/stable/postlfs/editors.html"/> for
  26. suggested installation instructions.</para>
  27. </tip>
  28. </sect2>
  29. <sect2 role="installation">
  30. <title>Installation of Vim</title>
  31. <para>First, unpack both
  32. <filename>vim-&vim-version;.tar.bz2</filename> and (optionally)
  33. <filename>vim-&vim-version;-lang.tar.gz</filename> archives into the same
  34. directory. Then change the default locations of the <filename>vimrc</filename> and
  35. <filename>gvimrc</filename> configuration files to <filename class="directory">/etc</filename>.</para>
  36. <screen><userinput>echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h
  37. echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' &gt;&gt; src/feature.h</userinput></screen>
  38. <para>Now prepare Vim for compilation:</para>
  39. <screen><userinput>./configure --prefix=/usr --enable-multibyte</userinput></screen>
  40. <para>The optional but highly recommended
  41. <parameter>--enable-multibyte</parameter> switch
  42. includes support for editing files in multibyte character encodings into
  43. <command>vim</command>.
  44. It is needed for those people who ignore our recommendation not to
  45. use LFS in locales with multibyte character sets. It is also needed for
  46. people who want to be able to edit text files initially created
  47. in Linux distributions like Fedora Core
  48. that use UTF-8 as a default character set.</para>
  49. <para>Compile the package:</para>
  50. <screen><userinput>make</userinput></screen>
  51. <para>To test the results, you can issue:
  52. <userinput>make test</userinput>. However, this test suite outputs a lot of
  53. seemingly garbage characters to the screen, and this can wreak havoc with the
  54. settings of the current terminal. Therefore the running of the test suite here
  55. is strictly optional.</para>
  56. <para>Now install the package:</para>
  57. <screen><userinput>make install</userinput></screen>
  58. <para>Many users are used to using <command>vi</command>, instead of
  59. <command>vim</command>. To let them execute <command>vim</command> when
  60. they habitually enter <command>vi</command>, create a symlink:</para>
  61. <screen><userinput>ln -s vim /usr/bin/vi</userinput></screen>
  62. <para>If you are going to install the X Window system on your LFS system, you
  63. may want to re-compile Vim after having installed X. Vim comes with a nice GUI
  64. version of the editor that requires X and a few other libraries to be
  65. installed. For more information read the Vim documentation.</para>
  66. </sect2>
  67. <sect2 id="conf-vim" role="configuration"><title>Configuring Vim</title>
  68. <indexterm zone="conf-vim"><primary sortas="e-/etc/vim">/etc/vim</primary></indexterm>
  69. <para>By default, <command>vim</command> runs in vi-incompatible mode. Some
  70. people might not like this, but we prefer to run <command>vim</command> in its
  71. own mode (else we wouldn't have included it in this book, but the original
  72. <command>vi</command>). We've included the setting of <quote>nocompatible</quote>
  73. below to high-light the fact that the new behavior is being used. It
  74. also reminds those who would change to <quote>compatible</quote> mode that it should
  75. appear first because it changes other settings and overrides must come
  76. after this setting. Create a default vim configuration file by running
  77. the following:</para>
  78. <screen><userinput>cat &gt; /etc/vimrc &lt;&lt; "EOF"
  79. " Begin /etc/vimrc
  80. set nocompatible
  81. set backspace=2
  82. syntax on
  83. <!-- set fileencodings=ucs-bom,utf-8,<replaceable>[your-8-bit-charset]</replaceable> -->
  84. if (&amp;term == "iterm") || (&amp;term == "putty")
  85. set background=dark
  86. endif
  87. " End /etc/vimrc
  88. EOF</userinput></screen>
  89. <para>The <parameter>set nocompatible</parameter> makes
  90. <command>vim</command> behave in a more useful way (the default) than the
  91. vi-compatible manner. Remove the <quote>no</quote> if you want the old <command>vi</command>
  92. behavior. The <parameter>set backspace=2</parameter> allows
  93. backspacing over line breaks, autoindents and the start of insert. The
  94. <parameter>syntax on</parameter> enables <command>vim</command>'s
  95. syntax highliting.
  96. <!-- XXX: the ascii-only files are considered to be in utf-8 - that's not what
  97. one expects . That's why fileencodings stuff is commented out for now
  98. The <parameter>set fileencodings=...</parameter> makes
  99. <command>vim</command> capable of automatically detecting the character
  100. set of the file being edited (replace
  101. "<replaceable>[your-8-bit-charset]</replaceable>"
  102. with the value appropriate for your country, e.g. iso-8859-15 in Italy).
  103. This line is useful because bleeding-edge distributions
  104. like Fedora Core use UTF-8, and conservative ones like Debian
  105. use traditional 8-bit encodings for text files. If you have not
  106. passed the <parameter>- -enable-multibyte</parameter> switch to the
  107. <command>./configure</command> command above, this line will not work. -->
  108. Finally, the <emphasis>if</emphasis> statement with the
  109. <parameter>set background=dark</parameter> corrects <command>vim</command>'s
  110. guess about the background color of some terminal emulators. This gives the
  111. highliting a better color scheme for use on the black background of
  112. these programs.
  113. </para>
  114. <para>Documentation for other available options can be obtained by running
  115. the following command:</para>
  116. <screen><userinput>vim -c ':options'</userinput></screen>
  117. </sect2>
  118. <sect2 id="contents-vim" role="content"><title>Contents of Vim</title>
  119. <segmentedlist>
  120. <segtitle>Installed programs</segtitle>
  121. <seglistitem><seg>efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk,
  122. pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim),
  123. view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh,
  124. vimtutor and xxd</seg></seglistitem>
  125. </segmentedlist>
  126. <variablelist><title>Short descriptions</title>
  127. <varlistentry id="efm_filter.pl">
  128. <term><command>efm_filter.pl</command></term>
  129. <listitem>
  130. <indexterm zone="ch-system-vim efm_filter.pl"><primary sortas="b-efm_filter.pl">efm_filter.pl</primary></indexterm>
  131. <para>is a filter for creating an error file that can be read by <command>vim</command>.</para>
  132. </listitem>
  133. </varlistentry>
  134. <varlistentry id="efm_perl.pl">
  135. <term><command>efm_perl.pl</command></term>
  136. <listitem>
  137. <indexterm zone="ch-system-vim efm_perl.pl"><primary sortas="b-efm_perl.pl">efm_perl.pl</primary></indexterm>
  138. <para>reformats the error messages of the
  139. Perl interpreter for use with the <quote>quickfix</quote> mode of <command>vim</command>.</para>
  140. </listitem>
  141. </varlistentry>
  142. <varlistentry id="ex">
  143. <term><command>ex</command></term>
  144. <listitem>
  145. <indexterm zone="ch-system-vim ex"><primary sortas="b-ex">ex</primary></indexterm>
  146. <para>starts <command>vim</command> in ex mode.</para>
  147. </listitem>
  148. </varlistentry>
  149. <varlistentry id="less.sh">
  150. <term><command>less.sh</command></term>
  151. <listitem>
  152. <indexterm zone="ch-system-vim less.sh"><primary sortas="b-less.sh">less.sh</primary></indexterm>
  153. <para>is a script that starts <command>vim</command> with less.vim.</para>
  154. </listitem>
  155. </varlistentry>
  156. <varlistentry id="mve.awk">
  157. <term><command>mve.awk</command></term>
  158. <listitem>
  159. <indexterm zone="ch-system-vim mve.awk"><primary sortas="b-mve.awk">mve.awk</primary></indexterm>
  160. <para>processes <command>vim</command> errors.</para>
  161. </listitem>
  162. </varlistentry>
  163. <varlistentry id="pltags.pl">
  164. <term><command>pltags.pl</command></term>
  165. <listitem>
  166. <indexterm zone="ch-system-vim pltags.pl"><primary sortas="b-pltags.pl">pltags.pl</primary></indexterm>
  167. <para>creates a tags file for Perl code, for use by <command>vim</command>.</para>
  168. </listitem>
  169. </varlistentry>
  170. <varlistentry id="ref">
  171. <term><command>ref</command></term>
  172. <listitem>
  173. <indexterm zone="ch-system-vim ref"><primary sortas="b-ref">ref</primary></indexterm>
  174. <para>checks the spelling of arguments.</para>
  175. </listitem>
  176. </varlistentry>
  177. <varlistentry id="rview">
  178. <term><command>rview</command></term>
  179. <listitem>
  180. <indexterm zone="ch-system-vim rview"><primary sortas="b-rview">rview</primary></indexterm>
  181. <para>is a restricted version of <command>view</command>: no shell
  182. commands can be started and <command>view</command> can't be suspended.</para>
  183. </listitem>
  184. </varlistentry>
  185. <varlistentry id="rvim">
  186. <term><command>rvim</command></term>
  187. <listitem>
  188. <indexterm zone="ch-system-vim rvim"><primary sortas="b-rvim">rvim</primary></indexterm>
  189. <para>is a restricted version of <command>vim</command>: no shell
  190. commands can be started and <command>vim</command> can't be suspended.</para>
  191. </listitem>
  192. </varlistentry>
  193. <varlistentry id="shtags.pl">
  194. <term><command>shtags.pl</command></term>
  195. <listitem>
  196. <indexterm zone="ch-system-vim shtags.pl"><primary sortas="b-shtags.pl">shtags.pl</primary></indexterm>
  197. <para>generates a tag file for Perl scripts.</para>
  198. </listitem>
  199. </varlistentry>
  200. <varlistentry id="tcltags">
  201. <term><command>tcltags</command></term>
  202. <listitem>
  203. <indexterm zone="ch-system-vim tcltags"><primary sortas="b-tcltags">tcltags</primary></indexterm>
  204. <para>generates a tag file for TCL code.</para>
  205. </listitem>
  206. </varlistentry>
  207. <varlistentry id="view">
  208. <term><command>view</command></term>
  209. <listitem>
  210. <indexterm zone="ch-system-vim view"><primary sortas="b-view">view</primary></indexterm>
  211. <para>starts <command>vim</command> in read-only mode.</para>
  212. </listitem>
  213. </varlistentry>
  214. <varlistentry id="vim">
  215. <term><command>vim</command></term>
  216. <listitem>
  217. <indexterm zone="ch-system-vim vim"><primary sortas="b-vim">vim</primary></indexterm>
  218. <para>is the editor.</para>
  219. </listitem>
  220. </varlistentry>
  221. <varlistentry id="vim132">
  222. <term><command>vim132</command></term>
  223. <listitem>
  224. <indexterm zone="ch-system-vim vim132"><primary sortas="b-vim132">vim132</primary></indexterm>
  225. <para>starts <command>vim</command> with the terminal in 132-column mode.</para>
  226. </listitem>
  227. </varlistentry>
  228. <varlistentry id="vim2html.pl">
  229. <term><command>vim2html.pl</command></term>
  230. <listitem>
  231. <indexterm zone="ch-system-vim vim2html.pl"><primary sortas="b-vim2html.pl">vim2html.pl</primary></indexterm>
  232. <para>converts Vim documentation to HTML.</para>
  233. </listitem>
  234. </varlistentry>
  235. <varlistentry id="vimdiff">
  236. <term><command>vimdiff</command></term>
  237. <listitem>
  238. <indexterm zone="ch-system-vim vimdiff"><primary sortas="b-vimdiff">vimdiff</primary></indexterm>
  239. <para>edits two or three versions of a file with <command>vim</command> and show differences.</para>
  240. </listitem>
  241. </varlistentry>
  242. <varlistentry id="vimm">
  243. <term><command>vimm</command></term>
  244. <listitem>
  245. <indexterm zone="ch-system-vim vimm"><primary sortas="b-vimm">vimm</primary></indexterm>
  246. <para>enables the DEC locator input model on a remote terminal.</para>
  247. </listitem>
  248. </varlistentry>
  249. <varlistentry id="vimspell.sh">
  250. <term><command>vimspell.sh</command></term>
  251. <listitem>
  252. <indexterm zone="ch-system-vim vimspell.sh"><primary sortas="b-vimspell.sh">vimspell.sh</primary></indexterm>
  253. <para>is a script which spells a file and generates the syntax statements necessary
  254. to highlight in <command>vim</command>. This script requires the old Unix <command>spell</command>
  255. command, which is provided neither in LFS nor in BLFS.</para>
  256. </listitem>
  257. </varlistentry>
  258. <varlistentry id="vimtutor">
  259. <term><command>vimtutor</command></term>
  260. <listitem>
  261. <indexterm zone="ch-system-vim vimtutor"><primary sortas="b-vimtutor">vimtutor</primary></indexterm>
  262. <para>teaches you the basic keys and commands of <command>vim</command>.</para>
  263. </listitem>
  264. </varlistentry>
  265. <varlistentry id="xxd">
  266. <term><command>xxd</command></term>
  267. <listitem>
  268. <indexterm zone="ch-system-vim xxd"><primary sortas="b-xxd">xxd</primary></indexterm>
  269. <para>makes a hex dump of the given file. It can
  270. also do the reverse, so it can be used for binary patching.</para>
  271. </listitem>
  272. </varlistentry>
  273. </variablelist>
  274. </sect2>
  275. </sect1>