Cheat Sheet速查表
跳转到主要内容

Vim 帮助文件 速查表

本文根据 Devhints / Vim helpfiles 翻译。代码示例及版本范围沿用原文。原文标注更新日期:2017-09-09。

编写帮助文件

创建文档

:e doc/potion.txt
:set ft=help
:set ft=text

使用 ft=help 预览文档,以及 ft=text 编辑文档。

示例

*ack.txt*   Plugin that integrates ack with Vim

==============================================================================
USAGE INSTRUCTIONS                                                 *ack-usage*

:Ack[!] {pattern}                                                       *:Ack*

    Search recursively for {pattern}. See |:AckAdd|.
    Also see http://beyondgrep.com for more information.

vim:tw=78:ts=8:ft=help:norl:

这是一份关于编写 Vim 帮助文件的速查表。参见: :help help-writing

语法

参考资料

代码 (Code)说明示例
行内元素
*tags*标签
|link-to-tags|指向标签的链接|:command|
'vimoption'Vim 选项'textwidth'
{code-text}代码文本{Visual}gf
<code-text>代码文本<PageDown>
`code-text`代码文本`set fo=want`
CTRL-X代码文本
块级元素
INTRODUCTION *tag*章节标题
Column heading~高亮显示
www.url.comWeb URL
=====分隔符
-----分隔符

标签

  • 使用星号创建标签,例如: *potion-usage*
  • 指向标签的链接为 |potion-usage|
  • 按下 ^] 以跳转至标签

代码块

Example: >
 xyz
<

使用……包裹 > 以及 < 字符

文件头

*potion.txt*  functionality for the potion programming language

通常在文件开头放置一个包含文件名的标签,并附带说明。

标题

==============================================================================
CONTENTS                                                     *potion-contents*

以……开头 ALL CAPS,以……结尾 *a-tag*

说明

使用方法 *Todo 以及 *Error 将高亮显示您的笔记。

	*Todo something to do
	*Error something wrong

末尾模式行 (Modeline)

vim:tw=78:ts=8:ft=help:norl:

约定

目录

|rails-introduction|            Introduction and Feature Summary
|rails-commands|                General Commands
|rails-navigation|              Navigation
    1.Intro...................................|ergonomic|
    2.Note to use..............................|CAPSLOCK|
    3.Insert Mode Remappings............|ergonomicInsert|

作者信息行

Author:  Jack Hackness <captain@time.com>         *xyz-author*
License: Same terms as Vim itself (see |license|)