Vim/zh-cn

Vim (Vi improved) 是一个基于 的本文编辑器. It can be used from the command-line or as a standalone application with a graphical user interface.

Emerge
如果不需要X Window System支持，请安装:

附加软件

Gvim
To install Vim with both the ncurses-based interface as well as the graphical interface (for the X Window System - ), install the  package:

Vim-qt
There is also an experimental Qt interface called which can also be installed.

插件
“app-vim”类别提供了大量额外的语法定义，插件和其他Vim相关的东西.

Use or  to get an overview of available packages in the app-vim category:

文件
Vim can be configured on a per-user basis or through a system-wide configuration file:


 * - The system wide (global) settings file.
 * - The user-specific (local) configuration file. The tilde (~) means it is in the user's home directory.

开始
Vim has a built-in tutorial which should require around 30 min to go through. Start it using the command:

像ex或ed一样从命令行使用Vim
It is possible to use Vim for one-liners — commands that can be used in scripts or on the command line to make changes in an unattended manner.

For instance, the following command adds  to the beginning of each line in the  file:

What happens is that Vim interprets the passed on commands (through the  option). The first command is Vim's substitution command (which is very similar to 's), the second one is Vim's instruction to save and exit the editor.

Change file encoding
To change the file encoding of a file to UTF-8, use the following command (in Vim command mode):

As shown in the previous trick, it is possible to do this from the command line as well:

参考

 * Vim Guide - Explains how to use Vim in greater detail.

外部资源

 * Vim Documentation 包括Manuals (aka ":help" and Free VIM OPL Book), FAQS, HOWTO's, Tutorials, in HTML PDF, and PS formats.
 * A vim Tutorial and Primer - 一个优秀的vim教程/入门书. 首先阅读它.
 * VIM Scripts/Plugins
 * Vim for Humans (free ebook) - Clone and into the sources directory,, change   to   for SPHINXBUILD in . Run . Read PDF in.
 * Learning the vi and Vim Editors, 7th Edition O'Reilly  Print ISBN: 978-0-596-52983-3, Ebook ISBN: 978-0-596-15935-1
 * Vim anti-patterns - Vim维护的博客条目.