Vim Tips Wiki


Template page

Revision as of 10:13, July 16, 2012 by JohnBeckett (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
1,616pages on
this wiki

This template can be used in a tip to create nowiki code samples.


  • "{{code|Bold <b>, italic <i>}}" displays as "Bold <b>, italic <i>"

Instead of using this template, it is best to use <code> tags to display code samples because that always works and is simple for other editors to understand. For example, <code>:echo 'An example'</code> displays as :echo 'An example'.

Our MediaWiki:Common.css causes text in code tags to not wrap: the above example will not have a line break within the text. The same applies to text produced by the {{code}} template.

Text in code tags obeys the normal rules of wikitext, but the code template displays the text as "nowiki". For example:

  • "<code>some ''italic <u>text</u>''</code>" displays as "some italic text"
  • "{{code|some ''italic <u>text</u>''}}" displays as "some ''italic <u>text</u>''"

However, text in a template parameter must not use:

  • = (workaround is to put 1= before the parameter: {{code|1=:set ts=12}})
  • | (workaround is to use &#124; instead of |)
  • }} (indicates the end of the template)

Around Wikia's network

Random Wiki