官术网_书友最值得收藏!

Read the Vim manual using :help

The best learning tool Vim can offer is certainly a :help command, as can be seen in the following screenshot:

It's an enormous collection of resources and tutorials which comes installed with Vim. Scroll through using the Page Up and Page Down keys (bonus point for using Ctrlb and Ctrl + f respectively), there is a lot of useful information there.

Whenever you are stuck, or want to learn more about a particular command, try searching it using :help (you can shorten it to :h). Let's try searching for a cc command we've learned :

:h cc

Help tells us the way the command works, as well as how different options and settings affect the command (for instance autoindent setting preserves the indentation).

:help is a command which navigates a set of help files. As you look through the help files, you'll notice that certain words are highlighted in color. These are tags, and can be searched for using the :help command. Unfortunately, not every tag name is intuitive. For instance, if we wanted to learn how to search for a string in Vim, we could try using the following:

:h search

However, it looks like this command takes us to the entry on expression evaluation, which is not exactly what we were looking for, as demonstrated by the following screenshot:

To find the right entry, type in :h search (don't hit Enter yet) followed by Ctrl + d. This will give you a list of help tags containing the substring search. One of the options shown is search-commands which is what we'd be looking for. Complete your command in the following way to get to the entry we were looking for:

:h search-commands

The following display shows the right help entry for search:

Speaking of search functionality, you can search inside help pages (or any file open in Vim) using /search term to search forward from the cursor or ?search term to search backward. See Chapter 2 ,  Advanced Editing and Navigation, to learn more about how to perform search operations.

Don't forget to use Vim's help system any time you have questions or want to better understand the way Vim behaves.

主站蜘蛛池模板: 辽阳市| 铁岭市| 博罗县| 南岸区| 隆安县| 呼玛县| 开原市| 叶城县| 罗平县| 句容市| 海门市| 和田市| 辉县市| 大余县| 文水县| 定边县| 闽清县| 若羌县| 青浦区| 甘肃省| 大石桥市| 延庆县| 申扎县| 瑞安市| 新河县| 北流市| 新晃| 陆川县| 银川市| 宝清县| 淮阳县| 蒲城县| 大化| 通化市| 凌源市| 嘉定区| 韶关市| 临湘市| 龙州县| 疏勒县| 尖扎县|