vim.xml 11 KB

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