Jump to content

Help:Text editor support

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Patrick (talk | contribs) at 13:12, 19 July 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Many text editors have a feature called syntax highlighting, where various syntatical elements of the text are given different colours. Although this is most useful when editing source code, the method is equally applicable to editing wiki-markup. Below are instructions for installing Wikipedia syntax highlighting.

Syntax highlighting sample with the "murphy" colour scheme

[[link]] [http://arin.net/whois External link] [editorial remark]
* Bullet
; Definition
# Numbered list
::::**::*: Excessive indenting
This: # is not a numbered list
<strong>HTML formatting<i>bold-italic</i>bold</strong>
<a href="Hello">Absence of HTML formatting</a>
 preformatted
''italic'''''bold'''''''bold-italic''''
'''[[bold links are not very bold]]'''
<math>\left(Not-A\right)</math>
<font color=red>
=H1=
==H2==
This is meant to be at the start of the line: ===H3===
====H4====
=====H5=====
======H6=====
-----
</font>

This example shows the use of colors and that bold and italics are applied, but the font difference between normal and preformatted is not shown. It also shows (by color) that a header code with text in front is treated as a regular text.

Save the target of the following link to your "syntax" directory. By default, this directory is "~/.vim/syntax" on a Unix system, and "C:\Program Files\Vim\vimfiles\syntax" on a Windows system.

Click here for wikipedia.vim

To autodetect files ending in ".wiki", add the following lines to ".vim/filetype.vim" or "vimfiles\filetype.vim" (or create the file if it doesn't exist):

augroup filetypedetect
au BufNewFile,BufRead *.wiki	setf wikipedia
augroup END

Alternatively, the command "set syn=wikipedia" will temporarily set the syntax for the current file.

If you are not familiar with Vim, here's some advice. Wikipedia articles often only have line-breaks at the end of each paragraph, a situation Vim is not designed for. The following lines added to your ".vimrc" or "_vimrc" file will make it much easier to edit such files:

set tw=0
set lbr
map <Up> gk
map <Down> gj
imap <Up> <C-O>gk
imap <Down> <C-O>gj

Please feel free to edit wikipedia.vim and upload an improved copy. This is a Wiki, after all.