cheatsheets/vim-help.md

133 lines
3.4 KiB
Markdown
Raw Permalink Normal View History

2015-04-21 05:56:07 +00:00
---
title: Vim helpfiles
2015-11-24 04:48:01 +00:00
category: Vim
2017-09-09 09:27:23 +00:00
updated: 2017-09-09
2015-04-21 05:56:07 +00:00
---
2017-09-09 09:27:23 +00:00
## Writing help files
{: .-left-reference}
2015-04-21 05:56:07 +00:00
### Creating a document
```nohighlight
:e doc/potion.txt
:set ft=help
:set ft=text
```
2017-09-09 09:27:23 +00:00
Use `ft=help` to preview it, and `ft=text` to edit it.
2015-04-21 06:13:26 +00:00
### Example
2015-04-21 05:56:07 +00:00
2015-04-21 06:13:26 +00:00
```nohighlight
*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.
2017-09-09 09:27:23 +00:00
vim:tw=78:ts=8:ft=help:norl:
2015-04-21 06:13:26 +00:00
```
2015-04-21 05:56:07 +00:00
2017-09-09 09:27:23 +00:00
This is a cheatsheet for writing Vim help files. See: `:help help-writing`
## Syntax
### Reference
| Code | Description | Example |
| ----- | ----- | ----- |
| *Inline items* |
| ----- | ----- | ----- |
| `*tags*` | Tags | |
| `|link-to-tags|` | Links to tags | `|:command|` |
| `'vimoption'` | Vim option | `'textwidth'` |
| ----- | ----- | ----- |
| `{code-text}` | Code text | `{Visual}gf` |
| `<code-text>` | Code text | `<PageDown>` |
| `` `code-text` `` | Code text | `` `set fo=want` `` |
| `CTRL-X` | Code text | |
| ----- | ----- | ----- |
| *Block items* |
| ----- | ----- | ----- |
| `INTRODUCTION *tag*` | Section header | |
| `Column heading~` | Highlighting | |
| `www.url.com` | Web URL | |
| ----- | ----- | ----- |
| `=====` | Separator | |
| `-----` | Separator | |
2015-04-21 05:56:07 +00:00
2015-04-21 06:13:26 +00:00
### Tags
* Tags are created with asterisks, eg, `*potion-usage*`
* Links to tags are `|potion-usage|`
* Press `^]` to jump to a tag
2015-04-21 05:56:07 +00:00
### Code blocks
```
Example: >
xyz
<
```
2017-09-09 09:27:23 +00:00
Surround with `>` and `<` characters
2015-04-21 05:56:07 +00:00
### File header
```
*potion.txt* functionality for the potion programming language
```
2017-09-09 09:27:23 +00:00
It's customary to start a file with a tag of the filename, plus a description.
2015-04-21 05:56:07 +00:00
### Heading
```
==============================================================================
CONTENTS *potion-contents*
```
2017-09-09 09:27:23 +00:00
Starts with `ALL CAPS`, ends with `*a-tag*`
2015-04-21 05:56:07 +00:00
### Notes
Using `*Todo` and `*Error` will highlight your notes.
```
*Todo something to do
*Error something wrong
```
### Final modeline
```nohighlight
vim:tw=78:ts=8:ft=help:norl:
```
## Conventions
### Table of contents
```nohighlight
|rails-introduction| Introduction and Feature Summary
|rails-commands| General Commands
|rails-navigation| Navigation
```
```nohighlight
1.Intro...................................|ergonomic|
2.Note to use..............................|CAPSLOCK|
3.Insert Mode Remappings............|ergonomicInsert|
```
### Author lines
```nohighlight
Author: Jack Hackness <captain@time.com> *xyz-author*
License: Same terms as Vim itself (see |license|)
```