Vim Tips Wiki
Advertisement
Vim Tip Guidelines
Quick reference
General guidelines
Titles and renaming a tip
Comments
Categories
Discussion page
Merging similar tips
Deleting a tip
Templates
Formatting code blocks
Entities and other magic
Script comments

Character entity references

In short

  • Use &lt;q-args> to display <q-args>.
  • Use &lt;S-F1> to display <S-F1> (and similar for <S-Left>, <S-Tab> etc).
  • Use \&lt;i\> to display \<i\>.
  • Use &lt;Del> to display <Del>.
  • Do not use &lt; or &gt; or &amp; except in the above cases.

The above applies only to normal text; special markup is not required in a <pre>...</pre> block.

Background

  • Originally, all tips used &lt; &gt; &amp; character entities (rather than < > &).
  • However, we now discourage use of character entities in wikitext because they are rarely required, and they make editing a lot harder.
  • However, you must use character entities to display <q-args> and <S-F1> (and similar).
  • Some cases (for example, /\<i\> to search for the word i) also require character entities. When in doubt, use Show preview to confirm that the text renders correctly.

The MediaWiki software converts wikitext entered by editors to HTML for display. Some HTML tags are allowed in wikitext (please don't use HTML in the Vim Tips wiki, but it is possible).

Any special characters such as < that are not part of a recognized tag are converted to references like &lt;. Since, for example, "CR" is not a supported tag, wikitext such as <CR> will be converted to &lt;CR&gt; by MediaWiki.

The Wikia list of supported HTML tags shows that in practice it is not likely that a Vim tip will contain text that looks like a tag, except for <q> and <s>. To handle tag attributes, any non-word characters following a recognized tag are allowed. Therefore, <q-xxx> and <s-xxx> will cause trouble (q is a quote tag; s is a strikethrough tag; - is any non-word character; xxx is any text).

Special text

Wikitext in double braces, for example {{help|pattern}}, is used to insert a template into the page.

Wikitext in double square brackets, for example [[Searching]], creates a link to another page appearing as Searching. You can specify the link text; for example [[Searching|how to search]] appears as how to search.

However, wikitext like [[Category:Folding]] puts a page in a category, although we use another technique for tips.

Use a leading colon to make a link to a category page. For example, the wikitext [[:Category:Folding|folding category]] makes a folding category link.

Double braces and double brackets have no special meaning when used inside <pre>...</pre> tags, or when used inside <nowiki>...</nowiki> tags. For example, the wikitext <tt><nowiki>{{test}}</nowiki></tt> displays as {{test}}.

Several magic words have a special meaning in wikitext. On a short tip, you might want to prevent the display of a table of contents (by default, a TOC is shown if there are more than three headings). Insert a single line consisting of __NOTOC__ before the tip to suppress the TOC.

By default, each heading creates an [edit] link allowing editing of a single section. In rare cases, you could insert a line before the tip consisting of __NOEDITSECTION__ to suppress edit links.

Advertisement