vim.xml 10 KB

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