📄 vim.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content= "application/xhtml+xml; charset=iso-8859-1" /> <title> 10.17. Vim-6.4 </title> <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /> <link rel="stylesheet" href="../stylesheets/lfs-print.css" type= "text/css" media="print" /> </head> <body id="lfs" class="CLFS-SVN-20060417-MIPS"> <div class="navheader"> <div class="headertitles"> <h4> Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS </h4> <h3> Chapter 10. Installing Basic System Software </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="readline.html" title="Readline-5.1">Prev</a> <p> Readline-5.1 </p> </li> <li class="next"> <a accesskey="n" href="m4.html" title="M4-1.4.4">Next</a> <p> M4-1.4.4 </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 10. Installing Basic System Software">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a> </li> </ul> </div> <div class="wrap" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="sect1"> 10.17. Vim-6.4 </h1> </div> <div class="package" lang="en" xml:lang="en"> <p> The Vim package contains a powerful text editor. </p> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installation depends on:</span></strong> <span class="seg">Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, and Sed</span> </div> </div> </div> <div class="tip"> <div class="admonhead"> <img alt="[Tip]" src="../images/tip.png" /> <h3 class="admontitle"> Alternatives to Vim </h3> </div> <div class="admonbody"> <p> If you prefer another editor—such as Emacs, Joe, or Nano—please refer to <a href= "http://www.linuxfromscratch.org/blfs/view/svn/postlfs/editors.html"> <i>http://www.linuxfromscratch.org/blfs/view/svn/postlfs/editors.html</i></a> for suggested installation instructions. </p> </div> </div> </div> <div class="installation" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 10.17.1. Installation of Vim </h2> </div> <p> First, unpack both <tt class="filename">vim-6.4.tar.bz2</tt> and (optionally) <tt class="filename">vim-6.4-lang.tar.gz</tt> archives into the same directory. Then, change the default location of the <tt class="filename">vimrc</tt> configuration file to <tt class= "filename">/etc</tt>: </p> <pre class="userinput"><kbd class="command">echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h</kbd></pre> <p> Prepare Vim for compilation: </p> <pre class="userinput"><kbd class="command">./configure --prefix=/usr --enable-multibyte</kbd></pre> <div class="variablelist"> <p class="title"> <b>The meaning of the configure options:</b> </p> <dl> <dt> <span class="term"><em class= "parameter"><tt>--enable-multibyte</tt></em></span> </dt> <dd> <p> This optional but highly recommended switch enables support for editing files in multibyte character encodings. This is needed if using a locale with a multibyte character set. This switch is also helpful to be able to edit text files initially created in Linux distributions like Fedora Core that use UTF-8 as a default character set. </p> </dd> </dl> </div> <p> Compile the package: </p> <pre class="userinput"><kbd class="command">make</kbd></pre> <p> To test the results, issue: <strong class="userinput"><tt>make test</tt></strong>. However, this test suite outputs a lot of binary data to the screen, which can cause issues with the settings of the current terminal. This can be resolved by redirecting the output to a log file. </p> <p> Install the package: </p> <pre class="userinput"><kbd class="command">make install</kbd></pre> <p> Many users are used to using <span><strong class= "command">vi</strong></span> instead of <span><strong class= "command">vim</strong></span>. To allow execution of <span><strong class="command">vim</strong></span> when users habitually enter <span><strong class="command">vi</strong></span>, create a symlink: </p> <pre class="userinput"><kbd class="command">ln -sv vim /usr/bin/vi</kbd></pre> <p> By default, Vim's documentation is installed in <tt class= "filename">/usr/share/vim</tt>. The following symlink allows the documentation to be accessed via <tt class= "filename">/usr/share/doc/vim-6.4</tt>, making it consistent with the location of documentation for other packages: </p> <pre class="userinput"><kbd class="command">ln -sv ../vim/vim64/doc /usr/share/doc/vim-6.4</kbd></pre> <p> If an X Window System is going to be installed on the LFS system, it may be necessary to recompile Vim after installing X. Vim comes with a GUI version of the editor that requires X and some additional libraries to be installed. For more information on this process, refer to the Vim documentation and the Vim installation page in the BLFS book at <a href= "http://www.linuxfromscratch.org/blfs/view/svn/postlfs/editors.html#postlfs-editors-vim"> <i>http://www.linuxfromscratch.org/blfs/view/svn/postlfs/editors.html#postlfs-editors-vim</i></a>. </p> </div> <div class="configuration" lang="en" xml:lang="en"> <div class="titlepage"> <a id="conf-vim" name="conf-vim"></a> <h2 class="sect2"> 10.17.2. Configuring Vim </h2> </div> <p> By default, <span><strong class="command">vim</strong></span> runs in vi-incompatible mode. This may be new to users who have used other editors in the past. The “<span class= "quote">nocompatible</span>” setting is included below to highlight the fact that a new behavior is being used. It also reminds those who would change to “<span class= "quote">compatible</span>” mode that it should be the first setting in the configuration file. This is necessary because it changes other settings, and overrides must come after this setting. Create a default <span><strong class="command">vim</strong></span> configuration file by running the following: </p> <pre class="userinput"><kbd class="command">cat > /etc/vimrc << "EOF"<tt class="literal">" Begin /etc/vimrcset nocompatibleset backspace=2syntax onif (&term == "iterm") || (&term == "putty") set background=darkendif" End /etc/vimrc</tt>EOF</kbd></pre> <p> The <em class="parameter"><tt>set nocompatible</tt></em> makes <span><strong class="command">vim</strong></span> behave in a more useful way (the default) than the vi-compatible manner. Remove the “<span class="quote">no</span>” to keep the old <span><strong class="command">vi</strong></span> behavior. The <em class="parameter"><tt>set backspace=2</tt></em> allows backspacing over line breaks, autoindents, and the start of insert. The <em class="parameter"><tt>syntax on</tt></em> enables vim's syntax highlighting. Finally, the <span class= "emphasis"><em>if</em></span> statement with the <em class= "parameter"><tt>set background=dark</tt></em> corrects <span><strong class="command">vim</strong></span>'s guess about the background color of some terminal emulators. This gives the highlighting a better color scheme for use on the black background of these programs. </p> <p> Documentation for other available options can be obtained by running the following command: </p> <pre class="userinput"><kbd class="command">vim -c ':options'</kbd></pre> </div> <div class="content" lang="en" xml:lang="en"> <div class="titlepage"> <a id="contents-vim" name="contents-vim"></a> <h2 class="sect2"> 10.17.3. Contents of Vim </h2> </div> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installed programs:</span></strong> <span class="seg">efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh, vimtutor, and xxd</span> </div> </div> </div> <div class="variablelist"> <h3> <a id="id3670916" name="id3670916"></a>Short Descriptions </h3> <table border="0"> <col align="left" valign="top" /> <tbody> <tr> <td> <a id="efm_filter.pl" name="efm_filter.pl"></a><span class= "term"><span><strong class= "command">efm_filter.pl</strong></span></span> </td> <td> <p> A filter for creating an error file that can be read by <span><strong class="command">vim</strong></span> </p> </td> </tr> <tr> <td> <a id="efm_perl.pl" name="efm_perl.pl"></a><span class= "term"><span><strong class= "command">efm_perl.pl</strong></span></span> </td> <td> <p> Reformats the error messages of the Perl interpreter for
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -