vim.xml 11 KB

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